win32u: Directly access system DPI in ntgdi.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2021-12-06 03:10:15 +01:00 committed by Alexandre Julliard
parent 3570b09133
commit 338179ae34
4 changed files with 8 additions and 20 deletions

View File

@ -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;

View File

@ -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
*/

View File

@ -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;

View File

@ -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,