From 2fa8acb08422f799ff1e2485fd69fe165574c574 Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Sun, 6 Oct 2024 14:33:01 -0400 Subject: [PATCH] x11: Refresh the global cursor coordinates when confining the pointer XGrabPointer can warp the cursor into the window when confining, so set the flag to refresh the global coordinates when queried. --- src/video/x11/SDL_x11mouse.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/video/x11/SDL_x11mouse.c b/src/video/x11/SDL_x11mouse.c index decd763963..8a366ad589 100644 --- a/src/video/x11/SDL_x11mouse.c +++ b/src/video/x11/SDL_x11mouse.c @@ -412,6 +412,11 @@ static bool X11_CaptureMouse(SDL_Window *window) if (rc != GrabSuccess) { return SDL_SetError("X server refused mouse capture"); } + + if (data->mouse_grabbed) { + // XGrabPointer can warp the cursor when confining, so update the coordinates. + data->videodata->global_mouse_changed = true; + } } } else if (mouse_focus) { SDL_UpdateWindowGrab(mouse_focus);