From 9360c3f4fffcb107ff2ab3d1b09949a2b6b35f07 Mon Sep 17 00:00:00 2001 From: reuk Date: Mon, 13 Sep 2021 13:01:21 +0100 Subject: [PATCH] Windows: Fix issue where minimising a window could overwrite the last "normal" window bounds Previously, the following series of steps would leave the window at full-size on Windows: - Open a JUCE Window - Maximise it - Minimise it - Click the maximise button The expected behaviour is that the window should return to its initial size and position, but instead the window still fills the screen. This issue wasn't present on Ubuntu/Unity because minimising does not invoke ComponentPeer::handleMovedOrResized on that platform. It was not present on macOS because the system is responsible for restoring the previous window size on that platform. --- modules/juce_gui_basics/windows/juce_ComponentPeer.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp b/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp index 86966089de..a29c74a01b 100644 --- a/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp +++ b/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp @@ -322,7 +322,9 @@ void ComponentPeer::handleMovedOrResized() component.sendVisibilityChangeMessage(); } - if (! isFullScreen()) + const auto windowInSpecialState = isFullScreen() || isKioskMode() || nowMinimised; + + if (! windowInSpecialState) lastNonFullscreenBounds = component.getBounds(); }