2020-05-31 12:36:45 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
2021-09-23 00:39:48 +03:00
|
|
|
#include "GuidUtils.h"
|
|
|
|
|
|
2022-06-14 16:45:45 +02:00
|
|
|
class WorkArea;
|
2021-07-07 13:18:52 +03:00
|
|
|
struct ZoneColors;
|
|
|
|
|
enum struct OverlappingZonesAlgorithm;
|
2020-05-31 12:36:45 +02:00
|
|
|
|
|
|
|
|
class MonitorWorkAreaHandler
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
/**
|
|
|
|
|
* Get work area based on virtual desktop id and monitor handle.
|
|
|
|
|
*
|
|
|
|
|
* @param[in] desktopId Virtual desktop identifier.
|
|
|
|
|
* @param[in] monitor Monitor handle.
|
|
|
|
|
*
|
|
|
|
|
* @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).
|
|
|
|
|
*/
|
2022-06-14 16:45:45 +02:00
|
|
|
std::shared_ptr<WorkArea> GetWorkArea(const GUID& desktopId, HMONITOR monitor);
|
2020-05-31 12:36:45 +02:00
|
|
|
|
2021-03-25 15:44:55 +03:00
|
|
|
/**
|
|
|
|
|
* Get work area based on virtual desktop id and the current cursor position.
|
|
|
|
|
*
|
|
|
|
|
* @param[in] desktopId Virtual desktop identifier.
|
|
|
|
|
*
|
|
|
|
|
* @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).
|
|
|
|
|
*/
|
2022-06-14 16:45:45 +02:00
|
|
|
std::shared_ptr<WorkArea> GetWorkAreaFromCursor(const GUID& desktopId);
|
2021-03-25 15:44:55 +03:00
|
|
|
|
2020-05-31 12:36:45 +02:00
|
|
|
/**
|
|
|
|
|
* Get work area on which specified window is located.
|
|
|
|
|
*
|
|
|
|
|
* @param[in] window Window handle.
|
2021-07-07 13:18:52 +03:00
|
|
|
* @param[in] desktopId GUID current desktop id
|
|
|
|
|
*
|
2020-05-31 12:36:45 +02:00
|
|
|
* @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).
|
|
|
|
|
*/
|
2022-06-14 16:45:45 +02:00
|
|
|
std::shared_ptr<WorkArea> GetWorkArea(HWND window, const GUID& desktopId);
|
2020-05-31 12:36:45 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get map of all work areas on single virtual desktop. Key in the map is monitor handle, while value
|
|
|
|
|
* represents single work area.
|
|
|
|
|
*
|
|
|
|
|
* @param[in] desktopId Virtual desktop identifier.
|
|
|
|
|
*
|
|
|
|
|
* @returns Map containing pairs of monitor and work area for that monitor (within same virtual desktop).
|
|
|
|
|
*/
|
2022-06-14 16:45:45 +02:00
|
|
|
const std::unordered_map<HMONITOR, std::shared_ptr<WorkArea>>& GetWorkAreasByDesktopId(const GUID& desktopId);
|
2020-05-31 12:36:45 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @returns All registered work areas.
|
|
|
|
|
*/
|
2022-06-14 16:45:45 +02:00
|
|
|
std::vector<std::shared_ptr<WorkArea>> GetAllWorkAreas();
|
2020-05-31 12:36:45 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Register new work area.
|
|
|
|
|
*
|
|
|
|
|
* @param[in] desktopId Virtual desktop identifier.
|
|
|
|
|
* @param[in] monitor Monitor handle.
|
|
|
|
|
* @param[in] workAra Object representing single work area.
|
|
|
|
|
*/
|
2022-06-14 16:45:45 +02:00
|
|
|
void AddWorkArea(const GUID& desktopId, HMONITOR monitor, std::shared_ptr<WorkArea>& workArea);
|
2020-05-31 12:36:45 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Check if work area is already registered.
|
|
|
|
|
*
|
|
|
|
|
* @param[in] desktopId Virtual desktop identifier.
|
|
|
|
|
* @param[in] monitor Monitor handle.
|
|
|
|
|
*
|
|
|
|
|
* @returns Boolean indicating whether work area defined by virtual desktop id and monitor is already registered.
|
|
|
|
|
*/
|
|
|
|
|
bool IsNewWorkArea(const GUID& desktopId, HMONITOR monitor);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Register changes in current virtual desktop layout.
|
|
|
|
|
*
|
|
|
|
|
* @param[in] active Array of currently active virtual desktop identifiers.
|
|
|
|
|
*/
|
2020-06-05 17:25:52 +02:00
|
|
|
void RegisterUpdates(const std::vector<GUID>& active);
|
2020-05-31 12:36:45 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Clear all persisted work area related data.
|
|
|
|
|
*/
|
|
|
|
|
void Clear();
|
2021-07-07 13:18:52 +03:00
|
|
|
|
2020-05-31 12:36:45 +02:00
|
|
|
private:
|
|
|
|
|
// Work area is uniquely defined by monitor and virtual desktop id.
|
2022-06-14 16:45:45 +02:00
|
|
|
std::unordered_map<GUID, std::unordered_map<HMONITOR, std::shared_ptr<WorkArea>>> workAreaMap;
|
2020-05-31 12:36:45 +02:00
|
|
|
};
|