aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2011-12-20 14:14:16 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2011-12-20 14:18:30 +1000
commit191660189a01b9c96bb4c0fa1a2e5008ae666238 (patch)
treed58e40ae6e8d171722c6429d1a3c27b4d180129d
parentDrop now-unnecessary XI 2.1 and XI 2.2 error suppression defines (diff)
downloadxf86-input-evdev-191660189a01b9c96bb4c0fa1a2e5008ae666238.tar.gz
xf86-input-evdev-191660189a01b9c96bb4c0fa1a2e5008ae666238.tar.bz2
xf86-input-evdev-191660189a01b9c96bb4c0fa1a2e5008ae666238.zip
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.c21
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++;