summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2020-01-18 23:57:41 +0100
committerThomas White <taw@physics.org>2020-01-18 23:57:41 +0100
commit9aac9867abd6b99d4e2739c162bbd8fbc47a123d (patch)
tree21237cee359857e5684e01c6a2bd1767b7d274cb
parentae5112ce573d88be392248978de623200330a143 (diff)
Add ability to go backwards
-rw-r--r--glitchyclock.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/glitchyclock.c b/glitchyclock.c
index 0e15787..a5e2894 100644
--- a/glitchyclock.c
+++ b/glitchyclock.c
@@ -122,6 +122,23 @@ static void run_cue(struct glitchyclock *gc)
}
+static void back_cue(struct glitchyclock *gc)
+{
+ if ( gc->cue == 0 ) return;
+ gc->cue--;
+ gc->real_time_last_cue = get_monotonic_seconds() - 10;
+ gc->flag = 1;
+ if ( cues[gc->cue].type == FADE_IN ) {
+ gc->real_time_last_reset = get_monotonic_seconds() - 10;
+ gc->base_hours = cues[gc->cue].hours;
+ gc->base_minutes = cues[gc->cue].minutes;
+ gc->base_seconds = cues[gc->cue].seconds;
+ }
+}
+
+
+
+
static gboolean draw_sig(GtkWidget *widget, cairo_t *cr, struct glitchyclock *gc)
{
double lw, lh;
@@ -274,6 +291,12 @@ static gboolean key_press_sig(GtkWidget *da, GdkEventKey *event, struct glitchyc
return TRUE;
}
+ if ( event->keyval == GDK_KEY_BackSpace ) {
+ back_cue(gc);
+ redraw_cb(gc);
+ return TRUE;
+ }
+
if ( event->keyval == GDK_KEY_q ) {
gtk_main_quit();
}