From 05f1007dd95809d62ce54d66db149d8b406ace4c Mon Sep 17 00:00:00 2001 From: Cory Sanin Date: Sat, 2 Jul 2022 14:48:43 -0500 Subject: [PATCH] Fix #16989: Re-focusing maximised window triggers a restore and maximise Fixes #16989 by removing an SDL hack. Originally added to address issue #2158, I can't reproduce this issue with the hack removed. Tested on Linux (by CorySanin) and Windows (by Broxzier). --- distribution/changelog.txt | 1 + src/openrct2-ui/UiContext.cpp | 17 ----------------- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index e73c1eeb2e..50902fe8c5 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -25,6 +25,7 @@ - Fix: [#16799] Browsing “Up” in the Load Save window shows no files, only folders. - Fix: [#16934] Park size displayed incorrectly in Park window. - Fix: [#16974] Small scenery ghosts can be deleted. +- Fix: [#16989] Re-focusing maximised window triggers a restore and maximise. - Fix: [#17005] Unable to set patrol area for first staff member in park. - Fix: [#17017] [Plugin] Crash when using tile element properties that require a valid ride to be linked. - Fix: [#17073] Corrupt ride window and random crashes when trains have more than 144 cars. diff --git a/src/openrct2-ui/UiContext.cpp b/src/openrct2-ui/UiContext.cpp index 858fa3dd50..771a7ba45b 100644 --- a/src/openrct2-ui/UiContext.cpp +++ b/src/openrct2-ui/UiContext.cpp @@ -339,23 +339,6 @@ public: context_quit(); break; case SDL_WINDOWEVENT: - // HACK: Fix #2158, OpenRCT2 does not draw if it does not think that the window is - // visible - due a bug in SDL 2.0.3 this hack is required if the - // window is maximised, minimised and then restored again. - if (e.window.event == SDL_WINDOWEVENT_FOCUS_GAINED) - { - if (SDL_GetWindowFlags(_window) & SDL_WINDOW_MAXIMIZED) - { - SDL_RestoreWindow(_window); - SDL_MaximizeWindow(_window); - } - if ((SDL_GetWindowFlags(_window) & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP) - { - SDL_RestoreWindow(_window); - SDL_SetWindowFullscreen(_window, SDL_WINDOW_FULLSCREEN_DESKTOP); - } - } - if (e.window.event == SDL_WINDOWEVENT_SIZE_CHANGED) { OnResize(e.window.data1, e.window.data2);