From eb189ceaab80433f682e847ab5d297edde3c52a6 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Fri, 15 May 2020 18:53:43 +0200 Subject: [PATCH] Disable "resize to fit" in maximized state In maximized state (but not fullscreen), it was possible to resize to fit the device screen (with Ctrl+x or double-clicking on black borders). This caused problems on macOS with the "expand to fullscreen" feature, which behaves like a fullscreen mode but is seen as maximized by SDL. In that state, resizing to fit causes unexpected results. To keep the behavior consistent on all platforms, just disable "resize to fit" when the window is maximized. --- app/src/screen.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/app/src/screen.c b/app/src/screen.c index 869ae0e0db..314b47bae0 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -484,15 +484,10 @@ screen_switch_fullscreen(struct screen *screen) { void screen_resize_to_fit(struct screen *screen) { - if (screen->fullscreen) { + if (screen->fullscreen || screen->maximized) { return; } - if (screen->maximized) { - SDL_RestoreWindow(screen->window); - screen->maximized = false; - } - struct size optimal_size = get_optimal_window_size(screen, screen->content_size); SDL_SetWindowSize(screen->window, optimal_size.width, optimal_size.height);