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.doug...@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.

That loop cannot be skipped for masters. Mind you, the whole (mask & 
EVENT_CORE_MASK)
can be skipped for slaves.

Cheers,
  Peter
_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to