mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 20:27:36 +02:00
[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:
@@ -318,18 +318,25 @@ void FancyZonesWindowUtils::SizeWindowToRect(HWND window, RECT rect) noexcept
|
|||||||
::GetWindowPlacement(window, &placement);
|
::GetWindowPlacement(window, &placement);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not restore minimized windows. We change their placement though so they restore to the correct zone.
|
if (!IsWindowVisible(window))
|
||||||
if ((placement.showCmd != SW_SHOWMINIMIZED) &&
|
|
||||||
(placement.showCmd != SW_MINIMIZE))
|
|
||||||
{
|
{
|
||||||
placement.showCmd = SW_RESTORE;
|
placement.showCmd = SW_HIDE;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
// Remove maximized show command to make sure window is moved to the correct zone.
|
|
||||||
if (placement.showCmd == SW_SHOWMAXIMIZED)
|
|
||||||
{
|
{
|
||||||
placement.showCmd = SW_RESTORE;
|
// Do not restore minimized windows. We change their placement though so they restore to the correct zone.
|
||||||
placement.flags &= ~WPF_RESTORETOMAXIMIZED;
|
if ((placement.showCmd != SW_SHOWMINIMIZED) &&
|
||||||
|
(placement.showCmd != SW_MINIMIZE))
|
||||||
|
{
|
||||||
|
placement.showCmd = SW_RESTORE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove maximized show command to make sure window is moved to the correct zone.
|
||||||
|
if (placement.showCmd == SW_SHOWMAXIMIZED)
|
||||||
|
{
|
||||||
|
placement.showCmd = SW_RESTORE;
|
||||||
|
placement.flags &= ~WPF_RESTORETOMAXIMIZED;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ScreenToWorkAreaCoords(window, rect);
|
ScreenToWorkAreaCoords(window, rect);
|
||||||
|
|||||||
Reference in New Issue
Block a user