[PATCH 10/20] Switch to use IsFloating()

Benjamin Tissoires tissoire at cena.fr
Tue Feb 22 14:44:00 PST 2011


On 02/22/2011 11:31 PM, Peter Hutterer wrote:
> On Tue, Feb 22, 2011 at 08:17:32AM +0100, Benjamin Tissoires wrote:
>> Hi Peter,
>>
>> Except two unnecessary parenthesis here, you can add my Reviewed-by
>> for the series ;)
>>
>> On 02/18/2011 04:52 AM, Peter Hutterer wrote:
>
> [...]
>
>>> diff --git a/Xi/xipassivegrab.c b/Xi/xipassivegrab.c
>>> index e99b6e5..8663d12 100644
>>> --- a/Xi/xipassivegrab.c
>>> +++ b/Xi/xipassivegrab.c
>>> @@ -162,10 +162,7 @@ ProcXIPassiveGrabDevice(ClientPtr client)
>>>       if (!modifiers_failed)
>>>           return BadAlloc;
>>>
>>> -    if (!IsMaster(dev)&&   dev->u.master)
>>> -        mod_dev = GetMaster(dev, MASTER_KEYBOARD);
>>> -    else
>>> -        mod_dev = dev;
>>> +    mod_dev = (IsFloating(dev)) ? dev : GetMaster(dev, MASTER_KEYBOARD);
>>
>> parenthesis around IsFloating are not necessary... It's just to say
>> something
>
> fwiw, this is just one of my personal preferences. i like doing this for
> terneray conditions as it helps me parse the code faster.
>
> thanks for the reviews!
>
> Cheers,
>    Peter
>

Just to be fully compliant (and a little bit annoying)

 > diff --git a/Xi/exevents.c b/Xi/exevents.c
 > index b39e202..ea9daa9 100644
 > --- a/Xi/exevents.c
 > +++ b/Xi/exevents.c
 > @@ -713,7 +713,7 @@ ChangeMasterDeviceClasses(DeviceIntPtr device, 
DeviceChangedEvent *dce)
 >      if (IsMaster(slave))
 >          return;
 >
 > -    if (!slave->u.master)
 > +    if (IsFloating(slave))
 >          return; /* set floating since the event */
 >
 >      if (slave->u.master->id != dce->masterid)
 > @@ -1009,7 +1009,7 @@ ProcessOtherEvent(InternalEvent *ev, 
DeviceIntPtr device)
 >      b = device->button;
 >      k = device->key;
 >
 > -    if (IsMaster(device) || !device->u.master)
 > +    if (IsMaster(device) || IsFloating(device))
 >          CheckMotion(event, device);
 >
 >      switch (event->type)
 > @@ -1226,7 +1226,7 @@ DeviceFocusEvent(DeviceIntPtr dev, int type, 
int mode, int detail,
 >      DeviceIntPtr mouse;
 >      int btlen, len, i;
 >
 > -    mouse = (IsMaster(dev) || dev->u.master) ? GetMaster(dev, 
MASTER_POINTER) : dev;
 > +    mouse = IsFloating(dev) ? dev : GetMaster(dev, MASTER_POINTER);

You forgot the parenthesis here

;-)

Ok, I stop... --->[]

Cheers,
Benjamin



More information about the xorg-devel mailing list