win32u: Move GetMonitorInfo implementation from user32.
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:
parent
909f7aa7c2
commit
45dcaf02fc
|
@ -274,11 +274,6 @@ static BOOL CDECL loaderdrv_EnumDisplayMonitors( HDC hdc, LPRECT rect, MONITOREN
|
|||
return load_driver()->pEnumDisplayMonitors( hdc, rect, proc, lp );
|
||||
}
|
||||
|
||||
static BOOL CDECL loaderdrv_GetMonitorInfo( HMONITOR handle, LPMONITORINFO info )
|
||||
{
|
||||
return load_driver()->pGetMonitorInfo( handle, info );
|
||||
}
|
||||
|
||||
static BOOL CDECL loaderdrv_CreateDesktopWindow( HWND hwnd )
|
||||
{
|
||||
return load_driver()->pCreateDesktopWindow( hwnd );
|
||||
|
@ -341,7 +336,6 @@ static struct user_driver_funcs lazy_load_driver =
|
|||
loaderdrv_ChangeDisplaySettingsEx,
|
||||
loaderdrv_EnumDisplayMonitors,
|
||||
NULL,
|
||||
loaderdrv_GetMonitorInfo,
|
||||
NULL,
|
||||
/* windowing functions */
|
||||
loaderdrv_CreateDesktopWindow,
|
||||
|
@ -389,7 +383,6 @@ void CDECL __wine_set_user_driver( const struct user_driver_funcs *funcs, UINT v
|
|||
do { if (!driver->p##name) driver->p##name = nulldrv_##name; } while(0)
|
||||
|
||||
SET_USER_FUNC(EnumDisplayMonitors);
|
||||
SET_USER_FUNC(GetMonitorInfo);
|
||||
|
||||
#undef SET_USER_FUNC
|
||||
|
||||
|
|
|
@ -3856,46 +3856,6 @@ fail:
|
|||
return ret;
|
||||
}
|
||||
|
||||
BOOL CDECL nulldrv_GetMonitorInfo( HMONITOR handle, MONITORINFO *info )
|
||||
{
|
||||
UINT index = (UINT_PTR)handle - 1;
|
||||
|
||||
TRACE("(%p, %p)\n", handle, info);
|
||||
|
||||
/* Fallback to report one monitor */
|
||||
if (handle == NULLDRV_DEFAULT_HMONITOR)
|
||||
{
|
||||
RECT default_rect = {0, 0, 1024, 768};
|
||||
info->rcMonitor = default_rect;
|
||||
info->rcWork = default_rect;
|
||||
info->dwFlags = MONITORINFOF_PRIMARY;
|
||||
if (info->cbSize >= sizeof(MONITORINFOEXW))
|
||||
lstrcpyW( ((MONITORINFOEXW *)info)->szDevice, L"WinDisc" );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (!update_monitor_cache())
|
||||
return FALSE;
|
||||
|
||||
EnterCriticalSection( &monitors_section );
|
||||
if (index < monitor_count)
|
||||
{
|
||||
info->rcMonitor = monitors[index].rcMonitor;
|
||||
info->rcWork = monitors[index].rcWork;
|
||||
info->dwFlags = monitors[index].dwFlags;
|
||||
if (info->cbSize >= sizeof(MONITORINFOEXW))
|
||||
lstrcpyW( ((MONITORINFOEXW *)info)->szDevice, monitors[index].szDevice );
|
||||
LeaveCriticalSection( &monitors_section );
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
LeaveCriticalSection( &monitors_section );
|
||||
SetLastError( ERROR_INVALID_MONITOR_HANDLE );
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* GetMonitorInfoA (USER32.@)
|
||||
*/
|
||||
|
@ -3928,9 +3888,7 @@ BOOL WINAPI GetMonitorInfoW( HMONITOR monitor, LPMONITORINFO info )
|
|||
BOOL ret;
|
||||
UINT dpi_from, dpi_to;
|
||||
|
||||
if (info->cbSize != sizeof(MONITORINFOEXW) && info->cbSize != sizeof(MONITORINFO)) return FALSE;
|
||||
|
||||
ret = USER_Driver->pGetMonitorInfo( monitor, info );
|
||||
ret = NtUserCallTwoParam( HandleToUlong(monitor), (ULONG_PTR)info, NtUserGetMonitorInfo );
|
||||
if (ret)
|
||||
{
|
||||
if ((dpi_to = get_thread_dpi()))
|
||||
|
|
|
@ -67,7 +67,6 @@ extern const struct user_driver_funcs *USER_Driver DECLSPEC_HIDDEN;
|
|||
extern void USER_unload_driver(void) DECLSPEC_HIDDEN;
|
||||
|
||||
extern BOOL CDECL nulldrv_EnumDisplayMonitors( HDC hdc, RECT *rect, MONITORENUMPROC proc, LPARAM lp ) DECLSPEC_HIDDEN;
|
||||
extern BOOL CDECL nulldrv_GetMonitorInfo( HMONITOR handle, MONITORINFO *info ) DECLSPEC_HIDDEN;
|
||||
|
||||
struct received_message_info;
|
||||
|
||||
|
|
|
@ -823,12 +823,6 @@ static BOOL CDECL nulldrv_EnumDisplaySettingsEx( LPCWSTR name, DWORD num, LPDEVM
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static BOOL CDECL nulldrv_GetMonitorInfo( HMONITOR handle, MONITORINFO *info )
|
||||
{
|
||||
/* FIXME: move from user32 */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void CDECL nulldrv_UpdateDisplayDevices( const struct gdi_device_manager *manager,
|
||||
BOOL force, void *param )
|
||||
{
|
||||
|
@ -1107,7 +1101,6 @@ void CDECL __wine_set_display_driver( struct user_driver_funcs *driver, UINT ver
|
|||
SET_USER_FUNC(ChangeDisplaySettingsEx);
|
||||
SET_USER_FUNC(EnumDisplayMonitors);
|
||||
SET_USER_FUNC(EnumDisplaySettingsEx);
|
||||
SET_USER_FUNC(GetMonitorInfo);
|
||||
SET_USER_FUNC(UpdateDisplayDevices);
|
||||
SET_USER_FUNC(CreateDesktopWindow);
|
||||
SET_USER_FUNC(CreateWindow);
|
||||
|
|
|
@ -1168,6 +1168,7 @@ static struct unix_funcs unix_funcs =
|
|||
NtGdiUpdateColors,
|
||||
NtGdiWidenPath,
|
||||
NtUserActivateKeyboardLayout,
|
||||
NtUserCallTwoParam,
|
||||
NtUserCountClipboardFormats,
|
||||
NtUserEnumDisplayDevices,
|
||||
NtUserEnumDisplaySettings,
|
||||
|
|
|
@ -186,6 +186,8 @@ static const WCHAR guid_devinterface_monitorW[] =
|
|||
{'{','E','6','F','0','7','B','5','F','-','E','E','9','7','-','4','A','9','0','-',
|
||||
'B','0','7','6','-','3','3','F','5','7','B','F','4','E','A','A','7','}',0};
|
||||
|
||||
#define NULLDRV_DEFAULT_HMONITOR ((HMONITOR)(UINT_PTR)(0x10000 + 1))
|
||||
|
||||
/* Cached display device information */
|
||||
struct display_device
|
||||
{
|
||||
|
@ -210,6 +212,7 @@ struct monitor
|
|||
struct list entry;
|
||||
struct display_device dev;
|
||||
struct adapter *adapter;
|
||||
HANDLE handle;
|
||||
unsigned int id;
|
||||
unsigned int flags;
|
||||
RECT rc_monitor;
|
||||
|
@ -1044,7 +1047,7 @@ static void release_display_manager_ctx( struct device_manager_ctx *ctx )
|
|||
|
||||
static BOOL update_display_cache_from_registry(void)
|
||||
{
|
||||
DWORD adapter_id, monitor_id, size;
|
||||
DWORD adapter_id, monitor_id, monitor_count = 0, size;
|
||||
KEY_FULL_INFORMATION key;
|
||||
struct adapter *adapter;
|
||||
struct monitor *monitor;
|
||||
|
@ -1104,6 +1107,7 @@ static BOOL update_display_cache_from_registry(void)
|
|||
break;
|
||||
}
|
||||
|
||||
monitor->handle = UlongToHandle( ++monitor_count );
|
||||
list_add_tail( &monitors, &monitor->entry );
|
||||
}
|
||||
}
|
||||
|
@ -1315,3 +1319,56 @@ BOOL WINAPI NtUserEnumDisplaySettings( UNICODE_STRING *device, DWORD mode,
|
|||
WARN( "Failed to query %s display settings.\n", wine_dbgstr_w(device_name) );
|
||||
return ret;
|
||||
}
|
||||
|
||||
static BOOL get_monitor_info( HMONITOR handle, MONITORINFO *info )
|
||||
{
|
||||
struct monitor *monitor;
|
||||
|
||||
if (info->cbSize != sizeof(MONITORINFOEXW) && info->cbSize != sizeof(MONITORINFO)) return FALSE;
|
||||
|
||||
/* Fallback to report one monitor */
|
||||
if (handle == NULLDRV_DEFAULT_HMONITOR)
|
||||
{
|
||||
RECT default_rect = {0, 0, 1024, 768};
|
||||
info->rcMonitor = default_rect;
|
||||
info->rcWork = default_rect;
|
||||
info->dwFlags = MONITORINFOF_PRIMARY;
|
||||
if (info->cbSize >= sizeof(MONITORINFOEXW))
|
||||
asciiz_to_unicode( ((MONITORINFOEXW *)info)->szDevice, "WinDisc" );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (!lock_display_devices()) return FALSE;
|
||||
|
||||
LIST_FOR_EACH_ENTRY( monitor, &monitors, struct monitor, entry )
|
||||
{
|
||||
if (monitor->handle != handle) continue;
|
||||
if (!(monitor->dev.state_flags & DISPLAY_DEVICE_ACTIVE)) break;
|
||||
|
||||
/* FIXME: map dpi */
|
||||
info->rcMonitor = monitor->rc_monitor;
|
||||
info->rcWork = monitor->rc_work;
|
||||
info->dwFlags = monitor->flags;
|
||||
if (info->cbSize >= sizeof(MONITORINFOEXW))
|
||||
lstrcpyW( ((MONITORINFOEXW *)info)->szDevice, monitor->adapter->dev.device_name );
|
||||
unlock_display_devices();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
unlock_display_devices();
|
||||
WARN( "invalid handle %p\n", handle );
|
||||
SetLastError( ERROR_INVALID_MONITOR_HANDLE );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
ULONG_PTR WINAPI NtUserCallTwoParam( ULONG_PTR arg1, ULONG_PTR arg2, ULONG code )
|
||||
{
|
||||
switch(code)
|
||||
{
|
||||
case NtUserGetMonitorInfo:
|
||||
return get_monitor_info( UlongToHandle(arg1), (MONITORINFO *)arg2 );
|
||||
default:
|
||||
FIXME( "invalid code %u\n", code );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -780,7 +780,7 @@
|
|||
@ stub NtUserCallNextHookEx
|
||||
@ stub NtUserCallNoParam
|
||||
@ stub NtUserCallOneParam
|
||||
@ stub NtUserCallTwoParam
|
||||
@ stdcall NtUserCallTwoParam(long long long)
|
||||
@ stub NtUserCanBrokerForceForeground
|
||||
@ stub NtUserChangeClipboardChain
|
||||
@ stub NtUserChangeDisplaySettings
|
||||
|
|
|
@ -196,6 +196,7 @@ struct unix_funcs
|
|||
BOOL (WINAPI *pNtGdiUpdateColors)( HDC hdc );
|
||||
BOOL (WINAPI *pNtGdiWidenPath)( HDC hdc );
|
||||
HKL (WINAPI *pNtUserActivateKeyboardLayout)( HKL layout, UINT flags );
|
||||
ULONG_PTR (WINAPI *pNtUserCallTwoParam)( ULONG_PTR arg1, ULONG_PTR arg2, ULONG code );
|
||||
INT (WINAPI *pNtUserCountClipboardFormats)(void);
|
||||
BOOL (WINAPI *pNtUserEnumDisplayDevices)( UNICODE_STRING *device, DWORD index,
|
||||
DISPLAY_DEVICEW *info, DWORD flags );
|
||||
|
|
|
@ -601,6 +601,11 @@ HKL WINAPI NtUserActivateKeyboardLayout( HKL layout, UINT flags )
|
|||
return unix_funcs->pNtUserActivateKeyboardLayout( layout, flags );
|
||||
}
|
||||
|
||||
ULONG_PTR WINAPI NtUserCallTwoParam( ULONG_PTR arg1, ULONG_PTR arg2, ULONG code )
|
||||
{
|
||||
return unix_funcs->pNtUserCallTwoParam( arg1, arg2, code );
|
||||
}
|
||||
|
||||
INT WINAPI NtUserCountClipboardFormats(void)
|
||||
{
|
||||
return unix_funcs->pNtUserCountClipboardFormats();
|
||||
|
|
|
@ -23,6 +23,12 @@
|
|||
#include <wingdi.h>
|
||||
#include <winternl.h>
|
||||
|
||||
/* NtUserCallTwoParam codes, not compatible with Windows */
|
||||
enum
|
||||
{
|
||||
NtUserGetMonitorInfo,
|
||||
};
|
||||
|
||||
/* this is the structure stored in TEB->Win32ClientInfo */
|
||||
/* no attempt is made to keep the layout compatible with the Windows one */
|
||||
struct user_thread_info
|
||||
|
@ -56,6 +62,7 @@ C_ASSERT( sizeof(struct user_thread_info) <= sizeof(((TEB *)0)->Win32ClientInfo)
|
|||
HKL WINAPI NtUserActivateKeyboardLayout( HKL layout, UINT flags );
|
||||
BOOL WINAPI NtUserAddClipboardFormatListener( HWND hwnd );
|
||||
BOOL WINAPI NtUserAttachThreadInput( DWORD from, DWORD to, BOOL attach );
|
||||
ULONG_PTR WINAPI NtUserCallTwoParam( ULONG_PTR arg1, ULONG_PTR arg2, ULONG code );
|
||||
BOOL WINAPI NtUserCloseDesktop( HDESK handle );
|
||||
BOOL WINAPI NtUserCloseWindowStation( HWINSTA handle );
|
||||
INT WINAPI NtUserCountClipboardFormats(void);
|
||||
|
|
|
@ -167,7 +167,7 @@ struct gdi_dc_funcs
|
|||
};
|
||||
|
||||
/* increment this when you change the DC function table */
|
||||
#define WINE_GDI_DRIVER_VERSION 71
|
||||
#define WINE_GDI_DRIVER_VERSION 72
|
||||
|
||||
#define GDI_PRIORITY_NULL_DRV 0 /* null driver */
|
||||
#define GDI_PRIORITY_FONT_DRV 100 /* any font driver */
|
||||
|
@ -293,7 +293,6 @@ struct user_driver_funcs
|
|||
LONG (CDECL *pChangeDisplaySettingsEx)(LPCWSTR,LPDEVMODEW,HWND,DWORD,LPVOID);
|
||||
BOOL (CDECL *pEnumDisplayMonitors)(HDC,LPRECT,MONITORENUMPROC,LPARAM);
|
||||
BOOL (CDECL *pEnumDisplaySettingsEx)(LPCWSTR,DWORD,LPDEVMODEW,DWORD);
|
||||
BOOL (CDECL *pGetMonitorInfo)(HMONITOR,MONITORINFO*);
|
||||
void (CDECL *pUpdateDisplayDevices)(const struct gdi_device_manager *,BOOL,void*);
|
||||
/* windowing functions */
|
||||
BOOL (CDECL *pCreateDesktopWindow)(HWND);
|
||||
|
|
Loading…
Reference in New Issue