mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 18:57:19 +02:00
Modifying the startup behaviour of the FancyZones Layout Editor
Add setting to allow to choose if the FZ editor opens in the screen where mouse cursor is or where the active windows is.
This commit is contained in:
@@ -14,6 +14,18 @@ HRESULT DPIAware::GetScreenDPIForWindow(HWND hwnd, UINT &dpi_x, UINT &dpi_y) {
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT DPIAware::GetScreenDPIForPoint(POINT p, UINT& dpi_x, UINT& dpi_y) {
|
||||
auto monitor_handle = MonitorFromPoint(p, MONITOR_DEFAULTTONEAREST);
|
||||
dpi_x = 0;
|
||||
dpi_y = 0;
|
||||
if (monitor_handle != nullptr) {
|
||||
return GetDpiForMonitor(monitor_handle, MDT_EFFECTIVE_DPI, &dpi_x, &dpi_y);
|
||||
}
|
||||
else {
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
void DPIAware::Convert(HMONITOR monitor_handle, int &width, int &height) {
|
||||
if (monitor_handle == NULL) {
|
||||
const POINT ptZero = { 0, 0 };
|
||||
|
||||
@@ -7,5 +7,6 @@ private:
|
||||
|
||||
public:
|
||||
static HRESULT GetScreenDPIForWindow(HWND hwnd, UINT & dpi_x, UINT & dpi_y);
|
||||
static HRESULT GetScreenDPIForPoint(POINT p, UINT& dpi_x, UINT& dpi_y);
|
||||
static void Convert(HMONITOR monitor_handle, int &width, int &height);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user