From 47f3f30d8309b54acde0d4d9f5ce415692e67ec4 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sat, 27 Nov 2021 06:59:16 +0300 Subject: [PATCH] Add high resolution scrolling support with SDL 2.0.18 --- app/streaming/input/mouse.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/streaming/input/mouse.cpp b/app/streaming/input/mouse.cpp index a3b156db..5921525d 100644 --- a/app/streaming/input/mouse.cpp +++ b/app/streaming/input/mouse.cpp @@ -212,6 +212,16 @@ void SdlInputHandler::handleMouseWheelEvent(SDL_MouseWheelEvent* event) } } +#if SDL_VERSION_ATLEAST(2, 0, 18) + if (event->preciseY != 0.0f) { + // Invert the scroll direction if needed + if (m_ReverseScrollDirection) { + event->preciseY = -event->preciseY; + } + + LiSendHighResScrollEvent((short)(event->preciseY * 120)); // WHEEL_DELTA + } +#else if (event->y != 0) { // Invert the scroll direction if needed if (m_ReverseScrollDirection) { @@ -220,6 +230,7 @@ void SdlInputHandler::handleMouseWheelEvent(SDL_MouseWheelEvent* event) LiSendScrollEvent((signed char)event->y); } +#endif } bool SdlInputHandler::isMouseInVideoRegion(int mouseX, int mouseY, int windowWidth, int windowHeight)