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:
cedi
2019-09-28 15:29:29 +01:00
committed by Enrico Giordani
parent a8f0d3298f
commit faf1fae873
7 changed files with 108 additions and 72 deletions

View File

@@ -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 };