Move AllowTouch to dix/touch.c, and rename to TouchAcceptReject

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Chase Douglas 2012-02-03 16:19:08 -08:00 • committed by Peter Hutterer
commit 9a260e9af8
3 changed files with 49 additions and 44 deletions

View file

@ -57,47 +57,6 @@ SProcXIAllowEvents(ClientPtr client)
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)
{
@ -138,9 +97,8 @@ ProcXIAllowEvents(ClientPtr client)
break;
case XIRejectTouch:
case XIAcceptTouch:
ret = AllowTouch(client, dev,
stuff->mode, stuff->touchid,
&client->errorValue);
ret = TouchAcceptReject(client, dev, stuff->mode, stuff->touchid,
&client->errorValue);
break;
default:
client->errorValue = stuff->mode;