mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-08-17 17:32:09 +08:00
evdev: Fix vertical high-resolution mouse wheel scaling
This commit fixes a regression introduced byc44fa5bbThe 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 beforec44fa5bb.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user