From: Tobias Koch <tobias.k...@nokia.com>

From: Tobias Koch <tobias.k...@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.k...@nokia.com>
Reviewed-by: Rami Ylimäki <rami.ylim...@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

_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to