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.
This commit is contained in:
parent
004a347340
commit
05488d8bd3
1 changed files with 3 additions and 1 deletions
|
@ -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)))
|
||||
|
|
Loading…
Reference in a new issue