From 7f083d3604a7a3305f0b79ee974064d7272c4687 Mon Sep 17 00:00:00 2001 From: Jamiras <32680403+Jamiras@users.noreply.github.com> Date: Sat, 16 Dec 2023 09:07:22 -0700 Subject: [PATCH] prevent window resizing when toggling fullscreen (#391) --- src/Application.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Application.cpp b/src/Application.cpp index 8b6a55a..7b2e5d2 100644 --- a/src/Application.cpp +++ b/src/Application.cpp @@ -2165,14 +2165,15 @@ void Application::resizeWindow(int width, int height) void Application::toggleFullscreen() { Uint32 fullscreen = SDL_GetWindowFlags(_window) & SDL_WINDOW_FULLSCREEN_DESKTOP; - SDL_SetWindowFullscreen(_window, fullscreen ^ SDL_WINDOW_FULLSCREEN_DESKTOP); - if (fullscreen) { SetMenu(g_mainWindow, _menu); SDL_ShowCursor(SDL_ENABLE); } - else + + SDL_SetWindowFullscreen(_window, fullscreen ^ SDL_WINDOW_FULLSCREEN_DESKTOP); + + if (!fullscreen) { SetMenu(g_mainWindow, NULL); SDL_ShowCursor(SDL_DISABLE);