mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 19:26:39 +02:00
[FancyZones] Revisit mutexes (#12240)
* [FancyZones] Clean up (#11893) * [FancyZones] Virtual desktop utils refactoring (#11925) * [FancyZones] IFancyZonesCallback refactoring (#11932) * [FancyZones] IZoneWindowHost refactoring (#12091) * [FancyZones] Rename ZoneWindow -> WorkArea (#12223) * [FancyZones] Clean up mutexes (#12228)
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
interface IZoneWindow;
|
||||
interface IWorkArea;
|
||||
struct ZoneColors;
|
||||
enum struct OverlappingZonesAlgorithm;
|
||||
|
||||
namespace std
|
||||
{
|
||||
@@ -27,7 +29,7 @@ public:
|
||||
* @returns Object representing single work area, interface to all actions available on work area
|
||||
* (e.g. moving windows through zone layout specified for that work area).
|
||||
*/
|
||||
winrt::com_ptr<IZoneWindow> GetWorkArea(const GUID& desktopId, HMONITOR monitor);
|
||||
winrt::com_ptr<IWorkArea> GetWorkArea(const GUID& desktopId, HMONITOR monitor);
|
||||
|
||||
/**
|
||||
* Get work area based on virtual desktop id and the current cursor position.
|
||||
@@ -37,17 +39,18 @@ public:
|
||||
* @returns Object representing single work area, interface to all actions available on work area
|
||||
* (e.g. moving windows through zone layout specified for that work area).
|
||||
*/
|
||||
winrt::com_ptr<IZoneWindow> GetWorkAreaFromCursor(const GUID& desktopId);
|
||||
winrt::com_ptr<IWorkArea> GetWorkAreaFromCursor(const GUID& desktopId);
|
||||
|
||||
/**
|
||||
* Get work area on which specified window is located.
|
||||
*
|
||||
* @param[in] window Window handle.
|
||||
*
|
||||
* @param[in] desktopId GUID current desktop id
|
||||
*
|
||||
* @returns Object representing single work area, interface to all actions available on work area
|
||||
* (e.g. moving windows through zone layout specified for that work area).
|
||||
*/
|
||||
winrt::com_ptr<IZoneWindow> GetWorkArea(HWND window);
|
||||
winrt::com_ptr<IWorkArea> GetWorkArea(HWND window, const GUID& desktopId);
|
||||
|
||||
/**
|
||||
* Get map of all work areas on single virtual desktop. Key in the map is monitor handle, while value
|
||||
@@ -57,12 +60,12 @@ public:
|
||||
*
|
||||
* @returns Map containing pairs of monitor and work area for that monitor (within same virtual desktop).
|
||||
*/
|
||||
const std::unordered_map<HMONITOR, winrt::com_ptr<IZoneWindow>>& GetWorkAreasByDesktopId(const GUID& desktopId);
|
||||
const std::unordered_map<HMONITOR, winrt::com_ptr<IWorkArea>>& GetWorkAreasByDesktopId(const GUID& desktopId);
|
||||
|
||||
/**
|
||||
* @returns All registered work areas.
|
||||
*/
|
||||
std::vector<winrt::com_ptr<IZoneWindow>> GetAllWorkAreas();
|
||||
std::vector<winrt::com_ptr<IWorkArea>> GetAllWorkAreas();
|
||||
|
||||
/**
|
||||
* Register new work area.
|
||||
@@ -71,7 +74,7 @@ public:
|
||||
* @param[in] monitor Monitor handle.
|
||||
* @param[in] workAra Object representing single work area.
|
||||
*/
|
||||
void AddWorkArea(const GUID& desktopId, HMONITOR monitor, winrt::com_ptr<IZoneWindow>& workArea);
|
||||
void AddWorkArea(const GUID& desktopId, HMONITOR monitor, winrt::com_ptr<IWorkArea>& workArea);
|
||||
|
||||
/**
|
||||
* Check if work area is already registered.
|
||||
@@ -95,7 +98,17 @@ public:
|
||||
*/
|
||||
void Clear();
|
||||
|
||||
/**
|
||||
* Update zone colors after settings changed
|
||||
*/
|
||||
void UpdateZoneColors(const ZoneColors& colors);
|
||||
|
||||
/**
|
||||
* Update overlapping algorithm after settings changed
|
||||
*/
|
||||
void UpdateOverlappingAlgorithm(OverlappingZonesAlgorithm overlappingAlgorithm);
|
||||
|
||||
private:
|
||||
// Work area is uniquely defined by monitor and virtual desktop id.
|
||||
std::unordered_map<GUID, std::unordered_map<HMONITOR, winrt::com_ptr<IZoneWindow>>> workAreaMap;
|
||||
std::unordered_map<GUID, std::unordered_map<HMONITOR, winrt::com_ptr<IWorkArea>>> workAreaMap;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user