aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Yamin <plasm@roo.me.uk>2010-09-07 10:31:02 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2010-09-07 10:31:02 +1000
commitb83515485b739451b6cde29c7e6f5c900175eaf9 (patch)
tree5e4aef954acd7086cbaa3cc3a578400e0a642b06
parentMerge branch 'input-api' of git://people.freedesktop.org/~whot/xf86-input-evdev (diff)
downloadxf86-input-evdev-b83515485b739451b6cde29c7e6f5c900175eaf9.tar.gz
xf86-input-evdev-b83515485b739451b6cde29c7e6f5c900175eaf9.tar.bz2
xf86-input-evdev-b83515485b739451b6cde29c7e6f5c900175eaf9.zip
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 <plasm@roo.me.uk> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--src/evdev.c12
1 files 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)