diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2013-02-27 15:05:54 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2013-07-17 14:35:36 +1000 |
commit | 2fcf86036f95128e9b90ddbd5ffc6edbacd3de9f (patch) | |
tree | e714382aad251e863dad8928f054deb14834d891 /Xi | |
parent | e1c908f3931aa82c7c5f14aa162e02f3abf98faf (diff) |
Xi: when punting to a new owner, always create TouchEnd events
If a touch is pending_finish and we just punted it to the next owner, that
client must receive a TouchEnd event.
If we just punted to the last owner and that owner not a touch grab, we need
to end the touch since this is the last event to be sent, and the client
cannot accept/reject this.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 214d11d3fcdac51fc7afbf3770516ec14f9e13c1)
Diffstat (limited to 'Xi')
-rw-r--r-- | Xi/exevents.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/Xi/exevents.c b/Xi/exevents.c index 14b0cec2e..a8b3ee62e 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -1143,12 +1143,21 @@ TouchPuntToNextOwner(DeviceIntPtr dev, TouchPointInfoPtr ti, TouchEventHistoryReplay(ti, dev, listener->listener); } - /* If we've just removed the last grab and the touch has physically - * ended, send a TouchEnd event too and finalise the touch. */ - if (ti->num_listeners == 1 && ti->num_grabs == 0 && ti->pending_finish) { + /* New owner has Begin/Update but not end. If touch is pending_finish, + * emulate the TouchEnd now */ + if (ti->pending_finish) { EmitTouchEnd(dev, ti, 0, 0); - TouchEndTouch(dev, ti); - return; + + /* If the last owner is not a touch grab, finalise the touch, we + won't get more correspondence on this. + */ + if (ti->num_listeners == 1 && + (ti->num_grabs == 0 || + listener->grab->grabtype != XI2 || + !xi2mask_isset(listener->grab->xi2mask, dev, XI_TouchBegin))) { + TouchEndTouch(dev, ti); + return; + } } if (accepted_early) |