[PATCH libXi 1/3] Handle new XIAllowEvent request size

Peter Hutterer peter.hutterer at who-t.net
Thu Jan 26 21:50:42 PST 2012


inputproto 2.1.99.6 restored the previous request for ABI compatibility
reasons, plus it dropped the grab_window argument.

Handle that by inverting the current logic and sending touchid
down the wire as extra data.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 configure.ac        |    2 +-
 src/XIAllowEvents.c |   18 +++++++++---------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/configure.ac b/configure.ac
index 481cf44..46f2fb8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -28,7 +28,7 @@ XORG_WITH_ASCIIDOC(8.4.5)
 XORG_CHECK_MALLOC_ZERO
 
 # Obtain compiler/linker options for dependencies
-PKG_CHECK_MODULES(XI, [xproto >= 7.0.13] [x11 >= 1.4.99.1] [xextproto >= 7.0.3] [xext >= 1.0.99.1] [inputproto >= 2.1.99.3])
+PKG_CHECK_MODULES(XI, [xproto >= 7.0.13] [x11 >= 1.4.99.1] [xextproto >= 7.0.3] [xext >= 1.0.99.1] [inputproto >= 2.1.99.6])
 
 # Check for xmlto and asciidoc for man page conversion
 # (only needed by people building tarballs)
diff --git a/src/XIAllowEvents.c b/src/XIAllowEvents.c
index d987549..5fa77ca 100644
--- a/src/XIAllowEvents.c
+++ b/src/XIAllowEvents.c
@@ -38,7 +38,6 @@ _XIAllowEvents(Display *dpy, int deviceid, int event_mode, Time time,
                     unsigned int touchid, Window grab_window)
 {
     Bool have_XI22 = True;
-    int req_len = sz_xXIAllowEventsReq; /* in bytes */
     xXIAllowEventsReq *req;
 
     XExtDisplayInfo *extinfo = XInput_find_display(dpy);
@@ -47,13 +46,10 @@ _XIAllowEvents(Display *dpy, int deviceid, int event_mode, Time time,
     if (_XiCheckExtInit(dpy, XInput_2_0, extinfo) == -1)
 	return (NoSuchExtension);
 
-    /* 2.2's XIAllowEvents is 8 bytes longer than 2.0 */
-    if (_XiCheckExtInit(dpy, XInput_2_2, extinfo) == -1) {
-        req_len -= 8;
-        have_XI22 = False;
-    }
+    if (_XiCheckExtInit(dpy, XInput_2_2, extinfo) == 0)
+        have_XI22 = True;
 
-    GetReqSized(XIAllowEvents, req_len, req);
+    GetReq(XIAllowEvents, req);
 
     req->reqType = extinfo->codes->major_opcode;
     req->ReqType = X_XIAllowEvents;
@@ -62,8 +58,12 @@ _XIAllowEvents(Display *dpy, int deviceid, int event_mode, Time time,
     req->time = time;
 
     if (have_XI22) {
-        req->touchid = touchid;
-        req->grab_window = grab_window;
+        /* 2.2's XIAllowEvents is 4 bytes longer than 2.0 */
+        int len = 1;
+        long extra = touchid;
+
+        SetReqLen(req, len, len);
+        Data32(dpy, &extra, len << 2);
     }
 
     UnlockDisplay(dpy);
-- 
1.7.7.5



More information about the xorg-devel mailing list