Commit 4ca8d676 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Directly use sysparams in nulldrv_GetDeviceCaps.

parent fdf30158
......@@ -83,28 +83,6 @@ const struct gdi_dc_funcs *get_display_driver(void)
return &user_driver->dc_funcs;
}
struct monitor_info
{
const WCHAR *name;
RECT rect;
};
static BOOL CALLBACK monitor_enum_proc( HMONITOR monitor, HDC hdc, LPRECT rect, LPARAM lparam )
{
struct monitor_info *info = (struct monitor_info *)lparam;
MONITORINFOEXW mi;
mi.cbSize = sizeof(mi);
user_callbacks->pGetMonitorInfoW( monitor, (MONITORINFO *)&mi );
if (!wcsicmp( info->name, mi.szDevice ))
{
info->rect = mi.rcMonitor;
return FALSE;
}
return TRUE;
}
static INT CDECL nulldrv_AbortDoc( PHYSDEV dev )
{
return 0;
......@@ -224,41 +202,31 @@ static INT CDECL nulldrv_GetDeviceCaps( PHYSDEV dev, INT cap )
case HORZRES:
{
DC *dc = get_nulldrv_dc( dev );
struct monitor_info info;
RECT rect;
int ret;
if (!user_callbacks) return 640;
if (dc->display[0])
{
info.name = dc->display;
SetRectEmpty( &info.rect );
user_callbacks->pEnumDisplayMonitors( NULL, NULL, monitor_enum_proc, (LPARAM)&info );
if (!IsRectEmpty( &info.rect ))
return info.rect.right - info.rect.left;
rect = get_display_rect( dc->display );
if (!IsRectEmpty( &rect )) return rect.right - rect.left;
}
ret = user_callbacks->pGetSystemMetrics( SM_CXSCREEN );
ret = get_system_metrics( SM_CXSCREEN );
return ret ? ret : 640;
}
case VERTRES:
{
DC *dc = get_nulldrv_dc( dev );
struct monitor_info info;
RECT rect;
int ret;
if (!user_callbacks) return 480;
if (dc->display[0] && user_callbacks)
if (dc->display[0])
{
info.name = dc->display;
SetRectEmpty( &info.rect );
user_callbacks->pEnumDisplayMonitors( NULL, NULL, monitor_enum_proc, (LPARAM)&info );
if (!IsRectEmpty( &info.rect ))
return info.rect.bottom - info.rect.top;
rect = get_display_rect( dc->display );
if (!IsRectEmpty( &rect )) return rect.bottom - rect.top;
}
ret = user_callbacks->pGetSystemMetrics( SM_CYSCREEN );
ret = get_system_metrics( SM_CYSCREEN );
return ret ? ret : 480;
}
case BITSPIXEL:
......
......@@ -372,7 +372,6 @@ extern void GDI_ReleaseObj( HGDIOBJ ) DECLSPEC_HIDDEN;
extern UINT GDI_get_ref_count( HGDIOBJ handle ) DECLSPEC_HIDDEN;
extern HGDIOBJ GDI_inc_ref_count( HGDIOBJ handle ) DECLSPEC_HIDDEN;
extern BOOL GDI_dec_ref_count( HGDIOBJ handle ) DECLSPEC_HIDDEN;
extern DWORD get_system_dpi(void) DECLSPEC_HIDDEN;
extern HGDIOBJ get_stock_object( INT obj ) DECLSPEC_HIDDEN;
extern DWORD get_gdi_object_type( HGDIOBJ obj ) DECLSPEC_HIDDEN;
......
......@@ -1462,6 +1462,24 @@ RECT get_virtual_screen_rect( UINT dpi )
return rect;
}
RECT get_display_rect( const WCHAR *display )
{
struct monitor *monitor;
RECT rect = {0};
if (!lock_display_devices()) return rect;
LIST_FOR_EACH_ENTRY( monitor, &monitors, struct monitor, entry )
{
if (!monitor->adapter || wcsicmp( monitor->adapter->dev.device_name, display )) continue;
rect = monitor->rc_monitor;
break;
}
unlock_display_devices();
return map_dpi_rect( rect, system_dpi, get_thread_dpi() );
}
static RECT get_primary_monitor_rect(void)
{
struct monitor *monitor;
......@@ -3907,7 +3925,7 @@ BOOL WINAPI NtUserSystemParametersInfo( UINT action, UINT val, void *ptr, UINT w
#undef WINE_SPI_WARN
}
static int get_system_metrics( int index )
int get_system_metrics( int index )
{
NONCLIENTMETRICSW ncm;
MINIMIZEDMETRICS mm;
......
......@@ -33,10 +33,7 @@
struct user_callbacks
{
HWND (WINAPI *pGetDesktopWindow)(void);
BOOL (WINAPI *pGetMonitorInfoW)( HMONITOR, LPMONITORINFO );
INT (WINAPI *pGetSystemMetrics)(INT);
BOOL (WINAPI *pGetWindowRect)( HWND hwnd, LPRECT rect );
BOOL (WINAPI *pEnumDisplayMonitors)( HDC, LPRECT, MONITORENUMPROC, LPARAM );
BOOL (WINAPI *pRedrawWindow)( HWND, const RECT*, HRGN, UINT );
LRESULT (WINAPI *pSendMessageTimeoutW)( HWND, UINT, WPARAM, LPARAM, UINT, UINT, PDWORD_PTR );
HWND (WINAPI *pWindowFromDC)( HDC );
......@@ -245,7 +242,9 @@ struct unix_funcs
struct window_surface *surface );
};
extern RECT get_display_rect( const WCHAR *display ) DECLSPEC_HIDDEN;
extern UINT get_system_dpi(void) DECLSPEC_HIDDEN;
extern int get_system_metrics( int index ) DECLSPEC_HIDDEN;
extern RECT get_virtual_screen_rect( UINT dpi ) DECLSPEC_HIDDEN;
extern void wrappers_init( unixlib_handle_t handle ) DECLSPEC_HIDDEN;
......
......@@ -958,22 +958,6 @@ static HWND WINAPI call_GetDesktopWindow(void)
return pGetDesktopWindow ? pGetDesktopWindow() : NULL;
}
static BOOL WINAPI call_GetMonitorInfoW( HMONITOR monitor, MONITORINFO *info )
{
static BOOL (WINAPI *pGetMonitorInfoW)( HMONITOR, LPMONITORINFO );
if (!pGetMonitorInfoW)
pGetMonitorInfoW = get_user_proc( "GetMonitorInfoW", FALSE );
return pGetMonitorInfoW && pGetMonitorInfoW( monitor, info );
}
static INT WINAPI call_GetSystemMetrics( INT metric )
{
static INT (WINAPI *pGetSystemMetrics)(INT);
if (!pGetSystemMetrics)
pGetSystemMetrics = get_user_proc( "GetSystemMetrics", FALSE );
return pGetSystemMetrics ? pGetSystemMetrics( metric ) : 0;
}
static BOOL WINAPI call_GetWindowRect( HWND hwnd, LPRECT rect )
{
static BOOL (WINAPI *pGetWindowRect)( HWND hwnd, LPRECT rect );
......@@ -982,15 +966,6 @@ static BOOL WINAPI call_GetWindowRect( HWND hwnd, LPRECT rect )
return pGetWindowRect && pGetWindowRect( hwnd, rect );
}
static BOOL WINAPI call_EnumDisplayMonitors( HDC hdc, RECT *rect, MONITORENUMPROC proc,
LPARAM lparam )
{
static BOOL (WINAPI *pEnumDisplayMonitors)( HDC, LPRECT, MONITORENUMPROC, LPARAM );
if (!pEnumDisplayMonitors)
pEnumDisplayMonitors = get_user_proc( "EnumDisplayMonitors", FALSE );
return pEnumDisplayMonitors && pEnumDisplayMonitors( hdc, rect, proc, lparam );
}
static BOOL WINAPI call_RedrawWindow( HWND hwnd, const RECT *rect, HRGN rgn, UINT flags )
{
static BOOL (WINAPI *pRedrawWindow)( HWND, const RECT*, HRGN, UINT );
......@@ -1019,10 +994,7 @@ static HWND WINAPI call_WindowFromDC( HDC hdc )
static const struct user_callbacks user_funcs =
{
call_GetDesktopWindow,
call_GetMonitorInfoW,
call_GetSystemMetrics,
call_GetWindowRect,
call_EnumDisplayMonitors,
call_RedrawWindow,
call_SendMessageTimeoutW,
call_WindowFromDC,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment