[PATCH 1/2] Xi: fix length calculation for ValuatorState in QueryDeviceState reply.

Peter Hutterer peter.hutterer at who-t.net
Wed Sep 23 22:42:21 PDT 2009


The length field needs to include the bytes required for the valuators
(INT32) as well.

The reply length has the right value and since the valuator state is always
last, clients didn't notice the wrong offset.

Tested-by: Thomas Jaeger
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 Xi/queryst.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Xi/queryst.c b/Xi/queryst.c
index 60ec32e..2ba1edb 100644
--- a/Xi/queryst.c
+++ b/Xi/queryst.c
@@ -147,7 +147,7 @@ ProcXQueryDeviceState(ClientPtr client)
     if (v != NULL) {
 	tv = (xValuatorState *) buf;
 	tv->class = ValuatorClass;
-	tv->length = sizeof(xValuatorState);
+	tv->length = sizeof(xValuatorState) + v->numAxes * 4;
 	tv->num_valuators = v->numAxes;
 	tv->mode = v->mode;
 	buf += sizeof(xValuatorState);
-- 
1.6.3.rc1.2.g0164.dirty


More information about the xorg-devel mailing list