diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2012-01-27 13:28:52 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2012-02-09 08:03:18 +1000 |
commit | b355b7300235395717de06809ee6631ce55d3189 (patch) | |
tree | 5f5764c12915651658b9b30b7839c3c61bdfd537 /src/XIAllowEvents.c | |
parent | 07ced7b48219e3bc0c98806f3d7106f86d1b2ca0 (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>
Diffstat (limited to 'src/XIAllowEvents.c')
-rw-r--r-- | src/XIAllowEvents.c | 23 |
1 files changed, 14 insertions, 9 deletions
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); |