fix: scroll Issue on X11 by not checking for wheel in mapButtonToX

This commit is contained in:
sithlord48
2026-02-03 09:10:05 -05:00
committed by Chris Rizzitello
parent be4e861604
commit 4200de66ee
2 changed files with 9 additions and 1 deletions

View File

@ -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;

View File

@ -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<ButtonID>((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<uint>(id);
case kX11ScrollWheelUp:
return 4;
case kX11ScrollWheelDown:
return 5;
case kButtonExtra0:
return 8;
case kButtonExtra1: