diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2011-12-20 14:14:16 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2011-12-20 14:18:30 +1000 |
commit | 191660189a01b9c96bb4c0fa1a2e5008ae666238 (patch) | |
tree | d58e40ae6e8d171722c6429d1a3c27b4d180129d | |
parent | a1c3f8efbbff7f93e216ccdb32bd176a8ba33b09 (diff) |
Add is_blacklisted_axis() helper
The kernel exports a bunch of information as axis that shouldn't be an axis
and we don't treat it as axis in the server. Add this helper instead of
checking for the axis codes manually.
No function change.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | src/evdev.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/evdev.c b/src/evdev.c index 9a5608b..00c9935 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -1131,6 +1131,23 @@ EvdevAddKeyClass(DeviceIntPtr device) return Success; } +/** + * return TRUE if the axis is not one we should count as true axis + */ +static int +is_blacklisted_axis(int axis) +{ + switch(axis) + { + case ABS_MT_SLOT: + case ABS_MT_TRACKING_ID: + return TRUE; + default: + return FALSE; + } +} + + static int EvdevAddAbsValuatorClass(DeviceIntPtr device) { @@ -1155,7 +1172,7 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device) { if (EvdevBitIsSet(pEvdev->abs_bitmask, axis)) { - if(axis != ABS_MT_SLOT && axis != ABS_MT_TRACKING_ID) + if (!is_blacklisted_axis(axis)) num_mt_axes++; num_axes--; } @@ -1215,7 +1232,7 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device) for (axis = ABS_X; i < MAX_VALUATORS && axis <= ABS_MAX; axis++) { pEvdev->axis_map[axis] = -1; if (!EvdevBitIsSet(pEvdev->abs_bitmask, axis) || - axis == ABS_MT_SLOT || axis == ABS_MT_TRACKING_ID) + is_blacklisted_axis(axis)) continue; pEvdev->axis_map[axis] = i; i++; |