aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/Xi/xigrabdev.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/Xi/xigrabdev.c')
-rw-r--r--xorg-server/Xi/xigrabdev.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/xorg-server/Xi/xigrabdev.c b/xorg-server/Xi/xigrabdev.c
index a4344be4a..086e275d8 100644
--- a/xorg-server/Xi/xigrabdev.c
+++ b/xorg-server/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,