-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cursor not constrained to window when using SDL_SetRelativeMouseMode
and another game is running
#7890
Comments
SDL_SetRelativeMouseMode
on WindowsSDL_SetRelativeMouseMode
and another game is running
Interesting. It doesn't happen here on the same code and version of OS. It's very possible that World of Tanks is resetting the Windows cursor clip rectangle while in the background. That would be a bug in the game, and would definitely interfere with this test. |
Try running this autoit script in the background instead of World of Tank and see if it recreates the behavior: opt('guioneventmode',1)
guicreate('')
guisetstate()
guisetonevent(-3,quit)
while sleep(1000)
dllcall('user32.dll','bool','ClipCursor','struct*',Null)
wend
func quit()
exit
endfunc A workaround would be to run |
This is exactly it. I've run the C# equivalent of @expikr's SDL will update the ClipCursor every 3 seconds, so it can recover if an external app (accidentally) sets it to the wrong value once. |
I'm eager to close this issue as "not SDL's problem", but I think adding logging would be helpful for pointing the blame onto other running programs. Something like "ClipCursor rect changed unexpectedly (is another program changing it?). Resetting to expected location," |
SDL/include/SDL3/SDL_mouse.h
Lines 200 to 217 in fb0c319
When using relative mode, I would expect the cursor to be constrained to the window. But it appears this is not the case on windows.
Repro steps
testwm.exe
, I'm usingtestwm.exe --resizable --geometry 1150x900 --title testwm.exe
to have a bigger window for convenienceMOUSE_FOCUS
window flag will remain set, even if the mouse is outside the window (unlike when not using relative mode)2023-06-29.21-09-41.remuxed.mp4
I'm using PowerToys Mouse pointer Crosshairs to show where the actual OS mouse position is. Maybe this can aid debugging of this issue.
Environment
main
: 4d23eafEdit: the bug seems to only happen if World of Tanks is open in the background. Could this invalidate the issue?
The text was updated successfully, but these errors were encountered: