summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/XIGrabDevice.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/XIGrabDevice.c b/src/XIGrabDevice.c
index 66e359b..985d3f1 100644
--- a/src/XIGrabDevice.c
+++ b/src/XIGrabDevice.c
@@ -55,13 +55,13 @@ XIGrabDevice(Display* dpy, int deviceid, Window grab_window, Time time,
req->grab_mode = grab_mode;
req->paired_device_mode = paired_device_mode;
req->owner_events = owner_events;
- req->mask_len = mask->mask_len;
+ req->mask_len = (mask->mask_len + 3)/4;
req->cursor = cursor;
/* masks.mask_len is in bytes, but we need 4-byte units on the wire,
* and they need to be padded with 0 */
- len = (mask->mask_len + 3) / 4;
+ len = req->mask_len * 4;
buff = calloc(1, len);
memcpy(buff, mask->mask, mask->mask_len);