From b19d708a6820a5657bfc4be1275cef7eca6e0cc0 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Tue, 12 May 2020 22:30:37 +0200 Subject: [PATCH] Workaround maximized+fullscreen on Windows On Windows, in maximized+fullscreen state, disabling fullscreen mode unexpectedly triggers the "restored" then "maximized" events, leaving the window in a weird state (maximized according to the events, but not maximized visually). Moreover, apply_pending_resize() asserts that fullscreen is disabled. To avoid the issue, if fullscreen is set, just ignore the "restored" event. --- app/src/screen.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/src/screen.c b/app/src/screen.c index 5c1c0a93b6..869ae0e0db 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -531,6 +531,13 @@ screen_handle_window_event(struct screen *screen, screen->maximized = true; break; case SDL_WINDOWEVENT_RESTORED: + if (screen->fullscreen) { + // On Windows, in maximized+fullscreen, disabling fullscreen + // mode unexpectedly triggers the "restored" then "maximized" + // events, leaving the window in a weird state (maximized + // according to the events, but not maximized visually). + break; + } screen->maximized = false; apply_pending_resize(screen); break;