1
From 53cbbc00df3884bc3ca87e2818a08ba3ba2fabac Mon Sep 17 00:00:00 2001
2
From: Keng-Yu Lin <kengyu@ubuntu.com>
3
Date: Tue, 22 May 2012 15:11:26 +0800
4
Subject: [PATCH] common: mask out virtual modifiers in key grabbing code
6
gdk_keymap_map_virtual_modifiers converts all the virtual
7
modifiers in the state mask (Super, Hyper, Meta, etc) of a
8
key event to the real modifiers they're mapped to. This
9
call is needed, because XGrabKey and friends only work
10
with real modifiers (Mod1, Mod2, ...).
12
Unforunately, gdk_keymap_map_virtual_modifiers doesn't mask
13
out the virtual modifers, it merely adds in the associated
16
This commit does the masking immediately following the call,
17
so that virtual modifier don't ultimately get passed to X
18
when setting up the key grabs.
20
https://bugzilla.gnome.org/show_bug.cgi?id=676300
22
plugins/common/gsd-keygrab.c | 2 ++
23
1 file changed, 2 insertions(+)
25
diff --git a/plugins/common/gsd-keygrab.c b/plugins/common/gsd-keygrab.c
26
index f8432cd..bb85b87 100644
27
--- a/plugins/common/gsd-keygrab.c
28
+++ b/plugins/common/gsd-keygrab.c
29
@@ -153,6 +153,7 @@ grab_key_unsafe (Key *key,
30
/* XGrabKey requires real modifiers, not virtual ones */
31
modifiers = key->state;
32
gdk_keymap_map_virtual_modifiers (gdk_keymap_get_default (), &modifiers);
33
+ modifiers &= ~(GDK_META_MASK | GDK_SUPER_MASK | GDK_HYPER_MASK);
35
/* If key doesn't have a usable modifier, we don't want
36
* to grab it, since the user might lose a useful key.
37
@@ -324,6 +325,7 @@ match_xi2_key (Key *key, XIDeviceEvent *event)
38
* the XEvent will be using the real modifier, so translate those */
40
gdk_keymap_map_virtual_modifiers (gdk_keymap_get_default (), &mask);
41
+ mask &= ~(GDK_META_MASK | GDK_SUPER_MASK | GDK_HYPER_MASK);
43
gdk_keyval_convert_case (keyval, &lower, &upper);