[FancyZones] Resizing non visible windows with hide attribute (#21565)

* Fix for issue microsoft#19440
Resizing non visible windows with attribute hide to avoid re-appearing

* Simplifying code
This commit is contained in:
Laszlo Nemeth
2022-11-16 10:20:02 +01:00
committed by GitHub
parent 2fca99e3c5
commit 6d9d4a7112

View File

@@ -318,6 +318,12 @@ void FancyZonesWindowUtils::SizeWindowToRect(HWND window, RECT rect) noexcept
::GetWindowPlacement(window, &placement); ::GetWindowPlacement(window, &placement);
} }
if (!IsWindowVisible(window))
{
placement.showCmd = SW_HIDE;
}
else
{
// Do not restore minimized windows. We change their placement though so they restore to the correct zone. // Do not restore minimized windows. We change their placement though so they restore to the correct zone.
if ((placement.showCmd != SW_SHOWMINIMIZED) && if ((placement.showCmd != SW_SHOWMINIMIZED) &&
(placement.showCmd != SW_MINIMIZE)) (placement.showCmd != SW_MINIMIZE))
@@ -331,6 +337,7 @@ void FancyZonesWindowUtils::SizeWindowToRect(HWND window, RECT rect) noexcept
placement.showCmd = SW_RESTORE; placement.showCmd = SW_RESTORE;
placement.flags &= ~WPF_RESTORETOMAXIMIZED; placement.flags &= ~WPF_RESTORETOMAXIMIZED;
} }
}
ScreenToWorkAreaCoords(window, rect); ScreenToWorkAreaCoords(window, rect);