From 08d7c4ba7266c626d28273750218446d3c693805 Mon Sep 17 00:00:00 2001 From: jacob Date: Mon, 26 Jun 2006 22:01:51 +0000 Subject: [PATCH] Since r6711, puzzles built with Gtk 1.2 would take double actions when a menu accelerator key (N/U/R/Q) was pressed -- once for the menu accelerator, and once more in key_event(). This workaround, while unlovely, should at least not break in future (since the things it relies on are unlikely to change). git-svn-id: svn://svn.tartarus.org/sgt/puzzles@6745 cda61777-01e9-0310-a592-d414129be87e --- gtk.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gtk.c b/gtk.c index 7493853..99cc4cb 100644 --- a/gtk.c +++ b/gtk.c @@ -518,6 +518,16 @@ static gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data) if (!fe->pixmap) return TRUE; +#if !GTK_CHECK_VERSION(2,0,0) + /* Gtk 1.2 passes a key event to this function even if it's also + * defined as an accelerator. + * Gtk 2 doesn't do this, and this function appears not to exist there. */ + if (fe->accelgroup && + gtk_accel_group_get_entry(fe->accelgroup, + event->keyval, event->state)) + return TRUE; +#endif + if (event->keyval == GDK_Up) keyval = shift | ctrl | CURSOR_UP; else if (event->keyval == GDK_KP_Up || event->keyval == GDK_KP_8) -- 2.11.0