dix: Correct clipAxis so it can handle devices with value ranges properly
Signed-off-by: Peter Hutterer <peter@cs.unisa.edu.au>
This commit is contained in:
parent
f6645ddbf7
commit
a0241d5380
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user