[PATCH 4/5] dix: switch EventIsDeliverable to take the event type only

Peter Hutterer peter.hutterer at who-t.net
Sat Dec 10 19:01:55 PST 2011


On Sat, Dec 10, 2011 at 01:50:21PM +0100, walter harms wrote:
> 
> 
> Am 10.12.2011 08:54, schrieb Peter Hutterer:
> > Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> > ---
> >  dix/events.c    |   12 ++++++------
> >  include/input.h |    3 +--
> >  2 files changed, 7 insertions(+), 8 deletions(-)
> > 
> > diff --git a/dix/events.c b/dix/events.c
> > index 828b143..309db9e 100644
> > --- a/dix/events.c
> > +++ b/dix/events.c
> > @@ -2532,27 +2532,27 @@ FixUpEventFromWindow(
> >   * client.
> >   *
> >   * @param[in] dev The device this event is being sent for.
> > - * @param[in] event The event that is to be sent.
> > + * @param[in] evtype The event type of the event that is to be sent.
> >   * @param[in] win The current event window.
> >   *
> >   * @return Bitmask of ::EVENT_XI2_MASK, ::EVENT_XI1_MASK, ::EVENT_CORE_MASK, and
> >   *         ::EVENT_DONT_PROPAGATE_MASK.
> >   */
> >  int
> > -EventIsDeliverable(DeviceIntPtr dev, InternalEvent* event, WindowPtr win)
> > +EventIsDeliverable(DeviceIntPtr dev, int evtype, WindowPtr win)
> >  {
> >      int rc = 0;
> >      int filter = 0;
> >      int type;
> >      OtherInputMasks *inputMasks = wOtherInputMasks(win);
> >  
> > -    if ((type = GetXI2Type(event->any.type)) != 0)
> > +    if ((type = GetXI2Type(evtype)) != 0)
> >      {
> >          if (inputMasks && xi2mask_isset(inputMasks->xi2mask, dev, type))
> >              rc |= EVENT_XI2_MASK;
> >      }
> >  
> > -    if ((type = GetXIType(event->any.type)) != 0)
> > +    if ((type = GetXIType(evtype)) != 0)
> >      {
> >          filter = GetEventFilterMask(dev, type);
> >  
> > @@ -2568,7 +2568,7 @@ EventIsDeliverable(DeviceIntPtr dev, InternalEvent* event, WindowPtr win)
> >  
> >      }
> >  
> > -    if ((type = GetCoreType(event->any.type)) != 0)
> > +    if ((type = GetCoreType(evtype)) != 0)
> >      {
> >          filter = GetEventFilterMask(dev, type);
> >  
> > @@ -2667,7 +2667,7 @@ DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab,
> >  
> >      while (pWin)
> >      {
> > -        if ((mask = EventIsDeliverable(dev, event, pWin)))
> > +        if ((mask = EventIsDeliverable(dev, event->any.type, pWin)))
> 
> 
> The readability suffers here. personally i prefer the
>   mask = EventIsDeliverable(dev, event->any.type, pWin);
>   if (mask == 0 )
> style. (no idea what the X11-policy is here). but when i see
>  if ( .. foo=bar ... )  a red light shows up for me ....
> 
> just a hint, the code seems the same.

yeah, this patch is just a search/replace and I'd like to keep it (this
patch) this way. introducing unrelated changes in something like this is bad
behaviour.
feel free to submit a cleanup patch for this though.

Cheers,
  Peter

> >          {
> >              /* XI2 events first */
> >              if (mask & EVENT_XI2_MASK)
> > diff --git a/include/input.h b/include/input.h
> > index 7c5ad3c..fb24fd5 100644
> > --- a/include/input.h
> > +++ b/include/input.h
> > @@ -552,8 +552,7 @@ void FixUpEventFromWindow(SpritePtr pSprite,
> >                            Window child,
> >                            Bool calcChild);
> >  extern WindowPtr XYToWindow(SpritePtr pSprite, int x, int y);
> > -extern int EventIsDeliverable(DeviceIntPtr dev, InternalEvent* event,
> > -                              WindowPtr win);
> > +extern int EventIsDeliverable(DeviceIntPtr dev, int evtype, WindowPtr win);
> >  extern Bool ActivatePassiveGrab(DeviceIntPtr dev, GrabPtr grab,
> >                                  InternalEvent *ev);
> >  /**


More information about the xorg-devel mailing list