From b83515485b739451b6cde29c7e6f5c900175eaf9 Mon Sep 17 00:00:00 2001 From: Tim Yamin Date: Tue, 7 Sep 2010 10:31:02 +1000 Subject: SwapAxes should rescale raw values when enabled Current implementation assumes that X & Y axes have the same min and max values. If they don't, you'll end up with funny behaviour if SwapAxes is turned on. Signed-off-by: Tim Yamin Signed-off-by: Peter Hutterer --- src/evdev.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/evdev.c b/src/evdev.c index ae20de3..8b8fe33 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -419,8 +419,16 @@ EvdevProcessValuators(InputInfoPtr pInfo, int v[MAX_VALUATORS], int *num_v, if (pEvdev->swap_axes) { int tmp = v[0]; - v[0] = v[1]; - v[1] = tmp; + v[0] = xf86ScaleAxis(v[1], + pEvdev->absinfo[ABS_X].maximum, + pEvdev->absinfo[ABS_X].minimum, + pEvdev->absinfo[ABS_Y].maximum, + pEvdev->absinfo[ABS_Y].minimum); + v[1] = xf86ScaleAxis(tmp, + pEvdev->absinfo[ABS_Y].maximum, + pEvdev->absinfo[ABS_Y].minimum, + pEvdev->absinfo[ABS_X].maximum, + pEvdev->absinfo[ABS_X].minimum); } if (pEvdev->flags & EVDEV_CALIBRATED) -- cgit v1.2.3