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

Peter Hutterer peter.hutterer at who-t.net
Thu Feb 9 23:58:42 PST 2012


On Thu, Feb 09, 2012 at 06:22:27PM +0100, Chase Douglas wrote:
> 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.

sorry, my fault. played around with it a bit more, that operator just worked
differently to what I expected, hence the confusion. leave it in (once we
know whether it's a gcc extension or not).

Cheers,
  Peter, who learned something new


More information about the xorg-devel mailing list