From 1d8ca28152f3b9d205b92782dc288b1509b6cbf6 Mon Sep 17 00:00:00 2001 From: vldmr11080 <57061786+vldmr11080@users.noreply.github.com> Date: Thu, 6 Aug 2020 16:22:47 +0200 Subject: [PATCH] Don't restore minimized windows after layout is updated (#5603) --- src/modules/fancyzones/lib/util.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/modules/fancyzones/lib/util.cpp b/src/modules/fancyzones/lib/util.cpp index eb21a10b87..d6a1052c63 100644 --- a/src/modules/fancyzones/lib/util.cpp +++ b/src/modules/fancyzones/lib/util.cpp @@ -124,21 +124,22 @@ void SizeWindowToRect(HWND window, RECT rect) noexcept WINDOWPLACEMENT placement{}; ::GetWindowPlacement(window, &placement); - //wait if SW_SHOWMINIMIZED would be removed from window (Issue #1685) - for (int i = 0; i < 5 && (placement.showCmd & SW_SHOWMINIMIZED) != 0; i++) + // Wait if SW_SHOWMINIMIZED would be removed from window (Issue #1685) + for (int i = 0; i < 5 && (placement.showCmd == SW_SHOWMINIMIZED); ++i) { std::this_thread::sleep_for(std::chrono::milliseconds(100)); ::GetWindowPlacement(window, &placement); } // Do not restore minimized windows. We change their placement though so they restore to the correct zone. - if ((placement.showCmd & SW_SHOWMINIMIZED) == 0) + if ((placement.showCmd != SW_SHOWMINIMIZED) && + (placement.showCmd != SW_MINIMIZE)) { - placement.showCmd = SW_RESTORE | SW_SHOWNA; + placement.showCmd = SW_RESTORE; } // Remove maximized show command to make sure window is moved to the correct zone. - if (placement.showCmd & SW_SHOWMAXIMIZED) + if (placement.showCmd == SW_SHOWMAXIMIZED) { placement.showCmd = SW_RESTORE; placement.flags &= ~WPF_RESTORETOMAXIMIZED;