mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 11:16:51 +02:00
[FancyZones] Reset zone settings after restart fix. (#13322)
* updated virtual desktop retrieving * save with null-guid * moved guid utils * moved DeviceIdData related functions * replaced strings with data structs * default value * clean up * save app zone history with zones settings * compare with null guid * updated tests * refactoring * logs * sync vd ids * logs * refactoring * check virtual desktop id * OnDisplayChange call * compare device ids in editor
This commit is contained in:
@@ -9,15 +9,36 @@ public:
|
||||
VirtualDesktop(const std::function<void()>& vdInitCallback, const std::function<void()>& vdUpdatedCallback);
|
||||
~VirtualDesktop() = default;
|
||||
|
||||
inline bool IsVirtualDesktopIdSavedInRegistry(GUID id) const
|
||||
{
|
||||
auto ids = GetVirtualDesktopIdsFromRegistry();
|
||||
if (!ids.has_value())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (const auto& regId : *ids)
|
||||
{
|
||||
if (regId == id)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void Init();
|
||||
void UnInit();
|
||||
|
||||
std::optional<GUID> GetWindowDesktopId(HWND topLevelWindow) const;
|
||||
std::optional<GUID> GetCurrentVirtualDesktopId() const;
|
||||
std::optional<std::vector<GUID>> GetVirtualDesktopIds() const;
|
||||
std::optional<GUID> GetCurrentVirtualDesktopIdFromRegistry() const;
|
||||
std::optional<std::vector<GUID>> GetVirtualDesktopIdsFromRegistry() const;
|
||||
|
||||
bool IsWindowOnCurrentDesktop(HWND window) const;
|
||||
std::optional<GUID> GetDesktopId(HWND window) const;
|
||||
std::optional<GUID> GetDesktopIdByTopLevelWindows() const;
|
||||
|
||||
std::vector<std::pair<HWND, GUID>> GetWindowsRelatedToDesktops() const;
|
||||
|
||||
private:
|
||||
std::function<void()> m_vdInitCallback;
|
||||
@@ -28,7 +49,6 @@ private:
|
||||
OnThreadExecutor m_virtualDesktopTrackerThread;
|
||||
wil::unique_handle m_terminateVirtualDesktopTrackerEvent;
|
||||
|
||||
std::optional<std::vector<GUID>> GetVirtualDesktopIds(HKEY hKey) const;
|
||||
std::optional<GUID> GetDesktopIdByTopLevelWindows() const;
|
||||
std::optional<std::vector<GUID>> GetVirtualDesktopIdsFromRegistry(HKEY hKey) const;
|
||||
void HandleVirtualDesktopUpdates();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user