[PATCH 1/2] Replay touch begin event in entirety

Chase Douglas chase.douglas at canonical.com
Wed Jan 11 07:38:11 PST 2012


The current code partially reconstructs the touch begin event when
replaying touch history. This change ensures the original begin event
is replayed, including valuators beyond X and Y.

Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
---
This looks like code that is there for a specific reason, but I can't
figure it out. Peter, do you know why you treated begin events
differently?

 dix/touch.c |   28 ++++++++--------------------
 1 files changed, 8 insertions(+), 20 deletions(-)

diff --git a/dix/touch.c b/dix/touch.c
index db0bf33..3766af5 100644
--- a/dix/touch.c
+++ b/dix/touch.c
@@ -481,33 +481,21 @@ TouchEventHistoryPush(TouchPointInfoPtr ti, const DeviceEvent *ev)
 void
 TouchEventHistoryReplay(TouchPointInfoPtr ti, DeviceIntPtr dev, XID resource)
 {
-    InternalEvent *tel = InitEventList(GetMaximumEventsNum());
-    ValuatorMask *mask = valuator_mask_new(0);
-    int i, nev;
-    int flags;
+    int i;
 
     if (!ti->history)
         return;
 
-    valuator_mask_set_double(mask, 0, ti->history[0].valuators.data[0]);
-    valuator_mask_set_double(mask, 1, ti->history[0].valuators.data[1]);
-
-    flags = TOUCH_CLIENT_ID|TOUCH_REPLAYING;
-    if (ti->emulate_pointer)
-        flags |= TOUCH_POINTER_EMULATED;
-    /* send fake begin event to next owner */
-    nev = GetTouchEvents(tel, dev, ti->client_id, XI_TouchBegin, flags, mask);
-    for (i = 0; i < nev; i++)
-        DeliverTouchEvents(dev, ti, tel + i, resource);
-
-    valuator_mask_free(&mask);
-    FreeEventList(tel, GetMaximumEventsNum());
-
-    /* First event was TouchBegin, already replayed that one */
-    for (i = 1; i < ti->history_elements; i++)
+    for (i = 0; i < ti->history_elements; i++)
     {
         DeviceEvent *ev = &ti->history[i];
+
         ev->flags |= TOUCH_REPLAYING;
+        if (ev->type == ET_TouchBegin)
+            ev->flags |= TOUCH_CLIENT_ID;
+        if (ti->emulate_pointer)
+            ev->flags |= TOUCH_POINTER_EMULATED;
+
         DeliverTouchEvents(dev, ti, (InternalEvent*)ev, resource);
     }
 }
-- 
1.7.7.3



More information about the xorg-devel mailing list