mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 03:07:04 +02:00
[FancyZones] Fix updating window position after switching virtual desktop (#22072)
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user