From 38d64422e4c893150227d203ad3199ae9faca48b Mon Sep 17 00:00:00 2001 From: Ahmet Fatih Cengiz <37782582+afc-afc0@users.noreply.github.com> Date: Sun, 12 Apr 2026 02:37:10 -0400 Subject: [PATCH] bugfix(input): Fix touchpad upward scrolling in UI list boxes Preserve wheel delta sign when normalizing for touchpad scroll direction detection. Touchpad devices send small continuous deltas that were truncated to 0 by integer division with MOUSE_WHEEL_DELTA, causing upward scroll to be misidentified as downward scroll. Clamp the normalized value to at least 1 or -1 based on the original sign. --- Core/GameEngine/Source/GameClient/Input/Mouse.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Core/GameEngine/Source/GameClient/Input/Mouse.cpp b/Core/GameEngine/Source/GameClient/Input/Mouse.cpp index 67ceb096461..4abb1d44297 100644 --- a/Core/GameEngine/Source/GameClient/Input/Mouse.cpp +++ b/Core/GameEngine/Source/GameClient/Input/Mouse.cpp @@ -824,7 +824,9 @@ void Mouse::createStreamMessages() { msg = TheMessageStream->appendMessage( GameMessage::MSG_RAW_MOUSE_WHEEL ); msg->appendPixelArgument( m_currMouse.pos ); - msg->appendIntegerArgument( m_currMouse.wheelPos / 120 ); // wheel delta + // TheSuperHackers @bugfix Preserve wheel delta sign for touchpad scroll direction detection + const Int wheelTicks = m_currMouse.wheelPos / MOUSE_WHEEL_DELTA; + msg->appendIntegerArgument( m_currMouse.wheelPos > 0 ? max( 1, wheelTicks ) : min( -1, wheelTicks ) ); msg->appendIntegerArgument( TheKeyboard->getModifierFlags() ); }