[gnome-settings-daemon] common: mask out virtual modifiers in key grabbing code



commit 53cbbc00df3884bc3ca87e2818a08ba3ba2fabac
Author: Keng-Yu Lin <kengyu ubuntu com>
Date:   Tue May 22 15:11:26 2012 +0800

    common: mask out virtual modifiers in key grabbing code
    
    gdk_keymap_map_virtual_modifiers converts all the virtual
    modifiers in the state mask (Super, Hyper, Meta, etc) of a
    key event to the real modifiers they're mapped to. This
    call is needed, because XGrabKey and friends only work
    with real modifiers (Mod1, Mod2, ...).
    
    Unforunately, gdk_keymap_map_virtual_modifiers doesn't mask
    out the virtual modifers, it merely adds in the associated
    real ones.
    
    This commit does the masking immediately following the call,
    so that virtual modifier don't ultimately get passed to X
    when setting up the key grabs.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=676300

 plugins/common/gsd-keygrab.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/plugins/common/gsd-keygrab.c b/plugins/common/gsd-keygrab.c
index f8432cd..bb85b87 100644
--- a/plugins/common/gsd-keygrab.c
+++ b/plugins/common/gsd-keygrab.c
@@ -153,6 +153,7 @@ grab_key_unsafe (Key                 *key,
         /* XGrabKey requires real modifiers, not virtual ones */
         modifiers = key->state;
         gdk_keymap_map_virtual_modifiers (gdk_keymap_get_default (), &modifiers);
+        modifiers &= ~(GDK_META_MASK | GDK_SUPER_MASK | GDK_HYPER_MASK);
 
         /* If key doesn't have a usable modifier, we don't want
          * to grab it, since the user might lose a useful key.
@@ -324,6 +325,7 @@ match_xi2_key (Key *key, XIDeviceEvent *event)
 		 * the XEvent will be using the real modifier, so translate those */
 		mask = key->state;
 		gdk_keymap_map_virtual_modifiers (gdk_keymap_get_default (), &mask);
+                mask &= ~(GDK_META_MASK | GDK_SUPER_MASK | GDK_HYPER_MASK);
 
 		gdk_keyval_convert_case (keyval, &lower, &upper);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]