From: Enrico Tröger Date: Mon, 29 Mar 2010 22:39:31 +0000 (+0200) Subject: Filter keyboard state against modfifier default mask X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=05488d8bd3e1258ba258aad42a0949401e617c1a;p=midori Filter keyboard state against modfifier default mask The modifier state does in fact incorporate modal keys such as NumLock. So code assuming that state be 0 if no modifier is pressed is wrong, if NumLock, CapsLock and the like are active. The solution is to filter out these modal keys with gtk_accelerator_get_default_mod_mask(), and compare the result. This fixes the problem of being unable to type keys used as single-letter shortcuts. --- diff --git a/midori/midori-browser.c b/midori/midori-browser.c index 2e2c4c0d..cf83bb86 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -1784,12 +1784,14 @@ midori_browser_key_press_event (GtkWidget* widget, { GtkWindow* window = GTK_WINDOW (widget); GtkWidgetClass* widget_class; + guint clean_state; if (event->state & (GDK_CONTROL_MASK | GDK_MOD1_MASK)) if (sokoke_window_activate_key (window, event)) return TRUE; - if (!event->state && gtk_window_propagate_key_event (window, event)) + clean_state = event->state & gtk_accelerator_get_default_mod_mask(); + if (!clean_state && gtk_window_propagate_key_event (window, event)) return TRUE; if (!(event->state & (GDK_CONTROL_MASK | GDK_MOD1_MASK)))