summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2012-01-27 13:28:52 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2012-02-09 08:03:18 +1000
commitb355b7300235395717de06809ee6631ce55d3189 (patch)
tree5f5764c12915651658b9b30b7839c3c61bdfd537
parent07ced7b48219e3bc0c98806f3d7106f86d1b2ca0 (diff)
Handle new XIAllowEvent request size
inputproto 2.1.99.6 restored the previous request for ABI compatibility reasons, and it introduced a new XI 2.2 specific define. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Keith Packard <keithp@keithp.com>
-rw-r--r--configure.ac2
-rw-r--r--src/XIAllowEvents.c23
2 files changed, 15 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..c8d997a 100644
--- a/src/XIAllowEvents.c
+++ b/src/XIAllowEvents.c
@@ -33,13 +33,16 @@
#include <X11/extensions/extutil.h>
#include "XIint.h"
+/* for GetRequest() to work */
+#define X_XI2_2AllowEvents X_XIAllowEvents
+
static Status
_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;
+ xXI2_2AllowEventsReq *req_XI22;
XExtDisplayInfo *extinfo = XInput_find_display(dpy);
@@ -47,13 +50,15 @@ _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);
+ if (have_XI22)
+ {
+ GetReq(XI2_2AllowEvents, req_XI22);
+ req = (xXIAllowEventsReq*)req_XI22;
+ } else
+ GetReq(XIAllowEvents, req);
req->reqType = extinfo->codes->major_opcode;
req->ReqType = X_XIAllowEvents;
@@ -62,8 +67,8 @@ _XIAllowEvents(Display *dpy, int deviceid, int event_mode, Time time,
req->time = time;
if (have_XI22) {
- req->touchid = touchid;
- req->grab_window = grab_window;
+ req_XI22->touchid = touchid;
+ req_XI22->grab_window = grab_window;
}
UnlockDisplay(dpy);