From 3772676fd65065b43a94234127537ab5030b09f8 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Tue, 1 Dec 2009 00:12:36 +0000 Subject: Swap axes before applying touch screen calibration. 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 Acked-by: Peter Hutterer Signed-off-by: Peter Hutterer (cherry picked from commit f187badb71554a73bf9ca30ce75c9d166e688f03) --- src/evdev.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/evdev.c b/src/evdev.c index 33e02ab..bf0e760 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -464,6 +464,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], @@ -476,12 +483,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); -- cgit v1.2.3