From a0241d5380bb5d8b10865f8ea81a9a011de4aaf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20Vigerl=C3=B6f?= Date: Fri, 23 May 2008 00:36:11 +0200 Subject: [PATCH] dix: Correct clipAxis so it can handle devices with value ranges properly Signed-off-by: Peter Hutterer --- dix/getevents.c | 15 ++++----------- 1 file 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; }