Xi: last_valuator is used like an index, so range it accordingly.

The previous code would always skip the last valuator due to a wrong
upper boundary in the loop. last_valuator is the index of the last set
valuator - which also means it must be initialized to -1, not 0.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2009-06-16 10:48:48 +10:00
parent 3fc762ea94
commit 25b6fc4a42

View File

@ -818,7 +818,7 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event)
/* Update device axis */
/* Check valuators first */
last_valuator = 0;
last_valuator = -1;
for (i = 0; i < MAX_VALUATORS; i++)
{
if (BitIsOn(&event->valuators.mask, i))
@ -838,7 +838,7 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event)
}
}
for (i = 0; i < last_valuator && i < v->numAxes; i++)
for (i = 0; i <= last_valuator && i < v->numAxes; i++)
{
if (BitIsOn(&event->valuators.mask, i))
{