diff options
Diffstat (limited to 'xorg-server/Xi/xiallowev.c')
-rw-r--r-- | xorg-server/Xi/xiallowev.c | 81 |
1 files changed, 34 insertions, 47 deletions
diff --git a/xorg-server/Xi/xiallowev.c b/xorg-server/Xi/xiallowev.c index a4b2f5782..d0856b656 100644 --- a/xorg-server/Xi/xiallowev.c +++ b/xorg-server/Xi/xiallowev.c @@ -41,6 +41,7 @@ #include <X11/extensions/XI2proto.h> #include "exglobals.h" /* BadDevice */ +#include "exevents.h" #include "xiallowev.h" int @@ -51,51 +52,14 @@ SProcXIAllowEvents(ClientPtr client) swaps(&stuff->length); swaps(&stuff->deviceid); swapl(&stuff->time); - /* FIXME swap touchid */ - /* FIXME swap window */ - - return ProcXIAllowEvents(client); -} - -static int -AllowTouch(ClientPtr client, DeviceIntPtr dev, int mode, uint32_t touchid, XID *error) -{ - TouchPointInfoPtr ti; - int nev, i; - InternalEvent *events = InitEventList(GetMaximumEventsNum()); - - if (!events) - return BadAlloc; - - if (!dev->touch) - { - *error = dev->id; - return BadDevice; - } - - /* FIXME window is unhandled */ - - ti = TouchFindByClientID(dev, touchid); - if (!ti) + if (stuff->length > 3) { - *error = touchid; - return BadValue; + xXI2_2AllowEventsReq *req_xi22 = (xXI2_2AllowEventsReq*)stuff; + swapl(&req_xi22->touchid); + swapl(&req_xi22->grab_window); } - /* FIXME: Allow for early accept */ - if (ti->num_listeners == 0 || CLIENT_ID(ti->listeners[0].listener) != client->index) - return BadAccess; - - nev = GetTouchOwnershipEvents(events, dev, ti, mode, ti->listeners[0].listener, 0); - if (nev == 0) - return BadAlloc; - for (i = 0; i < nev; i++) - mieqProcessDeviceEvent(dev, events + i, NULL); - - ProcessInputEvents(); - - FreeEventList(events, GetMaximumEventsNum()); - return Success; + return ProcXIAllowEvents(client); } int @@ -104,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) @@ -138,9 +114,20 @@ ProcXIAllowEvents(ClientPtr client) break; case XIRejectTouch: case XIAcceptTouch: - ret = AllowTouch(client, dev, - stuff->mode, stuff->touchid, - &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; |