From 0d08d3e73e7c2a378501c0351de2793c9bc7eab9 Mon Sep 17 00:00:00 2001 From: Revincx Date: Mon, 10 Aug 2026 22:12:18 +0800 Subject: [PATCH] evdev: Fix vertical high-resolution mouse wheel scaling This commit fixes a regression introduced by c44fa5bb The evdev backend currently uses high_res_hwheel to select the normalization denominator for both horizontal and vertical wheel events. This causes devices which advertise REL_WHEEL_HI_RES but not REL_HWHEEL_HI_RES to report vertical wheel movement 120 times larger than intended. Use the corresponding high-resolution capability independently for each axis, restoring the behavior before c44fa5bb. (cherry picked from commit b640b804a8cfe9f998ac82650a32c5e6e6cd4571) --- src/core/linux/SDL_evdev.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/core/linux/SDL_evdev.c b/src/core/linux/SDL_evdev.c index a6ef26e54d..fa43ee6c57 100644 --- a/src/core/linux/SDL_evdev.c +++ b/src/core/linux/SDL_evdev.c @@ -516,11 +516,10 @@ void SDL_EVDEV_Poll(void) if (item->mouse_wheel != 0 || item->mouse_hwheel != 0) { Uint64 timestamp = SDL_EVDEV_GetEventTimestamp(event); - const float denom = (item->high_res_hwheel ? 120.0f : 1.0f); SDL_SendMouseWheel(timestamp, mouse->focus, (SDL_MouseID)item->fd, - item->mouse_hwheel / denom, - item->mouse_wheel / denom, + item->mouse_hwheel / (item->high_res_hwheel ? 120.0f : 1.0f), + item->mouse_wheel / (item->high_res_wheel ? 120.0f : 1.0f), SDL_MOUSEWHEEL_NORMAL); item->mouse_wheel = item->mouse_hwheel = 0; }