[PATCH 35/42] Xi: hook up touch ownership handling

Chase Douglas chase.douglas at canonical.com
Tue Dec 20 11:28:06 PST 2011


On 12/14/2011 07:02 PM, Peter Hutterer wrote:
> Ownership changes don't get processed directly when they happen, instead the
> DIX submits an ownership event which goes through ProcessTouchEvents and
> ProcessTouchOwnershipEvents.
> Then on the required events are generated and sent to clients.
> 
> Co-authored-by: Daniel Stone <daniel at fooishbar.org>
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
>  Xi/exevents.c |  155 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
>  1 files changed, 154 insertions(+), 1 deletions(-)
> 
> diff --git a/Xi/exevents.c b/Xi/exevents.c
> index ee8c828..24424da 100644
> --- a/Xi/exevents.c
> +++ b/Xi/exevents.c
> @@ -1089,6 +1089,159 @@ DeliverOneTouchEvent(ClientPtr client, DeviceIntPtr dev, TouchPointInfoPtr ti,
>  }
>  
>  /**
> + * If the current owner has rejected the event, deliver the
> + * TouchOwnership/TouchBegin to the next item in the sprite stack.
> + */
> +static void
> +TouchPuntToNextOwner(DeviceIntPtr dev, TouchPointInfoPtr ti,
> +                     TouchOwnershipEvent *ev)
> +{
> +    InternalEvent *tel = InitEventList(GetMaximumEventsNum());
> +    ValuatorMask *mask = valuator_mask_new(0);

Shouldn't we pass in the number of valuators we expect to use, i.e. 2?

> +    int i, nev;
> +
> +    /* Deliver the ownership */
> +    if (ti->listeners[0].state == LISTENER_AWAITING_OWNER)
> +        DeliverTouchEvents(dev, ti, (InternalEvent*)ev, ti->listeners[0].listener);
> +    else if (ti->listeners[0].state == LISTENER_AWAITING_BEGIN)
> +        TouchEventHistoryReplay(ti, dev, ti->listeners[0].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)
> +    {
> +        int flags;
> +        valuator_mask_set_double(mask, 0,
> +                                 valuator_mask_get_double(ti->valuators, 0));
> +        valuator_mask_set_double(mask, 1,
> +                                 valuator_mask_get_double(ti->valuators, 1));
> +
> +        flags = TOUCH_CLIENT_ID;
> +        if (ti->emulate_pointer)
> +            flags |= TOUCH_POINTER_EMULATED;
> +        nev = GetTouchEvents(tel, dev, ti->client_id, XI_TouchEnd, flags, mask);
> +        for (i = 0; i < nev; i++)
> +            DeliverTouchEvents(dev, ti, tel + i, 0);
> +        TouchEndTouch(dev, ti);
> +    }
> +
> +    valuator_mask_free(&mask);
> +    FreeEventList(tel, GetMaximumEventsNum());
> +}
> +
> +static void
> +TouchEventRejected(DeviceIntPtr sourcedev, TouchPointInfoPtr ti,
> +                   TouchOwnershipEvent *ev)
> +{
> +    InternalEvent *tel = InitEventList(GetMaximumEventsNum());
> +    ValuatorMask *mask = valuator_mask_new(0);

Same here.

Otherwise,

Reviewed-by: Chase Douglas <chase.douglas at canonical.com>


More information about the xorg-devel mailing list