[PATCH] Replay original touch begin event instead of generated begin event

Peter Hutterer peter.hutterer at who-t.net
Wed Apr 18 18:48:40 PDT 2012


On Wed, Apr 18, 2012 at 06:24:52PM -0700, Chase Douglas wrote:
> The generated event does not have axes other than X and Y and has a
> newer timestamp. In particular, the newer timestamp may be newer than
> the real touch end event, which may be stuck in the syncEvents queue. If
> a client uses the timestamps for grabbing bad things may happen.
> 
> Signed-off-by: Chase Douglas <chase.douglas at canonical.com>

Weeped-at-by: Peter Hutterer <peter.hutterer at who-t.net> 

> ---
>  dix/touch.c |   18 +++++++++++++++---
>  1 files changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/dix/touch.c b/dix/touch.c
> index a71189a..b12c779 100644
> --- a/dix/touch.c
> +++ b/dix/touch.c
> @@ -474,10 +474,22 @@ TouchEventHistoryReplay(TouchPointInfoPtr ti, DeviceIntPtr dev, XID resource)
>      flags = TOUCH_CLIENT_ID | TOUCH_REPLAYING;
>      if (ti->emulate_pointer)
>          flags |= TOUCH_POINTER_EMULATED;
> -    /* send fake begin event to next owner */
> +    /* Generate events based on a fake touch begin event to get DCCE events if
> +     * needed */
> +    /* FIXME: This needs to be cleaned up */
>      nev = GetTouchEvents(tel, dev, ti->client_id, XI_TouchBegin, flags, mask);
> -    for (i = 0; i < nev; i++)
> -        DeliverTouchEvents(dev, ti, tel + i, resource);
> +    for (i = 0; i < nev; i++) {
> +        /* Send saved touch begin event */
> +        if (tel[i].any.type == ET_TouchBegin) {
> +            DeviceEvent *ev = &ti->history[0];
> +            ev->flags |= TOUCH_REPLAYING;
> +            DeliverTouchEvents(dev, ti, (InternalEvent*)ev, resource);
> +        }
> +        else {/* Send DCCE event */
> +            tel[i].any.time = ti->history[0].time;
> +            DeliverTouchEvents(dev, ti, tel + i, resource);
> +        }
> +    }
>  
>      valuator_mask_free(&mask);
>      FreeEventList(tel, GetMaximumEventsNum());
> -- 
> 1.7.9.1
> 


More information about the xorg-devel mailing list