Alt-tab to return to window breaks mouse capture

While in OpenGL CURSOR_DISABLE mode, either through GLFW or Raylib:

glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
DisableCursor();

Upon returning to the window with Alt-Tab, this mode is functionally broken:

  • With GLFW, the cursor still re-centers each frame, but a fast mouse movement can still cause the cursor to temporarily leave the bounds of the window
  • With Raylib, the cursor both can leave the window and no longer auto-centers (except upon moving the cursor into the window), and needs to be auto-centered each frame to achieve the same result as with GLFW

OpenGL games not coded by me, namely Half Life 1, capture the cursor just fine after alt-tabbing.

System: x86_64 CachyOS/Arch (up-to-date)
Kernel: 7.2.8-2-cachyos
Desktop: Cinnamon (X11) 6.6.9
GPU: RTX 2060 (TU106) using nvidia-580.178.04 firmware
OpenGL: 4.6.0
Raylib: 6.1-dev, raylib-d 6.0.1
GLFWL: 3.5.1, targeting OpenGL 3.3

I’ve run into similar mouse-capture issues with Alt-Tab in fullscreen OpenGL apps. The GLFW behavior you described is interesting, especially since older games handle the recapture more reliably. I’d check whether X11 or the window manager is affecting cursor confinement after focus is restored.