Skip to content

Commit c141bf6

Browse files
slipherillwieckz
authored andcommitted
Fix SDL_SetWindowFullscreen error checking
Missed spot from SDL 3 migration. Both the fullscreen argument (changed from flags to bool) and the return value (changed to bool) were wrong. The flags mistake was harmless as it converted to the correct bool value, but the error checking was unreachable.
1 parent adf2981 commit c141bf6

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

src/engine/sys/sdl_glimp.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -988,10 +988,7 @@ static bool GLimp_RecreateWindowWhenChange( const bool fullscreen, const bool bo
988988

989989
if ( fullscreen != currentFullscreen )
990990
{
991-
Uint32 flags = fullscreen ? SDL_WINDOW_FULLSCREEN : 0;
992-
int sdlToggled = SDL_SetWindowFullscreen( window, flags );
993-
994-
if ( sdlToggled < 0 )
991+
if ( !SDL_SetWindowFullscreen( window, fullscreen ) )
995992
{
996993
GLimp_DestroyWindowIfExists();
997994

@@ -2914,7 +2911,6 @@ void GLimp_HandleCvars()
29142911

29152912
if ( Util::optional<bool> wantFullscreen = r_fullscreen.GetModifiedValue() )
29162913
{
2917-
int sdlToggled = false;
29182914
bool needToToggle = true;
29192915
bool fullscreen = !!( SDL_GetWindowFlags( window ) & SDL_WINDOW_FULLSCREEN );
29202916

@@ -2923,10 +2919,7 @@ void GLimp_HandleCvars()
29232919

29242920
if ( needToToggle )
29252921
{
2926-
Uint32 flags = *wantFullscreen ? SDL_WINDOW_FULLSCREEN : 0;
2927-
sdlToggled = SDL_SetWindowFullscreen( window, flags );
2928-
2929-
if ( sdlToggled < 0 )
2922+
if ( !SDL_SetWindowFullscreen( window, *wantFullscreen ) )
29302923
{
29312924
Log::Warn( "SDL_SetWindowFullscreen failed: %s", SDL_GetError() );
29322925
Log::Warn( "Trying vid_restart" );

0 commit comments

Comments
 (0)