Treat a button press location as an implicit mouse move

This fixes having the incorrect location for mouse button presses on Steam Deck under gamescope. This works around a bug where the mouse motion appears to come at the next button press, and comes from the xwayland-pointer device instead of the xwayland-relative-pointer device which is delivering mouse button events.
This commit is contained in:
Sam Lantinga
2024-10-15 22:25:47 -07:00
parent e5fa929245
commit cbbad4051b

View File

@@ -894,6 +894,13 @@ void X11_HandleButtonPress(SDL_VideoDevice *_this, SDL_WindowData *windowdata, S
#ifdef DEBUG_XEVENTS
SDL_Log("window 0x%lx: ButtonPress (X11 button = %d)\n", windowdata->xwindow, button);
#endif
SDL_Mouse *mouse = SDL_GetMouse();
if ((!mouse->relative_mode || mouse->relative_mode_warp) && (x != mouse->x || y != mouse->y)) {
X11_ProcessHitTest(_this, windowdata, x, y, false);
SDL_SendMouseMotion(0, window, mouseID, false, x, y);
}
if (X11_IsWheelEvent(display, button, &xticks, &yticks)) {
SDL_SendMouseWheel(0, window, mouseID, (float)-xticks, (float)yticks, SDL_MOUSEWHEEL_NORMAL);
} else {