From fb563978d815f74786bf25baa0bf4c4362595dd6 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Thu, 19 Apr 2018 10:47:18 +0200 Subject: [PATCH] user32: Implement GetDpiForWindow(). Signed-off-by: Alexandre Julliard --- dlls/user32/sysparams.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/dlls/user32/sysparams.c b/dlls/user32/sysparams.c index 8c5dd0add22..715bf595b92 100644 --- a/dlls/user32/sysparams.c +++ b/dlls/user32/sysparams.c @@ -3313,8 +3313,21 @@ BOOL WINAPI GetDpiForMonitorInternal( HMONITOR monitor, UINT type, UINT *x, UINT */ UINT WINAPI GetDpiForWindow( HWND hwnd ) { - FIXME( "stub: %p\n", hwnd ); - return GetDpiForSystem(); + UINT dpi; + + switch (GetAwarenessFromDpiAwarenessContext( GetWindowDpiAwarenessContext( hwnd ))) + { + case DPI_AWARENESS_UNAWARE: + return USER_DEFAULT_SCREEN_DPI; + case DPI_AWARENESS_SYSTEM_AWARE: + return get_system_dpi(); + case DPI_AWARENESS_PER_MONITOR_AWARE: + GetDpiForMonitorInternal( MonitorFromWindow( hwnd, MONITOR_DEFAULTTOPRIMARY ), + 0 /* MDT_EFFECTIVE_DPI */, &dpi, NULL ); + return dpi; + default: + return 0; + } } /********************************************************************** -- 2.11.4.GIT