[PATCH xf86-input-synaptics 07/10] Add touch valuator mask to hw state structure

Chase Douglas chase.douglas at canonical.com
Thu Feb 9 09:49:09 PST 2012


On 02/09/2012 06:43 PM, walter harms wrote:
> 
> 
> Am 09.02.2012 18:22, schrieb Chase Douglas:
>> On 02/09/2012 03:27 PM, Peter Hutterer wrote:
>>> On Wed, Feb 08, 2012 at 06:35:16PM -0800, Chase Douglas wrote:
>>>> Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
>>>> ---
>>>>  src/synaptics.c    |   78 ++++++++++++++++++++++++++++++++++++++++++++++++++-
>>>>  src/synapticsstr.h |    1 +
>>>>  src/synproto.h     |    5 +++
>>>>  3 files changed, 82 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/src/synaptics.c b/src/synaptics.c
>>>> index c0398fb..b01be59 100644
>>>> --- a/src/synaptics.c
>>>> +++ b/src/synaptics.c
>>>> @@ -1151,6 +1151,8 @@ DeviceInit(DeviceIntPtr dev)
>>>>  #ifdef HAVE_MULTITOUCH
>>>>      if (priv->has_touch)
>>>>      {
>>>> +        priv->num_slots = priv->max_touches ? : 10;
>>>
>>> whoah, didn't know that was legal. is this gcc or std C?
>>> either way, I'd rather not do that because of this behaviour:
>>>
>>>     int a = 12;
>>>     a = (a > 10) ? : 10;
>>>     → a is now 1
>>>     
>>> Not quite what one would expect.
>>
>> I think it is standard C. It's not seen too often because many times
>> you're checking a value against something non-zero. A better example of
>> how not to do it is:
>>
>> a = (b > 0) ? : 10;
>>
>> I don't see any reason why what I have is bad, but I'll change it if it
>> makes you cringe. People writing C need to know what they are doing, and
>> this isn't one of those areas where what really happens is different
>> than what one might think.
>>
> 
> 
> IMHO this is a gcc extension. (Conditionals with omitted Operands)

Well, it's not really an opinion, it either is or it isn't :). Do you
know where to look to be sure? I would be interested in knowing.

-- Chase


More information about the xorg-devel mailing list