[PATCH xf86-input-synaptics 07/10] Add touch valuator mask to hw state structure
walter harms
wharms at bfs.de
Thu Feb 9 09:43:59 PST 2012
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)
a = (b > 0) ? : 10; is equal to
a = (b > 0) ? (b > 0) : 10;
re,
wh
More information about the xorg-devel
mailing list