From d997f0d18c90540ec764f8f4586e8006991d91ff Mon Sep 17 00:00:00 2001 From: Tudor Brindus Date: Sun, 3 Jan 2021 23:16:41 -0500 Subject: [PATCH] [client] spice: properly handle high-precision scroll wheel input Some setups (e.g. Wayland) have high precision scroll wheel input, such that the y-delta on an event may exceed 1. In these cases, scrolling up currently gets treated as scrolling down. This commit changes the checks to use > 0 rather than == 1. This is the approach suggested in https://wiki.libsdl.org/SDL_MouseWheelEvent. --- client/src/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/src/main.c b/client/src/main.c index 41900524..dd90f0ee 100644 --- a/client/src/main.c +++ b/client/src/main.c @@ -1332,8 +1332,8 @@ int eventFilter(void * userdata, SDL_Event * event) break; if ( - !spice_mouse_press (event->wheel.y == 1 ? 4 : 5) || - !spice_mouse_release(event->wheel.y == 1 ? 4 : 5) + !spice_mouse_press (event->wheel.y > 0 ? 4 : 5) || + !spice_mouse_release(event->wheel.y > 0 ? 4 : 5) ) { DEBUG_ERROR("SDL_MOUSEWHEEL: failed to send messages");