From 25b6fc4a42f7698e6ae0b16becb316bfd7835d05 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 16 Jun 2009 10:48:48 +1000 Subject: [PATCH] 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 --- Xi/exevents.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Xi/exevents.c b/Xi/exevents.c index 821644d55..0d8322a9d 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -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)) {