From 4200de66ee68b7e6c9d2972cef703602c8631e1b Mon Sep 17 00:00:00 2001 From: sithlord48 Date: Tue, 3 Feb 2026 09:10:05 -0500 Subject: [PATCH] fix: scroll Issue on X11 by not checking for wheel in mapButtonToX --- src/lib/deskflow/MouseTypes.h | 4 ++++ src/lib/platform/XWindowsScreen.cpp | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/lib/deskflow/MouseTypes.h b/src/lib/deskflow/MouseTypes.h index 22cbd17df..77cbbe8e0 100644 --- a/src/lib/deskflow/MouseTypes.h +++ b/src/lib/deskflow/MouseTypes.h @@ -26,6 +26,10 @@ static const ButtonID kButtonExtra1 = 5; static const ButtonID kMacButtonRight = 2; static const ButtonID kMacButtonMiddle = 3; + +// Only used for X11 Scroll Wheel +static const ButtonID kX11ScrollWheelUp = 255; +static const ButtonID kX11ScrollWheelDown = 254; //@} static const uint8_t NumButtonIDs = 6; diff --git a/src/lib/platform/XWindowsScreen.cpp b/src/lib/platform/XWindowsScreen.cpp index 4e708e25e..2fe48ba25 100644 --- a/src/lib/platform/XWindowsScreen.cpp +++ b/src/lib/platform/XWindowsScreen.cpp @@ -800,7 +800,7 @@ void XWindowsScreen::fakeMouseWheel(int32_t, int32_t yDelta) const yDelta = mapClientScrollDirection(yDelta); // choose button depending on rotation direction - const unsigned int xButton = mapButtonToX(static_cast((yDelta >= 0) ? -1 : -2)); + const unsigned int xButton = mapButtonToX(yDelta >= 0 ? kX11ScrollWheelUp : kX11ScrollWheelDown); if (xButton == 0) { // If we get here, then the XServer does not support the scroll // wheel buttons, so send PageUp/PageDown keystrokes instead. @@ -1764,6 +1764,10 @@ unsigned int XWindowsScreen::mapButtonToX(ButtonID id) const case kButtonRight: case kButtonMiddle: return static_cast(id); + case kX11ScrollWheelUp: + return 4; + case kX11ScrollWheelDown: + return 5; case kButtonExtra0: return 8; case kButtonExtra1: