Module: wine Branch: master Commit: fb563978d815f74786bf25baa0bf4c4362595dd6 URL: https://source.winehq.org/git/wine.git/?a=commit;h=fb563978d815f74786bf25baa...
Author: Alexandre Julliard julliard@winehq.org Date: Thu Apr 19 10:47:18 2018 +0200
user32: Implement GetDpiForWindow().
Signed-off-by: Alexandre Julliard julliard@winehq.org
---
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 8c5dd0a..715bf59 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; + } }
/**********************************************************************