[PATCH 40/42] dix: Remove touch grabs if the grab disappears

Fernando Carrijo fcarrijo at freedesktop.org
Thu Dec 15 09:41:39 PST 2011


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

> +void
> +TouchListenerGone(XID resource)
> +{
> +    TouchPointInfoPtr ti;
> +    DeviceIntPtr dev;
> +    InternalEvent *events = InitEventList(GetMaximumEventsNum());

Forgot to deallocate the event list.

> +    int i, j, k, nev;
> +
> +    if (!events)
> +        FatalError("TouchListenerGone: couldn't allocate events\n");
> +
> +    for (dev = inputInfo.devices; dev; dev = dev->next)
> +    {
> +        if (!dev->touch)
> +            continue;
> +
> +        for (i = 0; i < dev->touch->num_touches; i++)
> +        {
> +            ti = &dev->touch->touches[i];
> +            if (!ti->active)
> +                continue;
> +
> +            for (j = 0; j < ti->num_listeners; j++)
> +            {
> +                if (ti->listeners[j].listener != resource)
> +                    continue;
> +
> +                nev = GetTouchOwnershipEvents(events, dev, ti, XIRejectTouch,
> +                                              resource, 0);
> +                for (k = 0; k < nev; k++)
> +                    mieqProcessDeviceEvent(dev, events + k, NULL);
> +
> +                break;
> +            }
> +        }
> +    }
> +}



More information about the xorg-devel mailing list