Jacek Caban : win32u: Directly access system DPI in ntgdi.
Alexandre Julliard
julliard at winehq.org
Mon Dec 6 16:07:59 CST 2021
Module: wine
Branch: master
Commit: 338179ae34029ecfea2d4705fa164f258567c6c7
URL: https://source.winehq.org/git/wine.git/?a=commit;h=338179ae34029ecfea2d4705fa164f258567c6c7
Author: Jacek Caban <jacek at codeweavers.com>
Date: Mon Dec 6 03:10:15 2021 +0100
win32u: Directly access system DPI in ntgdi.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/win32u/gdiobj.c | 10 ----------
dlls/win32u/sysparams.c | 7 +++++++
dlls/win32u/win32u_private.h | 2 +-
dlls/win32u/wrappers.c | 9 ---------
4 files changed, 8 insertions(+), 20 deletions(-)
diff --git a/dlls/win32u/gdiobj.c b/dlls/win32u/gdiobj.c
index 796ae460a17..768bf3a89db 100644
--- a/dlls/win32u/gdiobj.c
+++ b/dlls/win32u/gdiobj.c
@@ -572,16 +572,6 @@ BOOL GDI_dec_ref_count( HGDIOBJ handle )
}
-/******************************************************************************
- * get_system_dpi
- *
- * Get the system DPI, based on the DPI awareness mode.
- */
-DWORD get_system_dpi(void)
-{
- return user_callbacks ? user_callbacks->pGetDpiForSystem() : 96;
-}
-
static HFONT create_font( const LOGFONTW *deffont )
{
ENUMLOGFONTEXDVW lf;
diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c
index 8efe17aed3c..f8e462ed2a8 100644
--- a/dlls/win32u/sysparams.c
+++ b/dlls/win32u/sysparams.c
@@ -1395,6 +1395,13 @@ static UINT get_thread_dpi(void)
}
}
+/* see GetDpiForSystem */
+UINT get_system_dpi(void)
+{
+ if (get_thread_dpi_awareness() == DPI_AWARENESS_UNAWARE) return USER_DEFAULT_SCREEN_DPI;
+ return system_dpi;
+}
+
/**********************************************************************
* map_dpi_rect
*/
diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h
index 1182902921f..ac560d54b9e 100644
--- a/dlls/win32u/win32u_private.h
+++ b/dlls/win32u/win32u_private.h
@@ -33,7 +33,6 @@
struct user_callbacks
{
HWND (WINAPI *pGetDesktopWindow)(void);
- UINT (WINAPI *pGetDpiForSystem)(void);
BOOL (WINAPI *pGetMonitorInfoW)( HMONITOR, LPMONITORINFO );
INT (WINAPI *pGetSystemMetrics)(INT);
BOOL (WINAPI *pGetWindowRect)( HWND hwnd, LPRECT rect );
@@ -241,6 +240,7 @@ struct unix_funcs
struct window_surface *surface );
};
+extern UINT get_system_dpi(void) DECLSPEC_HIDDEN;
extern RECT get_virtual_screen_rect(void) DECLSPEC_HIDDEN;
extern void wrappers_init( unixlib_handle_t handle ) DECLSPEC_HIDDEN;
diff --git a/dlls/win32u/wrappers.c b/dlls/win32u/wrappers.c
index d482c71375d..559044d69ff 100644
--- a/dlls/win32u/wrappers.c
+++ b/dlls/win32u/wrappers.c
@@ -940,14 +940,6 @@ static HWND WINAPI call_GetDesktopWindow(void)
return pGetDesktopWindow ? pGetDesktopWindow() : NULL;
}
-static UINT WINAPI call_GetDpiForSystem(void)
-{
- static UINT (WINAPI *pGetDpiForSystem)(void);
- if (!pGetDpiForSystem)
- pGetDpiForSystem = get_user_proc( "GetDpiForSystem", FALSE );
- return pGetDpiForSystem ? pGetDpiForSystem() : 96;
-}
-
static BOOL WINAPI call_GetMonitorInfoW( HMONITOR monitor, MONITORINFO *info )
{
static BOOL (WINAPI *pGetMonitorInfoW)( HMONITOR, LPMONITORINFO );
@@ -1000,7 +992,6 @@ static HWND WINAPI call_WindowFromDC( HDC hdc )
static const struct user_callbacks user_funcs =
{
call_GetDesktopWindow,
- call_GetDpiForSystem,
call_GetMonitorInfoW,
call_GetSystemMetrics,
call_GetWindowRect,
More information about the wine-cvs
mailing list