libsdl-org / sdl2-compat

An SDL2 compatibility layer that uses SDL3 behind the scenes.
zlib License
65 stars 17 forks source link

Handle distinction between full-screen and full-screen desktop #153

Closed cgutman closed 3 months ago

cgutman commented 3 months ago

The existing code would always enter full-screen exclusive mode if SDL_SetWindowDisplayMode() was called before SDL_SetWindowFullscreen(), even if the flag value was SDL_WINDOW_FULLSCREEN_DESKTOP.

Likewise, the code would always enter full-screen desktop mode if SDL_SetWindowDisplayMode() wasn't called, even if the caller passed SDL_WINDOW_FULLSCREEN to ask for full-screen exclusive mode.

Since SDL3 uses the presence of a full-screen mode to tell whether to use full-screen exclusive or full-screen desktop mode, we will stash the provided display mode in a property until we know whether the caller actually wants modesetting or not.

While I was here modifying this code, I also fixed some SDL3_GetPrimaryDisplay() calls that should have been using SDL3_GetDisplayForWindow() instead.