summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2009-06-26 09:59:04 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2009-06-29 14:40:21 +1000
commit8cc0d0f285261b0f26d22b5b4eca9ccbd1beeb93 (patch)
treef94e6ba3e0d1e05a097a102a6e145d488f56c7da
parentaa1609285dfa51570f74671a9f4240bccc1516c2 (diff)
Fix absolute axis labelling - mapping must be initialized before the labels.
88eedea281a710008a82f1e6af4bdffd19477f46 added axis labelling to the valuator initialization. This requires the axis mapping to be established before the absolute axis labels are initialized. 88eedea did this for relative axes, but missed out on the absolute ones. As a result, all abs. labels were initialized to "None". Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--src/evdev.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/evdev.c b/src/evdev.c
index 069fb1c..ecca94a 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1016,6 +1016,14 @@ EvdevAddAbsClass(DeviceIntPtr device)
memset(pEvdev->old_vals, -1, num_axes * sizeof(int));
atoms = xalloc(pEvdev->num_vals * sizeof(Atom));
+ for (axis = ABS_X; axis <= ABS_MAX; axis++) {
+ pEvdev->axis_map[axis] = -1;
+ if (!TestBit(axis, pEvdev->abs_bitmask))
+ continue;
+ pEvdev->axis_map[axis] = i;
+ i++;
+ }
+
EvdevInitAxesLabels(pEvdev, pEvdev->num_vals, atoms);
if (!InitValuatorClassDeviceStruct(device, num_axes,
@@ -1029,20 +1037,18 @@ EvdevAddAbsClass(DeviceIntPtr device)
return !Success;
for (axis = ABS_X; axis <= ABS_MAX; axis++) {
- pEvdev->axis_map[axis] = -1;
- if (!TestBit(axis, pEvdev->abs_bitmask))
+ int axnum = pEvdev->axis_map[axis];
+ if (axnum == -1)
continue;
- pEvdev->axis_map[axis] = i;
- xf86InitValuatorAxisStruct(device, i,
+ xf86InitValuatorAxisStruct(device, axnum,
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
- atoms[i],
+ atoms[axnum],
#endif
pEvdev->absinfo[axis].minimum,
pEvdev->absinfo[axis].maximum,
10000, 0, 10000);
- xf86InitValuatorDefaults(device, i);
- pEvdev->old_vals[i] = -1;
- i++;
+ xf86InitValuatorDefaults(device, axnum);
+ pEvdev->old_vals[axnum] = -1;
}
xfree(atoms);