[FancyZones] Update windows positions after changing the layout fix (#18805)

* removed IWorkArea interface

* split work area initialization

* changed rect type in zoneset

* tests


upd work area tests
removed obsolete, update others
updated work area tests

* get current vd windows

* update windows positions

* removed unused flag

* moved update window positions to work area

* check monitor

* refactoring
This commit is contained in:
Seraphima Zykova
2022-06-14 16:45:45 +02:00
committed by GitHub
parent e8bb2de8b6
commit f5f8861eac
13 changed files with 319 additions and 509 deletions

View File

@@ -2,7 +2,7 @@
#include "GuidUtils.h"
interface IWorkArea;
class WorkArea;
struct ZoneColors;
enum struct OverlappingZonesAlgorithm;
@@ -18,7 +18,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<IWorkArea> GetWorkArea(const GUID& desktopId, HMONITOR monitor);
std::shared_ptr<WorkArea> GetWorkArea(const GUID& desktopId, HMONITOR monitor);
/**
* Get work area based on virtual desktop id and the current cursor position.
@@ -28,7 +28,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<IWorkArea> GetWorkAreaFromCursor(const GUID& desktopId);
std::shared_ptr<WorkArea> GetWorkAreaFromCursor(const GUID& desktopId);
/**
* Get work area on which specified window is located.
@@ -39,7 +39,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<IWorkArea> GetWorkArea(HWND window, const GUID& desktopId);
std::shared_ptr<WorkArea> 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
@@ -49,12 +49,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<IWorkArea>>& GetWorkAreasByDesktopId(const GUID& desktopId);
const std::unordered_map<HMONITOR, std::shared_ptr<WorkArea>>& GetWorkAreasByDesktopId(const GUID& desktopId);
/**
* @returns All registered work areas.
*/
std::vector<winrt::com_ptr<IWorkArea>> GetAllWorkAreas();
std::vector<std::shared_ptr<WorkArea>> GetAllWorkAreas();
/**
* Register new work area.
@@ -63,7 +63,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<IWorkArea>& workArea);
void AddWorkArea(const GUID& desktopId, HMONITOR monitor, std::shared_ptr<WorkArea>& workArea);
/**
* Check if work area is already registered.
@@ -89,5 +89,5 @@ public:
private:
// Work area is uniquely defined by monitor and virtual desktop id.
std::unordered_map<GUID, std::unordered_map<HMONITOR, winrt::com_ptr<IWorkArea>>> workAreaMap;
std::unordered_map<GUID, std::unordered_map<HMONITOR, std::shared_ptr<WorkArea>>> workAreaMap;
};