summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChase Douglas <chase.douglas@canonical.com>2011-01-07 12:42:55 -0500
committerChase Douglas <chase.douglas@canonical.com>2011-01-07 12:42:55 -0500
commitf3c3e3d74fb5f3fd0ab82d082be5a61a57f46fab (patch)
tree1bbaebf2eadb9a808880c9fb83987f7b163046b8
parent14274ea699f5edd3dc7e30010fdf6e845a260045 (diff)
Ensure that the parent always accepts or rejects a touchmultitouch
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@canonical.com>
-rw-r--r--src/test_xi2.c9
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)