mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 18:57:19 +02:00
[FancyZones Editor] Quick layout switch hotkeys (#10437)
Co-authored-by: Ivan Stošić <ivan100sic@gmail.com>
This commit is contained in:
@@ -17,6 +17,27 @@ winrt::com_ptr<IZoneWindow> MonitorWorkAreaHandler::GetWorkArea(const GUID& desk
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
winrt::com_ptr<IZoneWindow> MonitorWorkAreaHandler::GetWorkAreaFromCursor(const GUID& desktopId)
|
||||
{
|
||||
auto allMonitorsWorkArea = GetWorkArea(desktopId, NULL);
|
||||
if (allMonitorsWorkArea)
|
||||
{
|
||||
// First, check if there's a work area spanning all monitors (signalled by the NULL monitor handle)
|
||||
return allMonitorsWorkArea;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Otherwise, look for the work area based on cursor position
|
||||
POINT cursorPoint;
|
||||
if (!GetCursorPos(&cursorPoint))
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return GetWorkArea(desktopId, MonitorFromPoint(cursorPoint, MONITOR_DEFAULTTONULL));
|
||||
}
|
||||
}
|
||||
|
||||
winrt::com_ptr<IZoneWindow> MonitorWorkAreaHandler::GetWorkArea(HWND window)
|
||||
{
|
||||
GUID desktopId{};
|
||||
|
||||
Reference in New Issue
Block a user