Commit 3ab3083c authored by Povilas Kanapickas's avatar Povilas Kanapickas Committed by Peter Hutterer
Browse files

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

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

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.

Signed-off-by: Povilas Kanapickas's avatarPovilas Kanapickas <>
parent 365cbbfc
Pipeline #251269 passed with stages
in 6 minutes and 58 seconds
......@@ -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))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment