[PATCH xserver] Convert server to masked input valuators

Chase Douglas chase.douglas at canonical.com
Tue Oct 5 16:14:43 PDT 2010


On Tue, 2010-10-05 at 15:59 -0700, Jesse Adkins wrote:
> >+    if (type == MotionNotify &&
> >+        CountBits(mask->mask, mask->len) <= 0)
> Should be == 0. CountBits doesn't return negative values.

I like to be safe, so I always encode <= 0 when I want to check for
positive values. What if CountBits is modified and stops working
properly and spits out a negative value? I'd prefer to return 0 here
than hit a segfault.

An argument could be made that CountBits should return an unsigned int.
If no one objects, I'll make that modification and then make this check
== 0.

> >+    InjectPointerKeyEvents(dev, MotionNotify, 0, gpe_flags, &mask, (int[]){x, y});
> That's a C99 cast there. It shouldn't have been like that in the first place.
> I was told that X is supposed to work on C89 when I tried to add a
> __FUNCTION__ to __func__ patch a while back.

If it's not a problem, I'll just change the cast to (int *) in the
patch.

> Out of curiosity, why are CountBits and ValuatorRangeToMask being exported?

I actually use CountBits in the evdev masked valuators patch, and I
think it's a generally useful function to export.

ValuatorRangeToMask probably can be internal only. I'll fix that up.

Thanks,

-- Chase



More information about the xorg-devel mailing list