[gtk+] gtk: Parse keypad numbers correctly
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] gtk: Parse keypad numbers correctly
- Date: Wed, 16 Nov 2011 18:51:02 +0000 (UTC)
commit de47b90fd10ac494fda16af4c723ed2d5f6be946
Author: Bastien Nocera <hadess hadess net>
Date: Wed Nov 16 18:47:39 2011 +0000
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
gtk/gtkaccelgroup.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkaccelgroup.c b/gtk/gtkaccelgroup.c
index 6d30880..18b40b6 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]