[PATCH 2/5] Accept touch sequence for pointer listener after second event delivery

Chase Douglas chase.douglas at canonical.com
Thu Apr 12 12:20:26 PDT 2012


On 04/11/2012 11:22 AM, Chase Douglas wrote:
> This is a bit of unimplemented code for touchscreen pointer emulation. A
> pointer grabbing client currently never accepts the touch sequence. The
> sequence must be accepted once any touch-derived event is irrevocably
> delivered to a client.
> 
> The first pointer event, derived from a touch begin event, may be caught
> in a sync grab and then replayed. This is essentially a revocable
> delivery of an event. Thus, we must wait till a non-begin event is
> delivered.
> 
> Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
> ---
>  Xi/exevents.c |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/Xi/exevents.c b/Xi/exevents.c
> index c05c226..50ed21b 100644
> --- a/Xi/exevents.c
> +++ b/Xi/exevents.c
> @@ -1459,6 +1459,11 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
>              if (!deliveries)
>                  DeliverOneGrabbedEvent(ptrev, dev, grab->grabtype);
>  
> +            /* We must accept the touch sequence once a pointer listener has
> +             * received one event past ButtonPress. */
> +            if (deliveries && ev->any.type != ET_TouchBegin)

This needs: && !(ev->device_event.flags & TOUCH_CLIENT_ID)

Otherwise, we get into an infinite loop when the accept causes touch
ends to be emitted for other clients.

> +                TouchListenerAcceptReject(dev, ti, 0, XIAcceptTouch);
> +
>              if (ev->any.type == ET_TouchEnd &&
>                  !dev->button->buttonsDown &&
>                  dev->deviceGrab.fromPassiveGrab && GrabIsPointerGrab(grab)) {


More information about the xorg-devel mailing list