diff options
-rw-r--r-- | cvg.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -13,6 +13,7 @@ struct cvg { IplImage *output; cairo_surface_t *input_surface; cairo_surface_t *output_surface; + guint last_press; }; static cairo_surface_t * @@ -109,15 +110,20 @@ key_event(GtkWidget *widget, GdkEventKey *event, gpointer userdata) switch (event->keyval) { case GDK_KEY_g: g_signal_emit_by_name(cvg->gauss_btn, "released", NULL); - g_signal_emit_by_name(cvg->gauss_btn, "clicked", NULL); + if (cvg->last_press == event->keyval) + g_signal_emit_by_name(cvg->gauss_btn, "clicked", + NULL); break; case GDK_KEY_o: g_signal_emit_by_name(cvg->open_btn, "released", NULL); - g_signal_emit_by_name(cvg->open_btn, "clicked", NULL); + if (cvg->last_press == event->keyval) + g_signal_emit_by_name(cvg->open_btn, "clicked", + NULL); break; } return FALSE; case GDK_KEY_PRESS: + cvg->last_press = event->keyval; switch (event->keyval) { case GDK_KEY_g: g_signal_emit_by_name(cvg->gauss_btn, "pressed", NULL); |