diff options
Diffstat (limited to 'xorg-server/Xi/xiallowev.c')
-rw-r--r-- | xorg-server/Xi/xiallowev.c | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/xorg-server/Xi/xiallowev.c b/xorg-server/Xi/xiallowev.c index 0d45b3654..a4b2f5782 100644 --- a/xorg-server/Xi/xiallowev.c +++ b/xorg-server/Xi/xiallowev.c @@ -35,6 +35,8 @@ #include "inputstr.h" /* DeviceIntPtr */ #include "windowstr.h" /* window structure */ +#include "mi.h" +#include "eventstr.h" #include <X11/extensions/XI2.h> #include <X11/extensions/XI2proto.h> @@ -49,10 +51,53 @@ 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) + { + *error = touchid; + return BadValue; + } + + /* 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; +} + int ProcXIAllowEvents(ClientPtr client) { @@ -61,7 +106,7 @@ ProcXIAllowEvents(ClientPtr client) int ret = Success; REQUEST(xXIAllowEventsReq); - REQUEST_SIZE_MATCH(xXIAllowEventsReq); + /* FIXME: check request length, 12 for XI 2.0+, 20 for XI 2.2+ */ ret = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess); if (ret != Success) @@ -91,6 +136,12 @@ ProcXIAllowEvents(ClientPtr client) if (IsMaster(dev)) AllowSome(client, time, dev, THAWED_BOTH); break; + case XIRejectTouch: + case XIAcceptTouch: + ret = AllowTouch(client, dev, + stuff->mode, stuff->touchid, + &client->errorValue); + break; default: client->errorValue = stuff->mode; ret = BadValue; |