mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 03:37:59 +01:00
[FancyZones] Clone parent data only for new VD (#7116)
* [FancyZones] Clone parent data only for new VD
This commit is contained in:
@@ -171,7 +171,7 @@ std::optional<FancyZonesDataTypes::CustomZoneSetData> FancyZonesData::FindCustom
|
|||||||
return it != end(customZoneSetsMap) ? std::optional{ it->second } : std::nullopt;
|
return it != end(customZoneSetsMap) ? std::optional{ it->second } : std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FancyZonesData::AddDevice(const std::wstring& deviceId)
|
bool FancyZonesData::AddDevice(const std::wstring& deviceId)
|
||||||
{
|
{
|
||||||
using namespace FancyZonesDataTypes;
|
using namespace FancyZonesDataTypes;
|
||||||
|
|
||||||
@@ -192,7 +192,11 @@ void FancyZonesData::AddDevice(const std::wstring& deviceId)
|
|||||||
{
|
{
|
||||||
deviceInfoMap[deviceId] = DeviceInfoData{ ZoneSetData{ NonLocalizable::NullStr, ZoneSetLayoutType::Blank } };
|
deviceInfoMap[deviceId] = DeviceInfoData{ ZoneSetData{ NonLocalizable::NullStr, ZoneSetLayoutType::Blank } };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FancyZonesData::CloneDeviceInfo(const std::wstring& source, const std::wstring& destination)
|
void FancyZonesData::CloneDeviceInfo(const std::wstring& source, const std::wstring& destination)
|
||||||
@@ -209,7 +213,6 @@ void FancyZonesData::CloneDeviceInfo(const std::wstring& source, const std::wstr
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clone information from source device if destination device is uninitialized (Blank).
|
|
||||||
deviceInfoMap[destination] = deviceInfoMap[source];
|
deviceInfoMap[destination] = deviceInfoMap[source];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ public:
|
|||||||
return appZoneHistoryMap;
|
return appZoneHistoryMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddDevice(const std::wstring& deviceId);
|
bool AddDevice(const std::wstring& deviceId);
|
||||||
void CloneDeviceInfo(const std::wstring& source, const std::wstring& destination);
|
void CloneDeviceInfo(const std::wstring& source, const std::wstring& destination);
|
||||||
void UpdatePrimaryDesktopData(const std::wstring& desktopId);
|
void UpdatePrimaryDesktopData(const std::wstring& desktopId);
|
||||||
void RemoveDeletedDesktops(const std::vector<std::wstring>& activeDesktops);
|
void RemoveDeletedDesktops(const std::vector<std::wstring>& activeDesktops);
|
||||||
|
|||||||
@@ -443,9 +443,9 @@ ZoneWindow::ClearSelectedZones() noexcept
|
|||||||
|
|
||||||
void ZoneWindow::InitializeZoneSets(const std::wstring& parentUniqueId) noexcept
|
void ZoneWindow::InitializeZoneSets(const std::wstring& parentUniqueId) noexcept
|
||||||
{
|
{
|
||||||
// If there is not defined zone layout for this work area, created default entry.
|
bool deviceAdded = FancyZonesDataInstance().AddDevice(m_uniqueId);
|
||||||
FancyZonesDataInstance().AddDevice(m_uniqueId);
|
// If the device has been added, check if it should inherit the parent's layout
|
||||||
if (!parentUniqueId.empty())
|
if (deviceAdded && !parentUniqueId.empty())
|
||||||
{
|
{
|
||||||
FancyZonesDataInstance().CloneDeviceInfo(parentUniqueId, m_uniqueId);
|
FancyZonesDataInstance().CloneDeviceInfo(parentUniqueId, m_uniqueId);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user