[KBM] scale editor window size based on DPI (#11006)

This commit is contained in:
Enrico Giordani
2021-04-29 08:39:12 -07:00
committed by GitHub
parent d2ec89a0ca
commit 5efb3d3a61
4 changed files with 19 additions and 4 deletions

View File

@@ -51,6 +51,19 @@ namespace DPIAware
}
}
void ConvertByCursorPosition(int& width, int& height)
{
HMONITOR targetMonitor = nullptr;
POINT currentCursorPos{};
if (GetCursorPos(&currentCursorPos))
{
targetMonitor = MonitorFromPoint(currentCursorPos, MONITOR_DEFAULTTOPRIMARY);
}
Convert(targetMonitor, width, height);
}
void InverseConvert(HMONITOR monitor_handle, int& width, int& height)
{
if (monitor_handle == NULL)

View File

@@ -10,6 +10,7 @@ namespace DPIAware
HRESULT GetScreenDPIForWindow(HWND hwnd, UINT& dpi_x, UINT& dpi_y);
HRESULT GetScreenDPIForPoint(POINT p, UINT& dpi_x, UINT& dpi_y);
void Convert(HMONITOR monitor_handle, int& width, int& height);
void ConvertByCursorPosition(int& width, int& height);
void InverseConvert(HMONITOR monitor_handle, int& width, int& height);
void EnableDPIAwarenessForThisProcess();