mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 02:36:19 +02:00
[FancyZones] App zone history on multiple desktops (#3932)
* Remove app zone history belonging to deleted virtual desktop. * Implement support fancy zones app zone history on multiple desktops. * Break when device id is located to avoid unnecessary loop iterations. * Fix failing unit tests after JSONHelpers API changes. * Use valid UUIDs in json helper unit tests. * User properly formated test data in app zone history unit tests. * Don't delete entire app history when moving out of zone on one desktop.
This commit is contained in:
@@ -345,10 +345,10 @@ FancyZones::WindowCreated(HWND window) noexcept
|
||||
std::vector<int> zoneIndexSet = fancyZonesData.GetAppLastZoneIndexSet(window, zoneWindow->UniqueId(), guidString.get());
|
||||
if (zoneIndexSet.size() &&
|
||||
!IsSplashScreen(window) &&
|
||||
!fancyZonesData.IsAnotherWindowOfApplicationInstanceZoned(window))
|
||||
!fancyZonesData.IsAnotherWindowOfApplicationInstanceZoned(window, zoneWindow->UniqueId()))
|
||||
{
|
||||
m_windowMoveHandler.MoveWindowIntoZoneByIndexSet(window, zoneIndexSet, zoneWindow);
|
||||
fancyZonesData.UpdateProcessIdToHandleMap(window);
|
||||
fancyZonesData.UpdateProcessIdToHandleMap(window, zoneWindow->UniqueId());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -861,21 +861,11 @@ void FancyZones::RegisterVirtualDesktopUpdates(std::vector<GUID>& ids) noexcept
|
||||
{
|
||||
std::unique_lock writeLock(m_lock);
|
||||
|
||||
std::vector<GUID> deleted{};
|
||||
m_workAreaHandler.RegisterUpdates(ids, deleted);
|
||||
|
||||
bool modified{ false };
|
||||
for (const auto& id : deleted)
|
||||
m_workAreaHandler.RegisterUpdates(ids);
|
||||
std::vector<std::wstring> active{};
|
||||
if (VirtualDesktopUtils::GetVirtualDesktopIds(active))
|
||||
{
|
||||
wil::unique_cotaskmem_string virtualDesktopId;
|
||||
if (SUCCEEDED(StringFromCLSID(id, &virtualDesktopId)))
|
||||
{
|
||||
modified |= JSONHelpers::FancyZonesDataInstance().RemoveDevicesByVirtualDesktopId(virtualDesktopId.get());
|
||||
}
|
||||
}
|
||||
if (modified)
|
||||
{
|
||||
JSONHelpers::FancyZonesDataInstance().SaveFancyZonesData();
|
||||
JSONHelpers::FancyZonesDataInstance().RemoveDeletedDesktops(active);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user