diff options
Diffstat (limited to 'xorg-server/Xi/grabdevk.c')
-rw-r--r-- | xorg-server/Xi/grabdevk.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/xorg-server/Xi/grabdevk.c b/xorg-server/Xi/grabdevk.c index 6a245f25a..b34867b5f 100644 --- a/xorg-server/Xi/grabdevk.c +++ b/xorg-server/Xi/grabdevk.c @@ -50,8 +50,6 @@ SOFTWARE. * */ -#define NEED_EVENTS -#define NEED_REPLIES #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif @@ -103,11 +101,13 @@ ProcXGrabDeviceKey(ClientPtr client) DeviceIntPtr mdev; XEventClass *class; struct tmask tmp[EMASKSIZE]; + GrabParameters param; + GrabMask mask; REQUEST(xGrabDeviceKeyReq); REQUEST_AT_LEAST_SIZE(xGrabDeviceKeyReq); - if (stuff->length != (sizeof(xGrabDeviceKeyReq) >> 2) + stuff->event_count) + if (stuff->length != bytes_to_int32(sizeof(xGrabDeviceKeyReq)) + stuff->event_count) return BadLength; ret = dixLookupDevice(&dev, stuff->grabbed_device, client, DixGrabAccess); @@ -116,14 +116,14 @@ ProcXGrabDeviceKey(ClientPtr client) if (stuff->modifier_device != UseXKeyboard) { ret = dixLookupDevice(&mdev, stuff->modifier_device, client, - DixReadAccess); + DixUseAccess); if (ret != Success) return ret; if (mdev->key == NULL) return BadMatch; } else { mdev = PickKeyboard(client); - ret = XaceHook(XACE_DEVICE_ACCESS, client, mdev, DixReadAccess); + ret = XaceHook(XACE_DEVICE_ACCESS, client, mdev, DixUseAccess); if (ret != Success) return ret; } @@ -135,10 +135,17 @@ ProcXGrabDeviceKey(ClientPtr client) X_GrabDeviceKey)) != Success) return ret; - ret = GrabKey(client, dev, stuff->this_device_mode, - stuff->other_devices_mode, stuff->modifiers, mdev, - stuff->key, stuff->grabWindow, stuff->ownerEvents, - tmp[stuff->grabbed_device].mask); + + memset(¶m, 0, sizeof(param)); + param.grabtype = GRABTYPE_XI; + param.ownerEvents = stuff->ownerEvents; + param.this_device_mode = stuff->this_device_mode; + param.other_devices_mode = stuff->other_devices_mode; + param.grabWindow = stuff->grabWindow; + param.modifiers = stuff->modifiers; + mask.xi = tmp[stuff->grabbed_device].mask; + + ret = GrabKey(client, dev, mdev, stuff->key, ¶m, GRABTYPE_XI, &mask); return ret; } |