summaryrefslogtreecommitdiff
path: root/dix/getevents.c
diff options
context:
space:
mode:
authorPeter Hutterer <peter@cs.unisa.edu.au>2008-04-30 11:45:19 +0930
committerPeter Hutterer <peter@cs.unisa.edu.au>2008-04-30 11:49:11 +0930
commitffaccc2dc91f4ca4ea10da010206a0a7d2b5540c (patch)
treee43860833bbf53bf98ade1f81edae679cc2dbc93 /dix/getevents.c
parent00acb40f2bc5bb4a1977b9b08db75630677ff787 (diff)
input: replace -1 as default axis limit with NO_AXIS_LIMIT define.
This allows easier refacturing of the coordinate limit handling. Grepping for -1 is boring.
Diffstat (limited to 'dix/getevents.c')
-rw-r--r--dix/getevents.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/dix/getevents.c b/dix/getevents.c
index e9c1db0f5..a358bb3e9 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -358,14 +358,15 @@ clipAxis(DeviceIntPtr pDev, int axisNum, int *val)
{
AxisInfoPtr axes = pDev->valuator->axes + axisNum;
- /* Don't clip if min_value and max_value are the same, or if an invalid
- range is specified. */
- if(axes->min_value < axes->max_value) {
- if (*val < axes->min_value)
- *val = axes->min_value;
- if (*val > axes->max_value)
- *val = axes->max_value;
- }
+ /* InitValuatoraAxisStruct ensures that (min < max) */
+
+ if (axes->min_value != NO_AXIS_LIMITS &&
+ *val < axis->min_value)
+ *val = axes->min_value;
+
+ if (axes->max_value != NO_AXIS_LIMITS &&
+ *val > axes->max_value)
+ *val = axes->max_value;
}
/**