How would I check if a window is (real) fullscreen without SDL_WINDOW_FULLSCREEN_DESKTOP? (it’s removed in SDL3)
There is still SDL_WINDOW_FULLSCREEN
. Isn’t that enough?
You’re right, I can check whether the window is fullscreen with that, but how would I check if it’s borderless or real fullscreen?
I don’t know, but the migration guide says
SDL_WINDOW_FULLSCREEN_DESKTOP has been removed, and you can call SDL_GetWindowFullscreenMode() to see whether an exclusive fullscreen mode will be used or the fullscreen desktop mode will be used when the window is fullscreen.
The docs for SDL_GetWindowFullscreenMode says
Returns a pointer to the fullscreen mode to use or NULL for desktop mode
Does this mean, if SDL_GetWindowFullscreenMode does not return NULL it uses (or will use) “real fullscreen” mode? I haven’t tested so I could be wrong.
I have tested, it always returns a pointer
Even after calling SDL_SetWindowFullscreenMode(window, NULL);
to request “desktop mode”?
upon double checking, I misremembered, it always returns NIL whether fullscreen or not
I think you still need to check the window flags to know whether it’s in fullscreen.
if (SDL_GetWindowFlags(window) & SDL_WINDOW_FULLSCREEN)
{
if (SDL_GetWindowFullscreenMode(window) != NULL)
{
printf("exclusive fullscreen mode"); // what you call "real fullscreen"
}
else
{
printf("desktop fullscreen mode");
}
}
else
{
printf("windowed mode");
}
I haven’t got SDL3 installed so I haven’t tested it but this is how I understand it.
It works! Thanks!