[PATCH 38/42] Xi: assign correct grab_mode/other_device_mode in XI2 passive grabs

Peter Hutterer peter.hutterer at who-t.net
Wed Dec 14 19:02:15 PST 2011


From: Carlos Garnacho <carlosg at gnome.org>

CreateGrab() expects the keyboard mode to be stored in grab_mode, and the
pointer mode in other_device_mode, so respect this in passive XI2 grabs,
and switch modes if needed.

Signed-off-by: Carlos Garnacho <carlosg at gnome.org>
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 Xi/xipassivegrab.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/Xi/xipassivegrab.c b/Xi/xipassivegrab.c
index fa2db38..0ca44cf 100644
--- a/Xi/xipassivegrab.c
+++ b/Xi/xipassivegrab.c
@@ -151,11 +151,17 @@ ProcXIPassiveGrabDevice(ClientPtr client)
     memset(&param, 0, sizeof(param));
     param.grabtype = XI2;
     param.ownerEvents = stuff->owner_events;
-    param.this_device_mode = stuff->grab_mode;
-    param.other_devices_mode = stuff->paired_device_mode;
     param.grabWindow = stuff->grab_window;
     param.cursor = stuff->cursor;
 
+    if (IsKeyboardDevice(dev)) {
+        param.this_device_mode = stuff->grab_mode;
+        param.other_devices_mode = stuff->paired_device_mode;
+    } else {
+        param.this_device_mode = stuff->paired_device_mode;
+        param.other_devices_mode = stuff->grab_mode;
+    }
+
     if (stuff->cursor != None)
     {
         ret = dixLookupResourceByType(&tmp, stuff->cursor,
-- 
1.7.7.1



More information about the xorg-devel mailing list