aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/dix/eventconvert.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/dix/eventconvert.c')
-rw-r--r--xorg-server/dix/eventconvert.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/xorg-server/dix/eventconvert.c b/xorg-server/dix/eventconvert.c
index e45878a90..e9297149c 100644
--- a/xorg-server/dix/eventconvert.c
+++ b/xorg-server/dix/eventconvert.c
@@ -324,14 +324,16 @@ countValuators(DeviceEvent *ev, int *first)
for (i = 0; i < sizeof(ev->valuators.mask) * 8; i++)
{
- /* Assume mode of 0th valuator matches XI1 device mode. Stop when the
- * event mode changes since XI1 can't handle mixed mode devices.
- */
- if (ev->valuators.mode[i] != ev->valuators.mode[0])
- break;
-
if (BitIsOn(ev->valuators.mask, i))
{
+ /* Assume mode of first_valuator matches XI1 device mode. Stop when the
+ * event mode changes since XI1 can't handle mixed mode devices.
+ */
+ if (first_valuator > -1 &&
+ BitIsOn(ev->valuators.mode, i) !=
+ BitIsOn(ev->valuators.mode, first_valuator))
+ break;
+
if (first_valuator == -1)
first_valuator = i;
last_valuator = i;