[PATCH 1/3][master][1.12] Don't attempt to add non-master core touch pointer emulation listeners

Chase Douglas chase.douglas at canonical.com
Wed Apr 18 12:04:30 PDT 2012


On 04/18/2012 11:45 AM, Chase Douglas wrote:
> On 04/17/2012 11:03 PM, Peter Hutterer wrote:
>> On Mon, Apr 16, 2012 at 11:22:48AM -0700, Chase Douglas wrote:
>>> On 04/12/2012 10:38 PM, Peter Hutterer wrote:
>>>> On Wed, Apr 04, 2012 at 01:48:09PM -0700, Chase Douglas wrote:
>>>>> Core events aren't generated for slave devices, so this is just wrong.
>>>>> On top of that, the mask being checked in the removed hunk is wrong as
>>>>> well. It is dereferencing a pointer of type OtherClients as though it
>>>>> were a pointer to type InputClients.
>>>>>
>>>>> Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
>>>>> ---
>>>>>  dix/touch.c |   12 ------------
>>>>>  1 files changed, 0 insertions(+), 12 deletions(-)
>>>>>
>>>>> diff --git a/dix/touch.c b/dix/touch.c
>>>>> index 0829b65..fcec916 100644
>>>>> --- a/dix/touch.c
>>>>> +++ b/dix/touch.c
>>>>> @@ -830,18 +830,6 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
>>>>>                               win);
>>>>>              return TRUE;
>>>>>          }
>>>>> -
>>>>> -        /* all others */
>>>>> -        nt_list_for_each_entry(iclients, (InputClients *) wOtherClients(win),
>>>>> -                               next) {
>>>>> -            if (!(iclients->mask[XIAllDevices] & core_filter))
>>>>> -                continue;
>>>>> -
>>>>> -            TouchEventHistoryAllocate(ti);
>>>>> -            TouchAddListener(ti, iclients->resource, CORE,
>>>>> -                             type, LISTENER_AWAITING_BEGIN, win);
>>>>> -            return TRUE;
>>>>> -        }
>>>>>      }
>>>>>  
>>>>>      return FALSE;
>>>>> -- 
>>>>> 1.7.9.1
>>>>
>>>> wouldn't you have to check for IsMaster() somewhere?
>>>> iirc, this code is called for slave and master devices, but then again my
>>>> brain is a bit mushy by now.
>>>
>>> See the block right above the one being removed here:
>>>
>>> if (mask & EVENT_CORE_MASK) {
>>>     int coretype = GetCoreType(TouchGetPointerEventType(ev));
>>>     Mask core_filter = event_get_filter_from_type(dev, coretype);
>>>
>>>     /* window owner */
>>>     if (IsMaster(dev) && (win->eventMask & core_filter)) {
>>>         TouchEventHistoryAllocate(ti);
>>>         TouchAddListener(ti, win->drawable.id, CORE,
>>>                          LISTENER_POINTER_REGULAR, LISTENER_AWAITING_BEGIN,
>>>                          win);
>>>         return TRUE;
>>>     }
>>>
>>> It does check IsMaster(dev).
>>
>> right, but the mask is split up: the window owner's mask is in
>> win->eventMask, others are in the iclients->mask[XIAllDevices]. So for the
>> case where a different client sets a core mask on a window, you still need
>> loop you removed to make sure we send to the right client.
> 
> Ok, I didn't realize that the core event mask was split up.
> 
> I think, reading RecalculateDeliverableEvents(), that we merely need to
> change the block that I have left to:
> 
> if (IsMaster(dev) &&
>     ((win->eventMask | wOtherEventMasks(win)) & core_filter) {
> 
> My understanding is that the block this commit removed should still be
> gone. I'll send a second version of this patch out.

Then I realized that the block for the other clients is necessary for
using the correct resource when adding the listener. I think all that is
needed is to fix the second block so it properly checks an OtherClients
mask instead of an InputClients mask.

-- Chase


More information about the xorg-devel mailing list