summaryrefslogtreecommitdiff
path: root/Xi
diff options
context:
space:
mode:
authorPovilas Kanapickas <povilas@radix.lt>2020-12-20 01:11:43 +0200
committerPeter Hutterer <peter.hutterer@who-t.net>2021-01-05 02:40:52 +0000
commit3ab3083cc20534c83a5a35f0af1f2779f8df0b7b (patch)
treef45564e5033020eb870139df01c6fb41b939fff5 /Xi
parent365cbbfc4b99f7d9937d1b8b61f1483556a5b57a (diff)
xi: Don't deliver emulated motion when there's no owner for touch end
Pointer-emulated touch events should only be delivered to the client that owns the sequence even if it's a core client that became the effective owner of the sequency by selecting for pointer press and movement. Currently the emulated events are delivered like this already (see TouchResourceIsOwner() check in DeliverEmulatedMotionEvent()), except in the case of TouchEnd, in which case the generated motion event is still delivered to some client that's not necessarily the owner of the touch sequence. We already know whether a touch sequence that is about to emulate a pointer event has an owner, we just need to check that. This further allows to simplify DeliverEmulatedMotionEvent() as it won't ever be called for non-owned touch events. https://bugs.freedesktop.org/show_bug.cgi?id=60394 Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
Diffstat (limited to 'Xi')
-rw-r--r--Xi/exevents.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/Xi/exevents.c b/Xi/exevents.c
index 22dc214c9..193e57e22 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1389,6 +1389,12 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
nevents = TouchConvertToPointerEvent(ev, &motion, &button);
BUG_RETURN_VAL(nevents == 0, BadValue);
+ /* Note that here we deliver only part of the events that are generated by the touch event:
+ *
+ * TouchBegin results in ButtonPress (motion is handled in DeliverEmulatedMotionEvent)
+ * TouchUpdate results in Motion
+ * TouchEnd results in ButtonRelease (motion is handled in DeliverEmulatedMotionEvent)
+ */
if (nevents > 1)
ptrev = &button;
@@ -1593,7 +1599,8 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev)
/* if emulate_pointer is set, emulate the motion event right
* here, so we can ignore it for button event emulation. TouchUpdate
* events which _only_ emulate motion just work normally */
- if (emulate_pointer && ev->any.type != ET_TouchUpdate)
+ if (emulate_pointer && (ev->any.type == ET_TouchBegin ||
+ (ev->any.type == ET_TouchEnd && ti->num_listeners > 0)))
DeliverEmulatedMotionEvent(dev, ti, ev);
if (emulate_pointer && IsMaster(dev))