mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 20:27:36 +02:00
Don't restore minimized windows after layout is updated (#5603)
This commit is contained in:
@@ -124,21 +124,22 @@ void SizeWindowToRect(HWND window, RECT rect) noexcept
|
|||||||
WINDOWPLACEMENT placement{};
|
WINDOWPLACEMENT placement{};
|
||||||
::GetWindowPlacement(window, &placement);
|
::GetWindowPlacement(window, &placement);
|
||||||
|
|
||||||
//wait if SW_SHOWMINIMIZED would be removed from window (Issue #1685)
|
// Wait if SW_SHOWMINIMIZED would be removed from window (Issue #1685)
|
||||||
for (int i = 0; i < 5 && (placement.showCmd & SW_SHOWMINIMIZED) != 0; i++)
|
for (int i = 0; i < 5 && (placement.showCmd == SW_SHOWMINIMIZED); ++i)
|
||||||
{
|
{
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||||
::GetWindowPlacement(window, &placement);
|
::GetWindowPlacement(window, &placement);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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) == 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.
|
// 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.showCmd = SW_RESTORE;
|
||||||
placement.flags &= ~WPF_RESTORETOMAXIMIZED;
|
placement.flags &= ~WPF_RESTORETOMAXIMIZED;
|
||||||
|
|||||||
Reference in New Issue
Block a user