Commit 656ab879 authored by Chase Douglas's avatar Chase Douglas Committed by Peter Hutterer

Check for proper window ID when processing touch allow requests

Signed-off-by: default avatarChase Douglas <chase.douglas@canonical.com>
Signed-off-by: default avatarPeter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: default avatarPeter Hutterer <peter.hutterer@who-t.net>
parent 9a260e9a
......@@ -98,7 +98,7 @@ ProcXIAllowEvents(ClientPtr client)
case XIRejectTouch:
case XIAcceptTouch:
ret = TouchAcceptReject(client, dev, stuff->mode, stuff->touchid,
&client->errorValue);
stuff->grab_window, &client->errorValue);
break;
default:
client->errorValue = stuff->mode;
......
......@@ -988,7 +988,7 @@ TouchListenerGone(XID resource)
int
TouchAcceptReject(ClientPtr client, DeviceIntPtr dev, int mode,
uint32_t touchid, XID *error)
uint32_t touchid, Window grab_window, XID *error)
{
TouchPointInfoPtr ti;
int nev, i;
......@@ -1003,8 +1003,6 @@ TouchAcceptReject(ClientPtr client, DeviceIntPtr dev, int mode,
return BadDevice;
}
/* FIXME window is unhandled */
ti = TouchFindByClientID(dev, touchid);
if (!ti)
{
......@@ -1012,9 +1010,17 @@ TouchAcceptReject(ClientPtr client, DeviceIntPtr dev, int mode,
return BadValue;
}
/* FIXME: Allow for early accept */
if (ti->num_listeners == 0 ||
CLIENT_ID(ti->listeners[0].listener) != client->index)
for (i = 0; i < ti->num_listeners; i++)
{
if (CLIENT_ID(ti->listeners[i].listener) == client->index &&
ti->listeners[i].window->drawable.id == grab_window)
break;
}
if (i == ti->num_listeners)
return BadAccess;
/* FIXME: Implement early accept/reject */
if (i > 0)
return BadAccess;
nev = GetTouchOwnershipEvents(events, dev, ti, mode,
......
......@@ -626,7 +626,7 @@ extern int TouchGetPointerEventType(const InternalEvent *ev);
extern void TouchRemovePointerGrab(DeviceIntPtr dev);
extern void TouchListenerGone(XID resource);
extern int TouchAcceptReject(ClientPtr client, DeviceIntPtr dev, int mode,
uint32_t touchid, XID *error);
uint32_t touchid, Window grab_window, XID *error);
/* misc event helpers */
extern Mask GetEventMask(DeviceIntPtr dev, xEvent* ev, InputClientsPtr clients);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment