engine: platform: sdl: borderless fullscreen windows don't need to restore desktop resolution

* This fixes the case when we switch from windowed to borderless, minimize the window
  and restore makes it lose it's fullscreen state
This commit is contained in:
Alibek Omarov 2024-08-16 12:25:05 +03:00
parent 7619824d80
commit 70e11cc309

View file

@ -641,9 +641,17 @@ void VID_RestoreScreenResolution( void )
switch((window_mode_t)vid_fullscreen.value ) switch((window_mode_t)vid_fullscreen.value )
{ {
case WINDOW_MODE_WINDOWED: case WINDOW_MODE_WINDOWED:
// TODO: this line is from very old SDL video backend
// figure out why we need it, because in windowed mode we
// always have borders
SDL_SetWindowBordered( host.hWnd, SDL_TRUE ); SDL_SetWindowBordered( host.hWnd, SDL_TRUE );
break; break;
default: case WINDOW_MODE_BORDERLESS:
// in borderless fullscreen we don't change screen resolution, so no-op
break;
case WINDOW_MODE_FULLSCREEN:
// TODO: we might want to not minimize window if current desktop mode
// and window mode are the same
SDL_MinimizeWindow( host.hWnd ); SDL_MinimizeWindow( host.hWnd );
SDL_SetWindowFullscreen( host.hWnd, 0 ); SDL_SetWindowFullscreen( host.hWnd, 0 );
break; break;