From 69ec0322d3d82d542b19320b8faa70ca801ab586 Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Mon, 18 Dec 2023 11:47:59 -0500 Subject: [PATCH] win32: Make leaving fullscreen when the window already isn't fullscreen a no-op Otherwise, the styling on external windows may end up being overridden. --- src/video/windows/SDL_windowswindow.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/video/windows/SDL_windowswindow.c b/src/video/windows/SDL_windowswindow.c index 7bb9a11679..07f6c9a2f0 100644 --- a/src/video/windows/SDL_windowswindow.c +++ b/src/video/windows/SDL_windowswindow.c @@ -1083,6 +1083,13 @@ int WIN_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Window *window, SDL_Vide SDL_Log("WIN_SetWindowFullscreen: %d", (int)fullscreen); #endif + /* Early out if already not in fullscreen, or the styling on + * external windows may end up being overridden. + */ + if (!(window->flags & SDL_WINDOW_FULLSCREEN) && !fullscreen) { + return 0; + } + if (SDL_ShouldAllowTopmost() && (window->flags & SDL_WINDOW_ALWAYS_ON_TOP)) { top = HWND_TOPMOST; } else {