SDL_SetWindowFullscreen freezes on Windows

I’m porting a project from Linux to Windows (working on Windows 11), and one of the issues I’m working on is that calls to SDL_SetWindowFullscreen freeze, making the app unresponsive. This happens with SDL_WINDOW_FULLSCREEN_DESKTOP as well as SDL_WINDOW_FULLSCREEN, although the latter seems to change display mode before freezing, rendering other apps on my system in letterbox.

The same code works fine on Linux/X11. And in some cases, when the call the SDL_SetWindowFullscreen is very early (I think before any events are handled), everything seems to work fine. It’s only if I try to toggle fullscreen on or off after initial setup. This makes me wonder if I need to re-initialize the the window on Windows (though I couldn’t find anything in the documentation along those lines).

I’ve followed the debugger down to a call to SetWindowLong in the Windows APIs, and this function never returns. I’ll look into that function as well, but in the meantime, is there anything I might be misunderstanding about how to use SDL_SetWindowFullscreen?

Thanks for reading, and any help/info :slight_smile:

I just made a debug UI to toggle fullscreen through a different code path, and everything works fine, so it’s definitely an issue in my code somewhere.

Sorry for the noise. Any thoughts on what conditions might cause this behavior sometimes would still be appreciated. Thanks again.

1 Like

I’ve solved it. I was trying to call SDL_SetWindowFullscreen from a thread that wasn’t the thread where the window was created.

Again, sorry for the noise. :slight_smile:

1 Like