diff options
author | Bastien Nocera <hadess@hadess.net> | 2011-11-16 18:47:39 +0000 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2011-11-16 18:47:39 +0000 |
commit | de47b90fd10ac494fda16af4c723ed2d5f6be946 (patch) | |
tree | 091de03c5eec4201797f4e890606001cb88d3e94 /gtk/gtkaccelgroup.c | |
parent | ef5476f16aeaf817f4fbc291807d336ebdc0db9e (diff) | |
download | gtk+-de47b90fd10ac494fda16af4c723ed2d5f6be946.tar.gz |
gtk: Parse keypad numbers correctly
Try to find keycodes for keysyms at level-0 in the keymap, but don't
fail to parse if we can find those in level-1. This fixes the
parsing of numerical keys on the keypad, which require a shift level
through Num-Lock.
https://bugzilla.gnome.org/show_bug.cgi?id=606727
Diffstat (limited to 'gtk/gtkaccelgroup.c')
-rw-r--r-- | gtk/gtkaccelgroup.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gtk/gtkaccelgroup.c b/gtk/gtkaccelgroup.c index 6d30880cda..18b40b6a95 100644 --- a/gtk/gtkaccelgroup.c +++ b/gtk/gtkaccelgroup.c @@ -1380,12 +1380,20 @@ gtk_accelerator_parse_with_keycode (const gchar *accelerator, { *accelerator_codes = g_new0 (guint, n_keys + 1); + /* Prefer level-0 keys to modified keys */ for (i = 0, j = 0; i < n_keys; ++i) { if (keys[i].level == 0) (*accelerator_codes)[j++] = keys[i].keycode; } + /* No level-0 keys? Find in the whole keymap */ + if (j == 0) + { + for (i = 0, j = 0; i < n_keys; ++i) + (*accelerator_codes)[j++] = keys[i].keycode; + } + if (j == 0) { g_free (*accelerator_codes); |