engine: platform: sdl2: fix fullscreen mode not fullscreening

This commit is contained in:
Alibek Omarov
2025-12-14 01:01:59 +03:00
parent f9e82170ac
commit 4a16ca8bc0
2 changed files with 11 additions and 4 deletions

View File

@@ -183,7 +183,7 @@ static void VID_Mode_f( void )
vidmode = R_GetVideoMode( Q_atoi( Cmd_Argv( 1 )) );
if( !vidmode )
{
Con_Printf( S_ERROR "unable to set mode, backend returned null" );
Con_Printf( S_ERROR "unable to set mode, backend returned null\n" );
return;
}

View File

@@ -490,11 +490,18 @@ static qboolean VID_SetScreenResolution( int width, int height, window_mode_t wi
return false;
}
if( SDL_SetWindowFullscreen( host.hWnd, SDL_WINDOW_FULLSCREEN ) < 0 )
if( prev_window_mode != WINDOW_MODE_FULLSCREEN )
{
Con_Printf( S_ERROR "%s: SDL_SetWindowFullscreen (fullscreen): %s\n", __func__, SDL_GetError( ));
return false;
if( SDL_SetWindowFullscreen( host.hWnd, SDL_WINDOW_FULLSCREEN ) < 0 )
{
Con_Printf( S_ERROR "%s: SDL_SetWindowFullscreen (fullscreen): %s\n", __func__, SDL_GetError( ));
return false;
}
}
// SDL_SetWindowDisplayMode is broken in SDL2, it changes the display mode but doesn't change window size
SDL_SetWindowSize( host.hWnd, got.w, got.h );
break;
}
case WINDOW_MODE_WINDOWED: