[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.
This commit is contained in:
Tudor Brindus 2021-01-03 23:16:41 -05:00 committed by Geoffrey McRae
parent 78b1f64a61
commit d997f0d18c

View file

@ -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");