mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-04 10:16:24 +02:00
* 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
94 lines
3.2 KiB
C++
94 lines
3.2 KiB
C++
#pragma once
|
|
|
|
#include "GuidUtils.h"
|
|
|
|
class WorkArea;
|
|
struct ZoneColors;
|
|
enum struct OverlappingZonesAlgorithm;
|
|
|
|
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).
|
|
*/
|
|
std::shared_ptr<WorkArea> GetWorkArea(const GUID& desktopId, HMONITOR monitor);
|
|
|
|
/**
|
|
* 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).
|
|
*/
|
|
std::shared_ptr<WorkArea> 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).
|
|
*/
|
|
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
|
|
* 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).
|
|
*/
|
|
const std::unordered_map<HMONITOR, std::shared_ptr<WorkArea>>& GetWorkAreasByDesktopId(const GUID& desktopId);
|
|
|
|
/**
|
|
* @returns All registered work areas.
|
|
*/
|
|
std::vector<std::shared_ptr<WorkArea>> GetAllWorkAreas();
|
|
|
|
/**
|
|
* Register new work area.
|
|
*
|
|
* @param[in] desktopId Virtual desktop identifier.
|
|
* @param[in] monitor Monitor handle.
|
|
* @param[in] workAra Object representing single work area.
|
|
*/
|
|
void AddWorkArea(const GUID& desktopId, HMONITOR monitor, std::shared_ptr<WorkArea>& workArea);
|
|
|
|
/**
|
|
* 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.
|
|
*/
|
|
void RegisterUpdates(const std::vector<GUID>& active);
|
|
|
|
/**
|
|
* Clear all persisted work area related data.
|
|
*/
|
|
void Clear();
|
|
|
|
private:
|
|
// Work area is uniquely defined by monitor and virtual desktop id.
|
|
std::unordered_map<GUID, std::unordered_map<HMONITOR, std::shared_ptr<WorkArea>>> workAreaMap;
|
|
};
|