[FancyZones] Fix updating window position after switching virtual desktop (#22072)

This commit is contained in:
Seraphima Zykova
2022-11-22 17:58:22 +01:00
committed by GitHub
parent e160e223f0
commit ef8415ddfe
5 changed files with 15 additions and 14 deletions

View File

@@ -201,7 +201,7 @@ void WorkArea::MoveWindowIntoZoneByIndex(HWND window, ZoneIndex index) noexcept
MoveWindowIntoZoneByIndexSet(window, { index });
}
void WorkArea::MoveWindowIntoZoneByIndexSet(HWND window, const ZoneIndexSet& indexSet) noexcept
void WorkArea::MoveWindowIntoZoneByIndexSet(HWND window, const ZoneIndexSet& indexSet, bool updatePosition /* = true*/) noexcept
{
if (!m_layout || !m_layoutWindows || m_layout->Zones().empty() || indexSet.empty())
{
@@ -209,10 +209,14 @@ void WorkArea::MoveWindowIntoZoneByIndexSet(HWND window, const ZoneIndexSet& ind
}
FancyZonesWindowUtils::SaveWindowSizeAndOrigin(window);
auto rect = m_layout->GetCombinedZonesRect(indexSet);
auto adjustedRect = FancyZonesWindowUtils::AdjustRectForSizeWindowToRect(window, rect, m_window);
FancyZonesWindowUtils::SizeWindowToRect(window, adjustedRect);
if (updatePosition)
{
auto rect = m_layout->GetCombinedZonesRect(indexSet);
auto adjustedRect = FancyZonesWindowUtils::AdjustRectForSizeWindowToRect(window, rect, m_window);
FancyZonesWindowUtils::SizeWindowToRect(window, adjustedRect);
}
m_layoutWindows->Assign(window, indexSet);
FancyZonesWindowProperties::StampZoneIndexProperty(window, indexSet);