diff options
author | Peter Hutterer <peter@cs.unisa.edu.au> | 2008-04-30 11:45:19 +0930 |
---|---|---|
committer | Peter Hutterer <peter@cs.unisa.edu.au> | 2008-04-30 11:49:11 +0930 |
commit | ffaccc2dc91f4ca4ea10da010206a0a7d2b5540c (patch) | |
tree | e43860833bbf53bf98ade1f81edae679cc2dbc93 /dix/getevents.c | |
parent | 00acb40f2bc5bb4a1977b9b08db75630677ff787 (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.c | 17 |
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; } /** |