From 9a2d9183608b3d7975c062909d6d77c95d5be14e Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Thu, 29 Aug 2024 12:36:42 +0000 Subject: [PATCH] Fixed mouse wheel in xbrz mode, use mouse position information if provided by SDL --- client/eventsSDL/InputSourceMouse.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client/eventsSDL/InputSourceMouse.cpp b/client/eventsSDL/InputSourceMouse.cpp index d043fa30f..4c463563a 100644 --- a/client/eventsSDL/InputSourceMouse.cpp +++ b/client/eventsSDL/InputSourceMouse.cpp @@ -23,6 +23,7 @@ #include #include +#include InputSourceMouse::InputSourceMouse() :mouseToleranceDistance(settings["input"]["mouseToleranceDistance"].Integer()) @@ -69,7 +70,11 @@ void InputSourceMouse::handleEventMouseButtonDown(const SDL_MouseButtonEvent & b void InputSourceMouse::handleEventMouseWheel(const SDL_MouseWheelEvent & wheel) { - GH.events().dispatchMouseScrolled(Point(wheel.x, wheel.y) / GH.screenHandler().getScalingFactor(), GH.getCursorPosition()); +#if SDL_VERSION_ATLEAST(2,26,0) + GH.events().dispatchMouseScrolled(Point(wheel.x, wheel.y), Point(wheel.mouseX, wheel.mouseY) / GH.screenHandler().getScalingFactor()); +#else + GH.events().dispatchMouseScrolled(Point(wheel.x, wheel.y), GH.getCursorPosition()); +#endif } void InputSourceMouse::handleEventMouseButtonUp(const SDL_MouseButtonEvent & button)