[FancyZones]Fix snap by hotkey for single-zone layouts (#22373)

* unsnap window from previous work area when snapping by hotkey
This commit is contained in:
Seraphima Zykova
2022-12-02 13:29:11 +03:00
committed by GitHub
parent a7bd0cfde8
commit eca77ad8b3
5 changed files with 30 additions and 5 deletions

View File

@@ -808,6 +808,15 @@ bool FancyZones::OnSnapHotkeyBasedOnZoneNumber(HWND window, DWORD vkCode) noexce
auto workArea = m_workAreaHandler.GetWorkArea(VirtualDesktop::instance().GetCurrentVirtualDesktopId(), *currMonitorInfo);
if (m_windowMoveHandler.MoveWindowIntoZoneByDirectionAndIndex(window, vkCode, false /* cycle through zones */, workArea))
{
// unassign from previous work area
for (auto& prevWorkArea : m_workAreaHandler.GetAllWorkAreas())
{
if (workArea != prevWorkArea)
{
prevWorkArea->UnsnapWindow(window);
}
}
Trace::FancyZones::KeyboardSnapWindowToZone(workArea->GetLayout().get(), workArea->GetLayoutWindows().get());
return true;
}