mirror of
https://github.com/dhewm/dhewm3.git
synced 2025-01-21 08:50:49 +00:00
SDL3: Fix detecting fullscreen mode
a SDL_SyncWindow() was missing, and the return value of SDL_SetWIndowFullscreen() has changed
This commit is contained in:
parent
01ea89ab3b
commit
08a8945bdf
1 changed files with 16 additions and 10 deletions
|
@ -429,7 +429,8 @@ try_again:
|
||||||
r_multiSamples.SetInteger(multisamples);
|
r_multiSamples.SetInteger(multisamples);
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle exclusive fullscreen mode
|
// handle exclusive fullscreen mode (windowed mode and fullscreen
|
||||||
|
// desktop were set when creating the window)
|
||||||
// TODO: just call GLimp_SetScreenParms() ?
|
// TODO: just call GLimp_SetScreenParms() ?
|
||||||
if (parms.fullScreen && !parms.fullScreenDesktop) {
|
if (parms.fullScreen && !parms.fullScreenDesktop) {
|
||||||
SDL_DisplayID displayID = SDL_GetDisplayForWindow( window );
|
SDL_DisplayID displayID = SDL_GetDisplayForWindow( window );
|
||||||
|
@ -450,14 +451,6 @@ try_again:
|
||||||
window = NULL;
|
window = NULL;
|
||||||
return false; // trying other color depth etc is unlikely to help with this issue
|
return false; // trying other color depth etc is unlikely to help with this issue
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! SDL_SyncWindow(window) ) {
|
|
||||||
common->Warning("SDL_SyncWindow() failed: %s\n", SDL_GetError());
|
|
||||||
SDL_DestroyWindow(window);
|
|
||||||
window = NULL;
|
|
||||||
return false; // trying other color depth etc is unlikely to help with this issue
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
common->Warning("Can't get display mode: %s\n", SDL_GetError());
|
common->Warning("Can't get display mode: %s\n", SDL_GetError());
|
||||||
SDL_DestroyWindow(window);
|
SDL_DestroyWindow(window);
|
||||||
|
@ -466,6 +459,13 @@ try_again:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( ! SDL_SyncWindow(window) ) {
|
||||||
|
common->Warning("SDL_SyncWindow() failed: %s\n", SDL_GetError());
|
||||||
|
SDL_DestroyWindow(window);
|
||||||
|
window = NULL;
|
||||||
|
return false; // trying other color depth etc is unlikely to help with this issue
|
||||||
|
}
|
||||||
|
|
||||||
#else // SDL2
|
#else // SDL2
|
||||||
window = SDL_CreateWindow(ENGINE_VERSION,
|
window = SDL_CreateWindow(ENGINE_VERSION,
|
||||||
SDL_WINDOWPOS_UNDEFINED_DISPLAY(selectedDisplay),
|
SDL_WINDOWPOS_UNDEFINED_DISPLAY(selectedDisplay),
|
||||||
|
@ -797,7 +797,13 @@ bool GLimp_SetScreenParms(glimpParms_t parms) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !parms.fullScreen ) { // we want windowed mode
|
if ( !parms.fullScreen ) { // we want windowed mode
|
||||||
if ( curState.fullScreen && SDL_SetWindowFullscreen( window, 0 ) != 0 ) {
|
if ( curState.fullScreen &&
|
||||||
|
#if SDL_VERSION_ATLEAST(3, 0, 0)
|
||||||
|
SDL_SetWindowFullscreen( window, 0 ) == false
|
||||||
|
#else
|
||||||
|
SDL_SetWindowFullscreen( window, 0 ) != 0
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
common->Warning( "GLimp_SetScreenParms(): Couldn't switch to windowed mode, SDL error: %s\n", SDL_GetError() );
|
common->Warning( "GLimp_SetScreenParms(): Couldn't switch to windowed mode, SDL error: %s\n", SDL_GetError() );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue