summaryrefslogtreecommitdiff
path: root/Xi
diff options
context:
space:
mode:
authorRui Matos <tiagomatos@gmail.com>2013-04-13 04:22:54 +0200
committerPeter Hutterer <peter.hutterer@who-t.net>2013-04-15 10:21:48 +1000
commit9003399708936481083424b4ff8f18a16b88b7b3 (patch)
tree71d731b175a3699becef344baa09596af9ba31a9 /Xi
parentd16284687ddeffde32a561b8c67b2e2e3d66aeaa (diff)
Xi: fix swapped grab mode args for keyboard devices in XIGrabDevice
The protocol says that the grab_mode argument applies to the device being grabbed and paired_device_mode to the paired master device. GrabDevice() however takes in a pointer mode and a keyboard mode and so we have to swap the values according the type of device being grabbed. Signed-off-by: Rui Matos <tiagomatos@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'Xi')
-rw-r--r--Xi/xigrabdev.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/Xi/xigrabdev.c b/Xi/xigrabdev.c
index 09186e84f..63d95bc1c 100644
--- a/Xi/xigrabdev.c
+++ b/Xi/xigrabdev.c
@@ -67,6 +67,8 @@ ProcXIGrabDevice(ClientPtr client)
uint8_t status;
GrabMask mask = { 0 };
int mask_len;
+ unsigned int keyboard_mode;
+ unsigned int pointer_mode;
REQUEST(xXIGrabDeviceReq);
REQUEST_AT_LEAST_SIZE(xXIGrabDeviceReq);
@@ -78,6 +80,15 @@ ProcXIGrabDevice(ClientPtr client)
if (!IsMaster(dev))
stuff->paired_device_mode = GrabModeAsync;
+ if (IsKeyboardDevice(dev)) {
+ keyboard_mode = stuff->grab_mode;
+ pointer_mode = stuff->paired_device_mode;
+ }
+ else {
+ keyboard_mode = stuff->paired_device_mode;
+ pointer_mode = stuff->grab_mode;
+ }
+
if (XICheckInvalidMaskBits(client, (unsigned char *) &stuff[1],
stuff->mask_len * 4) != Success)
return BadValue;
@@ -91,8 +102,8 @@ ProcXIGrabDevice(ClientPtr client)
xi2mask_set_one_mask(mask.xi2mask, dev->id, (unsigned char *) &stuff[1],
mask_len);
- ret = GrabDevice(client, dev, stuff->grab_mode,
- stuff->paired_device_mode,
+ ret = GrabDevice(client, dev, pointer_mode,
+ keyboard_mode,
stuff->grab_window,
stuff->owner_events,
stuff->time,