From c7dff3a22ebd93aca0873d7a81b790de8518aefc Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 19 May 2022 00:35:22 -0700 Subject: [PATCH] Attempt to get the X1 and X2 button state on X11 by using the current event state instead of direct X11 query. --- src/video/x11/SDL_x11mouse.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/video/x11/SDL_x11mouse.c b/src/video/x11/SDL_x11mouse.c index ecc6c7cdc..ed29288c6 100644 --- a/src/video/x11/SDL_x11mouse.c +++ b/src/video/x11/SDL_x11mouse.c @@ -406,6 +406,8 @@ X11_GetGlobalMouseState(int *x, int *y) buttons |= (mask & Button1Mask) ? SDL_BUTTON_LMASK : 0; buttons |= (mask & Button2Mask) ? SDL_BUTTON_MMASK : 0; buttons |= (mask & Button3Mask) ? SDL_BUTTON_RMASK : 0; + /* Use the SDL state for the extended buttons - it's better than nothing */ + buttons |= (SDL_GetMouseState(NULL, NULL) & (SDL_BUTTON_X1MASK|SDL_BUTTON_X2MASK)); /* SDL_DisplayData->x,y point to screen origin, and adding them to mouse coordinates relative to root window doesn't do the right thing * (observed on dual monitor setup with primary display being the rightmost one - mouse was offset to the right). *