mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 03:07:04 +02:00
[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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user