FancyZones: handle minimized windows correctly (#986)

This commit is contained in:
Bartosz Sosnowski 2019-12-19 16:36:24 +01:00 committed by GitHub
parent db5f1622bd
commit 6ee848b279
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -105,11 +105,15 @@ void Zone::SizeWindowToZone(HWND window, HWND zoneWindow) noexcept
}
}
WINDOWPLACEMENT placement;
WINDOWPLACEMENT placement{};
::GetWindowPlacement(window, &placement);
placement.rcNormalPosition = zoneRect;
placement.flags |= WPF_ASYNCWINDOWPLACEMENT;
placement.showCmd = SW_RESTORE | SW_SHOWNA;
// Do not restore minimized windows. We change their placement though so they restore to the correct zone.
if ((placement.showCmd & SW_SHOWMINIMIZED) == 0)
{
placement.showCmd = SW_RESTORE | SW_SHOWNA;
}
::SetWindowPlacement(window, &placement);
}