[PATCH evdev] Always init axis mapping for the first two rel axes (#59784)

Peter Hutterer peter.hutterer at who-t.net
Thu Jan 24 17:11:15 PST 2013


Fixes regression introduced in 2f67509b53b27dd7f51ca2aadd19605aee613a61.

If evdev is used for touchpads, the abs axis movement is converted to a rel
movement. Without the two relative axes initialized, the events are
discarded.

Axes 0 and 1 are always x/y anyway unless specifically configured otherwise.

X.Org Bug 59784 <http://bugs.freedesktop.org/show_bug.cgi?id=59784>

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/evdev.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/evdev.c b/src/evdev.c
index c25bea4..30a08d9 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -2558,6 +2558,9 @@ EvdevAlloc(void)
     for (i = 0; i < ArrayLength(pEvdev->abs_axis_map); i++)
         pEvdev->abs_axis_map[i] = -1;
 
+    pEvdev->rel_axis_map[0] = 0;
+    pEvdev->rel_axis_map[1] = 1;
+
     return pEvdev;
 }
 
@@ -2722,6 +2725,8 @@ static void EvdevInitAxesLabels(EvdevPtr pEvdev, int mode, int natoms, Atom *ato
 
     memset(atoms, 0, natoms * sizeof(Atom));
 
+    /* rel[0] and [1] are always mapped, so we get the rel labels. if we
+       have abs x/y, the labels will be overwritten with the right one */
     for (axis = 0; axis < ArrayLength(rel_labels); axis++)
         EvdevInitOneAxisLabel(pEvdev, pEvdev->rel_axis_map[axis], rel_labels, axis, atoms);
 
-- 
1.8.1



More information about the xorg-devel mailing list