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)
|
clipAxis(DeviceIntPtr pDev, int axisNum, int *val)
|
||||||
{
|
{
|
||||||
AxisInfoPtr axis = pDev->valuator->axes + axisNum;
|
AxisInfoPtr axis = pDev->valuator->axes + axisNum;
|
||||||
|
|
||||||
/* InitValuatoraAxisStruct ensures that (min < max). */
|
/* InitValuatoraAxisStruct ensures that (min < max). */
|
||||||
|
|
||||||
|
/* If a value range is defined, clip. If not, do nothing */
|
||||||
/* FIXME: drivers need to be updated, evdev e.g. inits axes as min = 0 and
|
if (axis->max_value <= axis->min_value)
|
||||||
* max = -1. Leave this extra check until the drivers have been updated.
|
|
||||||
*/
|
|
||||||
if (axis->max_value < axis->min_value)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (axis->min_value != NO_AXIS_LIMITS &&
|
if (*val < axis->min_value)
|
||||||
*val < axis->min_value)
|
|
||||||
*val = axis->min_value;
|
*val = axis->min_value;
|
||||||
|
if (*val > axis->max_value)
|
||||||
if (axis->max_value != NO_AXIS_LIMITS &&
|
|
||||||
*val > axis->max_value)
|
|
||||||
*val = axis->max_value;
|
*val = axis->max_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue