diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2012-01-27 12:41:09 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2012-02-09 08:02:44 +1000 |
commit | ceb026c6a6f1eea8b34e745f06f1ebcd652c0ba1 (patch) | |
tree | 04b1e239ecb663b0e67b789539fe57da0a0efb12 /Xi | |
parent | b96275c4cdb164aa71f7aa9fbf88be18886d1936 (diff) |
Xi: handle new XIAllowEvents request in inputproto 2.1.99.6
grab_window and touchid were removed from the struct for ABI compatibility
reasons, we need to pull in the new, XI 2.2-specific struct.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'Xi')
-rw-r--r-- | Xi/xiallowev.c | 41 |
1 files changed, 35 insertions, 6 deletions
diff --git a/Xi/xiallowev.c b/Xi/xiallowev.c index 38967b225..d0856b656 100644 --- a/Xi/xiallowev.c +++ b/Xi/xiallowev.c @@ -41,6 +41,7 @@ #include <X11/extensions/XI2proto.h> #include "exglobals.h" /* BadDevice */ +#include "exevents.h" #include "xiallowev.h" int @@ -51,8 +52,12 @@ SProcXIAllowEvents(ClientPtr client) swaps(&stuff->length); swaps(&stuff->deviceid); swapl(&stuff->time); - /* FIXME swap touchid */ - /* FIXME swap window */ + if (stuff->length > 3) + { + xXI2_2AllowEventsReq *req_xi22 = (xXI2_2AllowEventsReq*)stuff; + swapl(&req_xi22->touchid); + swapl(&req_xi22->grab_window); + } return ProcXIAllowEvents(client); } @@ -63,9 +68,21 @@ ProcXIAllowEvents(ClientPtr client) TimeStamp time; DeviceIntPtr dev; int ret = Success; + XIClientPtr xi_client; + Bool have_xi22 = FALSE; + REQUEST(xXI2_2AllowEventsReq); - REQUEST(xXIAllowEventsReq); - /* FIXME: check request length, 12 for XI 2.0+, 20 for XI 2.2+ */ + xi_client = dixLookupPrivate(&client->devPrivates, XIClientPrivateKey); + + if (version_compare(xi_client->major_version, + xi_client->minor_version, 2, 2) >= 0) + { + REQUEST_AT_LEAST_SIZE(xXI2_2AllowEventsReq); + have_xi22 = TRUE; + } else + { + REQUEST_SIZE_MATCH(xXIAllowEventsReq); + } ret = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess); if (ret != Success) @@ -97,8 +114,20 @@ ProcXIAllowEvents(ClientPtr client) break; case XIRejectTouch: case XIAcceptTouch: - ret = TouchAcceptReject(client, dev, stuff->mode, stuff->touchid, - stuff->grab_window, &client->errorValue); + { + int rc; + WindowPtr win; + + if (!have_xi22) + return BadValue; + + rc = dixLookupWindow(&win, stuff->grab_window, client, DixReadAccess); + if (rc != Success) + return rc; + + ret = TouchAcceptReject(client, dev, stuff->mode, stuff->touchid, + stuff->grab_window, &client->errorValue); + } break; default: client->errorValue = stuff->mode; |