From 862da1c2e7b42dc25b92eea69d752cdacd48fb7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Lipinsk=C3=BD?= <18076-Mr-Tao@users.noreply.gitlab.freedesktop.org> Date: Wed, 26 Aug 2026 01:08:12 +0200 Subject: [PATCH] Xi: test XIQueryDevice values for relative scroll valuators MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit XIQueryDevice already reports the current cumulative axisVal for relative scroll valuators. Seed nonzero vertical and horizontal values and verify their FP3232 representation for native and swapped clients. Signed-off-by: Lukáš Lipinský <18076-Mr-Tao@users.noreply.gitlab.freedesktop.org> Part-of: (cherry picked from commit 18dbde8971df1545155d9180a5421eedf84a2982) (cherry picked from commit 1688dcf08ee721db3b336677d0530b824b6b43a0) (cherry picked from commit 7c7748e311ea9ad00d9c71e3d00a7a259d77473d) --- test/xi2/protocol-xiquerydevice.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/xi2/protocol-xiquerydevice.c b/test/xi2/protocol-xiquerydevice.c index 90c983c432..0efc8ad385 100644 --- a/test/xi2/protocol-xiquerydevice.c +++ b/test/xi2/protocol-xiquerydevice.c @@ -33,6 +33,7 @@ #include #include +#include "dix/inpututils_priv.h" #include "miext/extinit_priv.h" #include "Xext/xinput/handlers.h" @@ -256,6 +257,8 @@ reply_XIQueryDevice_data(ClientPtr client, int len, void *data) swapl(&vi->min.frac); swapl(&vi->max.integral); swapl(&vi->max.frac); + swapl(&vi->value.integral); + swapl(&vi->value.frac); swapl(&vi->resolution); } @@ -273,6 +276,15 @@ reply_XIQueryDevice_data(ClientPtr client, int len, void *data) assert(vi->max.integral == -1); assert(vi->max.frac == 0); assert(vi->resolution == 0); + + if (info->deviceid == devices.mouse->id && + (vi->number == 2 || vi->number == 3)) { + FP3232 expected = double_to_fp3232( + devices.mouse->valuator->axisVal[vi->number]); + + assert(vi->value.integral == expected.integral); + assert(vi->value.frac == expected.frac); + } } } break; @@ -324,6 +336,9 @@ test_XIQueryDevice(void) init_simple(); + devices.mouse->valuator->axisVal[2] = 240.5; + devices.mouse->valuator->axisVal[3] = -350.25; + wrapped_dixWriteToClient = reply_XIQueryDevice; request_init(&request, XIQueryDevice);