diff options
author | Magnus Vigerlöf <Magnus.Vigerlof@ipbo.se> | 2008-05-23 00:36:11 +0200 |
---|---|---|
committer | Peter Hutterer <peter@cs.unisa.edu.au> | 2008-05-23 09:30:43 +0930 |
commit | a0241d5380bb5d8b10865f8ea81a9a011de4aaf1 (patch) | |
tree | 5221748f75e92e614db91c8df605e224e9a2d06a | |
parent | f6645ddbf754c80e9a8b1672519534a887622270 (diff) |
dix: Correct clipAxis so it can handle devices with value ranges properly
Signed-off-by: Peter Hutterer <peter@cs.unisa.edu.au>
-rw-r--r-- | dix/getevents.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/dix/getevents.c b/dix/getevents.c index fafb632b8..26add1280 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -406,22 +406,15 @@ static void clipAxis(DeviceIntPtr pDev, int axisNum, int *val) { AxisInfoPtr axis = pDev->valuator->axes + axisNum; - /* InitValuatoraAxisStruct ensures that (min < max). */ - - /* FIXME: drivers need to be updated, evdev e.g. inits axes as min = 0 and - * max = -1. Leave this extra check until the drivers have been updated. - */ - if (axis->max_value < axis->min_value) + /* If a value range is defined, clip. If not, do nothing */ + if (axis->max_value <= axis->min_value) return; - if (axis->min_value != NO_AXIS_LIMITS && - *val < axis->min_value) + if (*val < axis->min_value) *val = axis->min_value; - - if (axis->max_value != NO_AXIS_LIMITS && - *val > axis->max_value) + if (*val > axis->max_value) *val = axis->max_value; } |