summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2009-05-18 16:18:27 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2009-05-18 16:55:15 +1000
commit7f1f0b9cf8ad17b5a4694406137a1c2114918a67 (patch)
tree0f3e6e051ea8cfa02993adaa1f48552649b5c710
parentdb94dc37529fc3e5e3decad67d312ea108e860d2 (diff)
XIQueryPointer: fix wrong reply extra data reading.
libXi does it differently than the server, so don't try to access &reply[1], instead use _XRead as it should be. Reported-by: Mark Dokter Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--src/XQueryDvPtr.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/XQueryDvPtr.c b/src/XQueryDvPtr.c
index e89cdd7..e4be23b 100644
--- a/src/XQueryDvPtr.c
+++ b/src/XQueryDvPtr.c
@@ -69,12 +69,14 @@ XIQueryPointer(Display *dpy,
req->deviceid = deviceid;
req->win = w;
- if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+ if (!_XReply(dpy, (xReply *)&rep,
+ (sizeof(xXIQueryPointerReply) - sizeof(xReply))/4, xFalse)) {
UnlockDisplay(dpy);
SyncHandle();
return False;
}
+
*root = rep.root;
*child = rep.child;
*root_x = FP1616toDBL(cvtINT16toInt(rep.root_x));
@@ -92,7 +94,7 @@ XIQueryPointer(Display *dpy,
buttons->mask_len = rep.buttons_len * 4;
buttons->mask = malloc(buttons->mask_len);
if (buttons->mask)
- memcpy(buttons->mask, (char*)(&rep + 1), buttons->mask_len);
+ _XRead(dpy, (char*)buttons->mask, buttons->mask_len);
UnlockDisplay(dpy);
SyncHandle();