From 5f77da3a5025b92500c32d0dc7962d22fc79a8c7 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 14 Aug 2025 19:30:54 -0700 Subject: [PATCH] x11: use raw values for relative mouse motion Fixes https://github.com/libsdl-org/SDL/issues/13743 --- src/video/x11/SDL_x11xinput2.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/video/x11/SDL_x11xinput2.c b/src/video/x11/SDL_x11xinput2.c index 5da1bb791a..11afba68ef 100644 --- a/src/video/x11/SDL_x11xinput2.c +++ b/src/video/x11/SDL_x11xinput2.c @@ -84,15 +84,14 @@ static void parse_relative_valuators(SDL_XInput2DeviceInfo *devinfo, const XIRaw for (int j = 0; j < 2; ++j) { if (devinfo->number[j] == i) { - const double current_val = rawev->valuators.values[values_i]; + double current_val = rawev->raw_values[values_i]; if (devinfo->relative[j]) { processed_coords[j] = current_val; } else { - processed_coords[j] = devinfo->prev_coords[j] - current_val; // convert absolute to relative + processed_coords[j] = (current_val - devinfo->prev_coords[j]); // convert absolute to relative + devinfo->prev_coords[j] = current_val; } - - devinfo->prev_coords[j] = current_val; ++found; break;