[PATCH] evdev: Swap axes before applying touch screen calibration.

David Woodhouse dwmw2 at infradead.org
Mon Nov 30 16:12:36 PST 2009


When the SwapAxes option is set, the X and Y axes in calibration should
be labelled as the user perceives them -- not as the kernel sends them.

Currently, we apply the X-axis calibration to the X-axis of the input,
and then do the axis swapping so we've actually applied the X-axis
calibration to what the user sees as the Y-axis.

This patch changes the order of the operations, so that the axes are
swapped before the calibration is applied.

Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
Acked-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/src/evdev.c b/src/evdev.c
index 81a0bd5..f4b2b2e 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -399,6 +399,13 @@ EvdevProcessValuators(InputInfoPtr pInfo, int v[MAX_VALUATORS], int *num_v,
      */
     else if (pEvdev->abs && pEvdev->tool) {
         memcpy(v, pEvdev->vals, sizeof(int) * pEvdev->num_vals);
+
+        if (pEvdev->swap_axes) {
+            int tmp = v[0];
+            v[0] = v[1];
+            v[1] = tmp;
+        }
+
         if (pEvdev->flags & EVDEV_CALIBRATED)
         {
             v[0] = xf86ScaleAxis(v[0],
@@ -411,12 +418,6 @@ EvdevProcessValuators(InputInfoPtr pInfo, int v[MAX_VALUATORS], int *num_v,
                     pEvdev->calibration.max_y, pEvdev->calibration.min_y);
         }
 
-        if (pEvdev->swap_axes) {
-            int tmp = v[0];
-            v[0] = v[1];
-            v[1] = tmp;
-        }
-
         if (pEvdev->invert_x)
             v[0] = (pEvdev->absinfo[ABS_X].maximum - v[0] +
                     pEvdev->absinfo[ABS_X].minimum);


-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse at intel.com                              Intel Corporation




More information about the xorg mailing list