summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Tissoires <tissoire@cena.fr>2010-01-31 23:49:45 +0100
committerBenjamin Tissoires <tissoire@cena.fr>2010-03-15 19:05:34 +0100
commit502a3853992e172745daa3c8409dd78a446fd9a2 (patch)
treeeaa38ecbb3dadff6ac58196e53d98df27532602f
parent7ec3c07738c98340b8f75fabbdea00cbcf8e3b33 (diff)
Force the Tracking ID valuator in case of a multitouch device
Some devices, such as the N-Trig one, does not give the tracking ID. Thus, to keep consistency with the other mt devices, this patch forces this axe to exist. Signed-off-by: Benjamin Tissoires <tissoire@cena.fr> Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
-rw-r--r--src/evdev.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/evdev.c b/src/evdev.c
index 193d539..f56a208 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1383,6 +1383,13 @@ EvdevAddAbsClass(DeviceIntPtr device)
num_axes = CountBits(pEvdev->abs_bitmask, NLONGS(ABS_MAX));
if (num_axes < 1)
return !Success;
+
+ if (pEvdev->flags & EVDEV_MULTITOUCH) {
+ /* in case of multitouch devices, we force the axe Tracking ID if not reported by the kernel */
+ if (!TestBit(ABS_MT_TRACKING_ID, pEvdev->abs_bitmask))
+ num_axes++;
+ }
+
pEvdev->num_vals = num_axes;
memset(pEvdev->vals, 0, num_axes * sizeof(int));
memset(pEvdev->old_vals, -1, num_axes * sizeof(int));
@@ -1396,6 +1403,14 @@ EvdevAddAbsClass(DeviceIntPtr device)
i++;
}
+ /* Initialize the Tracking ID axis in case it isn't reported by the kernel */
+ if ((pEvdev->flags & EVDEV_MULTITOUCH) &&
+ (!TestBit(ABS_MT_TRACKING_ID, pEvdev->abs_bitmask))) {
+ pEvdev->axis_map[ABS_MT_TRACKING_ID] = pEvdev->num_vals - 1;
+ pEvdev->absinfo[ABS_MT_TRACKING_ID].minimum = -1;
+ pEvdev->absinfo[ABS_MT_TRACKING_ID].maximum = MAX_VALUATORS_MT;
+ }
+
EvdevInitAxesLabels(pEvdev, pEvdev->num_vals, atoms);
if (!InitValuatorClassDeviceStruct(device, num_axes,