Procházet zdrojové kódy

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.
Frank Praznik před 1 rokem
rodič
revize
2fa8acb084
1 změnil soubory, kde provedl 5 přidání a 0 odebrání
  1. 5 0
      src/video/x11/SDL_x11mouse.c

+ 5 - 0
src/video/x11/SDL_x11mouse.c

@@ -412,6 +412,11 @@ static bool X11_CaptureMouse(SDL_Window *window)
             if (rc != GrabSuccess) {
             if (rc != GrabSuccess) {
                 return SDL_SetError("X server refused mouse capture");
                 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) {
     } else if (mouse_focus) {
         SDL_UpdateWindowGrab(mouse_focus);
         SDL_UpdateWindowGrab(mouse_focus);