From 191660189a01b9c96bb4c0fa1a2e5008ae666238 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 20 Dec 2011 14:14:16 +1000 Subject: 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 --- src/evdev.c | 21 +++++++++++++++++++-- 1 file 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++; -- cgit v1.2.3