Skip to content

Commit

Permalink
[FancyZones] App zone history on multiple desktops (#3932)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
vldmr11080 committed Jun 5, 2020
1 parent 8410d7b commit b0b2d3a
Show file tree
Hide file tree
Showing 7 changed files with 433 additions and 211 deletions.
22 changes: 6 additions & 16 deletions src/modules/fancyzones/lib/FancyZones.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
}
Expand Down Expand Up @@ -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)
{
wil::unique_cotaskmem_string virtualDesktopId;
if (SUCCEEDED(StringFromCLSID(id, &virtualDesktopId)))
{
modified |= JSONHelpers::FancyZonesDataInstance().RemoveDevicesByVirtualDesktopId(virtualDesktopId.get());
}
}
if (modified)
m_workAreaHandler.RegisterUpdates(ids);
std::vector<std::wstring> active{};
if (VirtualDesktopUtils::GetVirtualDesktopIds(active))
{
JSONHelpers::FancyZonesDataInstance().SaveFancyZonesData();
JSONHelpers::FancyZonesDataInstance().RemoveDeletedDesktops(active);
}
}

Expand Down

0 comments on commit b0b2d3a

Please sign in to comment.