[PATCH libXtst] Allow more than 6 axes to be sent.

Rami Ylimäki rami.ylimaki at vincit.fi
Wed Sep 29 08:03:30 PDT 2010


From: Tobias Koch <tobias.koch at nokia.com>

From: Tobias Koch <tobias.koch at nokia.com>

If the number of axes exceeds 6, X server will return BadValue for
XTestFakeInput because the number of axes in a single DeviceValuator
event is incorrectly set to the total number of axes.

Signed-off-by: Tobias Koch <tobias.koch at nokia.com>
Reviewed-by: Rami Ylimäki <rami.ylimaki at vincit.fi>
---
 src/XTest.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/XTest.c b/src/XTest.c
index c04cc09..24ae8b9 100644
--- a/src/XTest.c
+++ b/src/XTest.c
@@ -267,12 +267,10 @@ send_axes(
     req->length += ((n_axes + 5) / 6) * (SIZEOF(xEvent) >> 2);
     ev.type = XI_DeviceValuator + (long)info->data;
     ev.deviceid = dev->device_id;
-    ev.num_valuators = n_axes;
     ev.first_valuator = first_axis;
     while (n_axes > 0) {
-	n = n_axes;
-	if (n > 6)
-	    n = 6;
+	n = n_axes > 6 ? 6 : n_axes;
+	ev.num_valuators = n;
 	switch (n) {
 	case 6:
 	    ev.valuator5 = *(axes+5);
-- 
1.6.3.3



More information about the xorg-devel mailing list