[PATCH v2 5/7] Check for proper window ID when processing touch allow requests
Chase Douglas
chase.douglas at canonical.com
Fri Feb 3 16:19:09 PST 2012
Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
---
Changes since v1:
* Fix loop counter check for when no grab match is found
Xi/xiallowev.c | 2 +-
dix/touch.c | 18 ++++++++++++------
include/input.h | 2 +-
3 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/Xi/xiallowev.c b/Xi/xiallowev.c
index dab3393..38967b2 100644
--- a/Xi/xiallowev.c
+++ b/Xi/xiallowev.c
@@ -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;
diff --git a/dix/touch.c b/dix/touch.c
index 4a116ee..7daf81b 100644
--- a/dix/touch.c
+++ b/dix/touch.c
@@ -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,
diff --git a/include/input.h b/include/input.h
index 605e74d..fea5a31 100644
--- a/include/input.h
+++ b/include/input.h
@@ -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);
--
1.7.8.3
More information about the xorg-devel
mailing list