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: