mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 03:36:44 +02:00
[FancyZones] Editor multi monitor support (#6562)
Co-authored-by: Enrico Giordani <enrico.giordani@gmail.com> Co-authored-by: Enrico Giordani <enricogior@users.noreply.github.com>
This commit is contained in:
@@ -3,6 +3,11 @@
|
||||
#include "gdiplus.h"
|
||||
#include <common/string_utils.h>
|
||||
|
||||
namespace FancyZonesDataTypes
|
||||
{
|
||||
struct DeviceIdData;
|
||||
}
|
||||
|
||||
namespace FancyZonesUtils
|
||||
{
|
||||
struct Rect
|
||||
@@ -131,6 +136,28 @@ namespace FancyZonesUtils
|
||||
return result;
|
||||
}
|
||||
|
||||
template<RECT MONITORINFO::*member>
|
||||
std::vector<std::pair<HMONITOR, MONITORINFOEX>> GetAllMonitorInfo()
|
||||
{
|
||||
using result_t = std::vector<std::pair<HMONITOR, MONITORINFOEX>>;
|
||||
result_t result;
|
||||
|
||||
auto enumMonitors = [](HMONITOR monitor, HDC hdc, LPRECT pRect, LPARAM param) -> BOOL {
|
||||
MONITORINFOEX mi;
|
||||
mi.cbSize = sizeof(mi);
|
||||
result_t& result = *reinterpret_cast<result_t*>(param);
|
||||
if (GetMonitorInfo(monitor, &mi))
|
||||
{
|
||||
result.push_back({ monitor, mi });
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
};
|
||||
|
||||
EnumDisplayMonitors(NULL, NULL, enumMonitors, reinterpret_cast<LPARAM>(&result));
|
||||
return result;
|
||||
}
|
||||
|
||||
template<RECT MONITORINFO::*member>
|
||||
RECT GetAllMonitorsCombinedRect()
|
||||
{
|
||||
@@ -157,8 +184,6 @@ namespace FancyZonesUtils
|
||||
return result;
|
||||
}
|
||||
|
||||
std::wstring ParseDeviceId(const std::wstring& deviceId);
|
||||
|
||||
UINT GetDpiForMonitor(HMONITOR monitor) noexcept;
|
||||
void OrderMonitors(std::vector<std::pair<HMONITOR, RECT>>& monitorInfo);
|
||||
void SizeWindowToRect(HWND window, RECT rect) noexcept;
|
||||
@@ -174,6 +199,13 @@ namespace FancyZonesUtils
|
||||
void RestoreWindowOrigin(HWND window) noexcept;
|
||||
|
||||
bool IsValidGuid(const std::wstring& str);
|
||||
|
||||
std::wstring GenerateUniqueId(HMONITOR monitor, const std::wstring& devideId, const std::wstring& virtualDesktopId);
|
||||
std::wstring GenerateUniqueIdAllMonitorsArea(const std::wstring& virtualDesktopId);
|
||||
std::optional<std::wstring> GenerateMonitorId(MONITORINFOEX mi, HMONITOR monitor, const GUID& virtualDesktopId);
|
||||
|
||||
std::wstring TrimDeviceId(const std::wstring& deviceId);
|
||||
std::optional<FancyZonesDataTypes::DeviceIdData> ParseDeviceId(const std::wstring& deviceId);
|
||||
bool IsValidDeviceId(const std::wstring& str);
|
||||
|
||||
RECT PrepareRectForCycling(RECT windowRect, RECT zoneWindowRect, DWORD vkCode) noexcept;
|
||||
|
||||
Reference in New Issue
Block a user