video: Don't resize moved fullscreen windows if the display mode switch failed

If an exclusive fullscreen window is moved between displays, SDL_UpdateFullscrrenMode can kick the window out of fullscreen if the display onto which it was moved doesn't have a matching video mode. Check the return code and clear the fullscreen flag and skip the resize if the window is no longer fullscreen.
main
Frank Praznik 2023-01-22 15:10:22 -05:00 committed by Sam Lantinga
parent 8f8746cc1b
commit 34bb0735d8
1 changed files with 6 additions and 1 deletions

View File

@ -2930,7 +2930,12 @@ void SDL_OnWindowDisplayChanged(SDL_Window *window)
if (FULLSCREEN_VISIBLE(window) && (window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != SDL_WINDOW_FULLSCREEN_DESKTOP) {
window->last_fullscreen_flags = 0;
SDL_UpdateFullscreenMode(window, SDL_TRUE);
if (SDL_UpdateFullscreenMode(window, SDL_TRUE) != 0) {
/* Something went wrong and the window is no longer fullscreen. */
window->flags &= ~FULLSCREEN_MASK;
return;
}
}
/*