Splash dialog and main window handle dpi change notifications.

This commit is contained in:
Bart House
2018-12-02 18:09:34 -08:00
parent 796bdce828
commit f3dcdc7fda
7 changed files with 134 additions and 85 deletions

View File

@@ -45,17 +45,6 @@ void win10_init()
}
void win10_monitor_size(HWND hWnd, int * width, int * height)
{
HMONITOR monitor = MonitorFromWindow(hWnd, MONITOR_DEFAULTTONEAREST);
MONITORINFO info;
info.cbSize = sizeof(MONITORINFO);
BOOL success = GetMonitorInfo(monitor, &info);
nhassert(success);
*width = info.rcMonitor.right - info.rcMonitor.left;
*height = info.rcMonitor.bottom - info.rcMonitor.top;
}
int win10_monitor_dpi(HWND hWnd)
{
UINT monitorDpi = 96;
@@ -79,5 +68,14 @@ double win10_monitor_scale(HWND hWnd)
void win10_monitor_info(HWND hWnd, MonitorInfo * monitorInfo)
{
monitorInfo->scale = win10_monitor_scale(hWnd);
win10_monitor_size(hWnd, &monitorInfo->width, &monitorInfo->height);
HMONITOR monitor = MonitorFromWindow(hWnd, MONITOR_DEFAULTTONEAREST);
MONITORINFO info;
info.cbSize = sizeof(MONITORINFO);
BOOL success = GetMonitorInfo(monitor, &info);
nhassert(success);
monitorInfo->width = info.rcMonitor.right - info.rcMonitor.left;
monitorInfo->height = info.rcMonitor.bottom - info.rcMonitor.top;
monitorInfo->left = info.rcMonitor.left;
monitorInfo->top = info.rcMonitor.top;
}

View File

@@ -23,6 +23,8 @@ typedef struct {
double scale; // dpi of monitor / 96
int width; // in pixels
int height; // in pixels
int top; // in desktop coordinate pixel space
int left; // in desktop coordinate pixel space
} MonitorInfo;
extern Win10 gWin10;