[PATCH 18/42] dix: add GetTouchOwnership event API

Peter Hutterer peter.hutterer at who-t.net
Wed Dec 14 19:01:55 PST 2011


From: Daniel Stone <daniel at fooishbar.org>

No callers yet. This API is not to be used by drivers, it's an API for the
DIX which will create ownership events mainly on touch acceptance/rejection.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 dix/getevents.c |   35 +++++++++++++++++++++++++++++++++++
 include/input.h |    8 ++++++++
 2 files changed, 43 insertions(+), 0 deletions(-)

diff --git a/dix/getevents.c b/dix/getevents.c
index ec7f5c6..d246338 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -156,6 +156,17 @@ key_autorepeats(DeviceIntPtr pDev, int key_code)
 }
 
 static void
+init_touch_ownership(DeviceIntPtr dev, TouchOwnershipEvent *event, Time ms)
+{
+    memset(event, 0, sizeof(TouchOwnershipEvent));
+    event->header = ET_Internal;
+    event->type = ET_TouchOwnership;
+    event->length = sizeof(TouchOwnershipEvent);
+    event->time = ms;
+    event->deviceid = dev->id;
+}
+
+static void
 init_raw(DeviceIntPtr dev, RawDeviceEvent *event, Time ms, int type, int detail)
 {
     memset(event, 0, sizeof(RawDeviceEvent));
@@ -1602,6 +1613,30 @@ GetProximityEvents(InternalEvent *events, DeviceIntPtr pDev, int type, const Val
     return num_events;
 }
 
+int
+GetTouchOwnershipEvents(InternalEvent *events, DeviceIntPtr pDev,
+                        TouchPointInfoPtr ti, uint8_t reason, XID resource,
+                        uint32_t flags)
+{
+    TouchClassPtr t = pDev->touch;
+    TouchOwnershipEvent *event;
+    CARD32 ms = GetTimeInMillis();
+
+    if (!pDev->enabled || !t || !ti)
+        return 0;
+
+    event = &events->touch_ownership_event;
+    init_touch_ownership(pDev, event, ms);
+
+    event->touchid = ti->client_id;
+    event->sourceid = ti->sourceid;
+    event->resource = resource;
+    event->flags = flags;
+    event->reason = reason;
+
+    return 1;
+}
+
 /**
  * Generate internal events representing this touch event and enqueue them
  * on the event queue.
diff --git a/include/input.h b/include/input.h
index 834dd27..4d60792 100644
--- a/include/input.h
+++ b/include/input.h
@@ -503,6 +503,14 @@ void QueueTouchEvents(DeviceIntPtr device,
                       int flags,
                       const ValuatorMask *mask);
 
+extern int GetTouchOwnershipEvents(
+    InternalEvent *events,
+    DeviceIntPtr pDev,
+    TouchPointInfoPtr ti,
+    uint8_t mode,
+    XID resource,
+    uint32_t flags);
+
 extern _X_EXPORT int GetProximityEvents(
     InternalEvent *events,
     DeviceIntPtr pDev,
-- 
1.7.7.1



More information about the xorg-devel mailing list