[PATCH xinput xi2.1] Ensure that the parent always accepts or rejects a touch

Chase Douglas chase.douglas at canonical.com
Fri Jan 7 10:06:04 PST 2011


If a touch ends before the 5 motion events have occurred, the parent
window must also accept or reject the touch. Otherwise, the touch will
be left dangling.

I also added a printout stating whether the client accepted or rejected
the touch.

Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
---
 src/test_xi2.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/test_xi2.c b/src/test_xi2.c
index a219d14..7c1af68 100644
--- a/src/test_xi2.c
+++ b/src/test_xi2.c
@@ -92,11 +92,16 @@ static void print_deviceevent(XIDeviceEvent* event)
 
     if (event->evtype == XI_TouchBegin)
         touch_events_received = 0;
-    else if (event->evtype == XI_TouchMotion && event->event != event->child &&
-             (event->flags & XITouchOwner) && ++touch_events_received == 5)
+    else if ((event->flags & XITouchOwner) && event->event != event->child && 
+             ((event->evtype == XI_TouchMotion && ++touch_events_received == 5) ||
+              (event->evtype == XI_TouchEnd && touch_events_received < 5)))
+    {
+        printf("---- Parent window is %s the touch ----\n",
+               (thong ? "rejecting" : "accepting"));
         XIAllowTouchEvents(event->display, event->sourceid, event->detail,
                            (thong ^= 1) ? XITouchOwnerAccept :
                                           XITouchOwnerReject);
+    }
 }
 
 static void print_devicechangedevent(Display *dpy, XIDeviceChangedEvent *event)
-- 
1.7.2.3



More information about the xorg-devel mailing list