From 34bb0735d830e99b3f7bff68a3277986ebce7df1 Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Sun, 22 Jan 2023 15:10:22 -0500 Subject: [PATCH] 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. --- src/video/SDL_video.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index c44efc6cef..3aaa3e811f 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -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; + } } /*