diff options
author | Matthias Clasen <mclasen@redhat.com> | 2005-09-06 18:13:56 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2005-09-06 18:13:56 +0000 |
commit | 244d41b94a045633281e47d720311e907d83aedb (patch) | |
tree | 5c6b4e81e0e960dc7fb4d7f167a8c86e33059ea5 /gtk/gtkkeyhash.c | |
parent | 543ce67477599e8b519a66fec1fc34d2e7157066 (diff) | |
download | gtk+-244d41b94a045633281e47d720311e907d83aedb.tar.gz |
Add tests for extra virtual modifiers.
2005-09-06 Matthias Clasen <mclasen@redhat.com>
* tests/testgtk.c (create_key_lookup): Add tests for extra virtual
modifiers.
* gtk/gtkkeyhash.c (_gtk_key_hash_lookup): Try to match both against
Mod2 - Mod5 and against Super, Hyper, Meta.
* gtk/gtkaccellabel.c (_gtk_accel_label_class_get_accelerator_label):
* gtk/gtkaccelgroup.c (gtk_accelerator_parse)
(gtk_accelerator_name): Support Super, Hyper Meta and Mod2 - Mod5.
Diffstat (limited to 'gtk/gtkkeyhash.c')
-rw-r--r-- | gtk/gtkkeyhash.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/gtk/gtkkeyhash.c b/gtk/gtkkeyhash.c index 2741545081..12648e050d 100644 --- a/gtk/gtkkeyhash.c +++ b/gtk/gtkkeyhash.c @@ -358,8 +358,17 @@ _gtk_key_hash_lookup (GtkKeyHash *key_hash, while (tmp_list) { GtkKeyHashEntry *entry = tmp_list->data; - - if ((entry->modifiers & ~consumed_modifiers & mask) == (state & ~consumed_modifiers & mask)) + GdkModifierType xmods, vmods; + + /* If the virtual super, hyper or meta modifiers are present, + * they will also be mapped to some of the mod2 - mod5 modifiers, + * so we compare them twice, ignoring either set. + */ + xmods = GDK_MOD2_MASK|GDK_MOD3_MASK|GDK_MOD4_MASK|GDK_MOD5_MASK; + vmods = GDK_SUPER_MASK|GDK_HYPER_MASK|GDK_META_MASK; + + if ((entry->modifiers & ~consumed_modifiers & mask & ~vmods) == (state & ~consumed_modifiers & mask & ~vmods) || + (entry->modifiers & ~consumed_modifiers & mask & ~xmods) == (state & ~consumed_modifiers & mask & ~xmods)) { gint i; |