[PATCH 2/5] Move AllowTouch to dix/touch.c

Chase Douglas chase.douglas at canonical.com
Thu Feb 2 16:57:55 PST 2012


From: Chase Douglas <chase.douglas at ubuntu.com>

Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
---
 Xi/xiallowev.c  |   41 -----------------------------------------
 dix/touch.c     |   45 +++++++++++++++++++++++++++++++++++++++++++++
 include/input.h |    2 ++
 3 files changed, 47 insertions(+), 41 deletions(-)

diff --git a/Xi/xiallowev.c b/Xi/xiallowev.c
index a4b2f57..a722c1d 100644
--- a/Xi/xiallowev.c
+++ b/Xi/xiallowev.c
@@ -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)
 {
diff --git a/dix/touch.c b/dix/touch.c
index b42859d..6113371 100644
--- a/dix/touch.c
+++ b/dix/touch.c
@@ -34,6 +34,7 @@
 
 #include "eventstr.h"
 #include "exevents.h"
+#include "exglobals.h"
 #include "inpututils.h"
 #include "eventconvert.h"
 #include "windowstr.h"
@@ -984,3 +985,47 @@ TouchListenerGone(XID resource)
 
     FreeEventList(events, GetMaximumEventsNum());
 }
+
+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;
+}
diff --git a/include/input.h b/include/input.h
index 53645b4..9ec4dd1 100644
--- a/include/input.h
+++ b/include/input.h
@@ -625,6 +625,8 @@ extern int TouchConvertToPointerEvent(const InternalEvent *ev,
 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);
 
 /* misc event helpers */
 extern Mask GetEventMask(DeviceIntPtr dev, xEvent* ev, InputClientsPtr clients);
-- 
1.7.8.3



More information about the xorg-devel mailing list