[PATCH 3/5] Check for proper window ID when processing touch allow requests
Chase Douglas
chase.douglas at canonical.com
Thu Feb 2 16:57:56 PST 2012
From: Chase Douglas <chase.douglas at ubuntu.com>
Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
---
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 a722c1d..c95dcc6 100644
--- a/Xi/xiallowev.c
+++ b/Xi/xiallowev.c
@@ -98,7 +98,7 @@ ProcXIAllowEvents(ClientPtr client)
case XIRejectTouch:
case XIAcceptTouch:
ret = AllowTouch(client, dev,
- stuff->mode, stuff->touchid,
+ stuff->mode, stuff->touchid, stuff->grab_window,
&client->errorValue);
break;
default:
diff --git a/dix/touch.c b/dix/touch.c
index 6113371..e24d9ac 100644
--- a/dix/touch.c
+++ b/dix/touch.c
@@ -988,7 +988,7 @@ TouchListenerGone(XID resource)
int
AllowTouch(ClientPtr client, DeviceIntPtr dev, int mode, uint32_t touchid,
- XID *error)
+ Window grab_window, XID *error)
{
TouchPointInfoPtr ti;
int nev, i;
@@ -1003,8 +1003,6 @@ AllowTouch(ClientPtr client, DeviceIntPtr dev, int mode, uint32_t touchid,
return BadDevice;
}
- /* FIXME window is unhandled */
-
ti = TouchFindByClientID(dev, touchid);
if (!ti)
{
@@ -1012,9 +1010,17 @@ AllowTouch(ClientPtr client, DeviceIntPtr dev, int mode, uint32_t touchid,
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 9ec4dd1..18119bc 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 AllowTouch(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