[PATCH 31/42] Process and deliver touch events

Chase Douglas chase.douglas at canonical.com
Tue Dec 20 09:56:04 PST 2011


On 12/14/2011 07:02 PM, Peter Hutterer wrote:
> Does not include pointer emulation handling.
> Does include partial ownership handling but not the actual processing of
> ownership events.
> 
> Note: this commit is a retroactive commit extracted from a series of ~50
> commits and may thus appear a bit more complicated than what you'd write out
> from scratch.
> 
> Pointer processing tree is roughly:
> - ProcessOtherEvents
>   - ProcessTouchEvents
>     - DeliverTouchEvents
>       - DeliverTouchBeginEvent|DeliverTouchEndEvent|...
>         - DeliverOneTouchEvent
> 
> Also hooks up the event history playing to the right function now.
> 
> Co-authored-by: Daniel Stone <daniel at fooishbar.org>
> Co-authored-by: Chase Douglas <chase.douglas at canonical.com>
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

[snip]

This *really* needs a comment block if only to state which params are
input and output:

> +static Bool
> +RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti,
> +                          InternalEvent *ev, TouchListener *listener,
> +                          ClientPtr *client, WindowPtr *win, GrabPtr *grab,
> +                          XI2Mask **mask)
> +{
> +     int rc;
> +     InputClients *iclients = NULL;
> +
> +    if (listener->type == LISTENER_GRAB ||
> +        listener->type == LISTENER_POINTER_GRAB)
> +    {
> +        rc = dixLookupResourceByType((pointer*)grab, listener->listener,
> +                RT_PASSIVEGRAB,
> +                serverClient, DixSendAccess);
> +        if (rc != Success)
> +        {
> +            /* the grab doesn't exist but we have a grabbing listener - this
> +             * is an implicit/active grab */
> +            rc = dixLookupClient(client, listener->listener, serverClient, DixSendAccess);
> +            if (rc != Success)
> +                return FALSE;
> +
> +            *grab = dev->deviceGrab.grab;
> +            if (!*grab)
> +                return FALSE;
> +        }
> +
> +        *client = rClient(*grab);
> +        *win = (*grab)->window;
> +        *mask = (*grab)->xi2mask;
> +    } else {
> +        if (listener->level == CORE)
> +            rc = dixLookupWindow(win, listener->listener,
> +                                 serverClient, DixSendAccess);
> +        else
> +            rc = dixLookupResourceByType((pointer*)win, listener->listener,
> +                                         RT_INPUTCLIENT,
> +                                         serverClient, DixSendAccess);
> +        if (rc != Success)
> +            return FALSE;
> +
> +
> +        if (listener->level == XI2)
> +        {
> +            int evtype;
> +            if (ti->emulate_pointer && listener->type == LISTENER_POINTER_REGULAR)
> +                evtype = GetXI2Type(TouchGetPointerEventType(ev));
> +            else
> +                evtype = GetXI2Type(ev->any.type);
> +
> +            nt_list_for_each_entry(iclients, wOtherInputMasks(*win)->inputClients, next)
> +                if (xi2mask_isset(iclients->xi2mask, dev, evtype))
> +                    break;
> +            BUG_WARN(!iclients);
> +            if (!iclients)
> +                return FALSE;
> +        } else if (listener->level == XI)
> +        {
> +            int xi_type = GetXIType(TouchGetPointerEventType(ev));
> +            Mask xi_filter = event_get_filter_from_type(dev, xi_type);
> +            nt_list_for_each_entry(iclients, wOtherInputMasks(*win)->inputClients, next)
> +                if (iclients->mask[dev->id] & xi_filter)
> +                    break;
> +            BUG_WARN(!iclients);
> +            if (!iclients)
> +                return FALSE;
> +        } else
> +        {
> +            int coretype = GetCoreType(TouchGetPointerEventType(ev));
> +            Mask core_filter = event_get_filter_from_type(dev, coretype);
> +
> +            /* all others */
> +            nt_list_for_each_entry(iclients, (InputClients*)wOtherClients(*win), next)
> +                if (iclients->mask[XIAllDevices] & core_filter)
> +                    break;
> +            /* if owner selected, iclients is NULL */
> +        }
> +
> +        *client = iclients ? rClient(iclients) : wClient(*win);
> +        *mask = iclients ? iclients->xi2mask : NULL;
> +        *grab = NULL;
> +    }
> +
> +    return TRUE;
> +}

Otherwise,

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


More information about the xorg-devel mailing list