Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com Signed-off-by: Huw Davies huw@codeweavers.com --- dlls/user32/driver.c | 23 --------------- dlls/user32/sysparams.c | 47 +++++++++++++++++++++++++++++++ dlls/user32/user_private.h | 1 + dlls/winex11.drv/display.c | 12 ++++++++ dlls/winex11.drv/winex11.drv.spec | 1 - dlls/winex11.drv/x11drv.h | 2 ++ dlls/winex11.drv/xinerama.c | 22 +-------------- 7 files changed, 63 insertions(+), 45 deletions(-)
diff --git a/dlls/user32/driver.c b/dlls/user32/driver.c index bf600708ed..921ea2c962 100644 --- a/dlls/user32/driver.c +++ b/dlls/user32/driver.c @@ -197,8 +197,6 @@ void USER_unload_driver(void) * These are fallbacks for entry points that are not implemented in the real driver. */
-#define NULLDRV_DEFAULT_HMONITOR ((HMONITOR)(UINT_PTR)(0x10000 + 1)) - static HKL CDECL nulldrv_ActivateKeyboardLayout( HKL layout, UINT flags ) { return 0; @@ -359,27 +357,6 @@ static BOOL CDECL nulldrv_EnumDisplaySettingsEx( LPCWSTR name, DWORD num, LPDEVM return FALSE; }
-static BOOL CDECL nulldrv_GetMonitorInfo( HMONITOR handle, LPMONITORINFO info ) -{ - RECT r = {0, 0, 640, 480}; - static const WCHAR device[] = {'W','i','n','D','i','s','c',0}; - - TRACE("(%p, %p)\n", handle, info); - - if (handle != NULLDRV_DEFAULT_HMONITOR) - { - SetLastError(ERROR_INVALID_MONITOR_HANDLE); - return FALSE; - } - - info->rcMonitor = r; - info->rcWork = r; - info->dwFlags = MONITORINFOF_PRIMARY; - if (info->cbSize >= sizeof(MONITORINFOEXW)) - lstrcpyW( ((MONITORINFOEXW *)info)->szDevice, device ); - return TRUE; -} - static BOOL CDECL nulldrv_CreateDesktopWindow( HWND hwnd ) { return TRUE; diff --git a/dlls/user32/sysparams.c b/dlls/user32/sysparams.c index 9f72d2725f..ead21e82b3 100644 --- a/dlls/user32/sysparams.c +++ b/dlls/user32/sysparams.c @@ -252,6 +252,8 @@ static const WCHAR CSrgb[] = {'%','u',' ','%','u',' ','%','u',0}; /* Wine specific monitor properties */ DEFINE_DEVPROPKEY(WINE_DEVPROPKEY_MONITOR_STATEFLAGS, 0x233a9ef3, 0xafc4, 0x4abd, 0xb5, 0x64, 0xc3, 0x2f, 0x21, 0xf1, 0x53, 0x5b, 2); DEFINE_DEVPROPKEY(WINE_DEVPROPKEY_MONITOR_RCMONITOR, 0x233a9ef3, 0xafc4, 0x4abd, 0xb5, 0x64, 0xc3, 0x2f, 0x21, 0xf1, 0x53, 0x5b, 3); +DEFINE_DEVPROPKEY(WINE_DEVPROPKEY_MONITOR_RCWORK, 0x233a9ef3, 0xafc4, 0x4abd, 0xb5, 0x64, 0xc3, 0x2f, 0x21, 0xf1, 0x53, 0x5b, 4); +DEFINE_DEVPROPKEY(WINE_DEVPROPKEY_MONITOR_ADAPTERNAME, 0x233a9ef3, 0xafc4, 0x4abd, 0xb5, 0x64, 0xc3, 0x2f, 0x21, 0xf1, 0x53, 0x5b, 5);
#define NULLDRV_DEFAULT_HMONITOR ((HMONITOR)(UINT_PTR)(0x10000 + 1))
@@ -3702,6 +3704,51 @@ HMONITOR WINAPI MonitorFromWindow(HWND hWnd, DWORD dwFlags) return MonitorFromRect( &rect, dwFlags ); }
+BOOL CDECL nulldrv_GetMonitorInfo( HMONITOR handle, MONITORINFO *info ) +{ + SP_DEVINFO_DATA device_data = {sizeof(device_data)}; + WCHAR adapter_name[CCHDEVICENAME]; + HDEVINFO devinfo; + DWORD type; + + TRACE("(%p, %p)\n", handle, info); + + /* Fallback to report one monitor */ + if (handle == NULLDRV_DEFAULT_HMONITOR) + { + RECT default_rect = {0, 0, 640, 480}; + info->rcMonitor = default_rect; + info->rcWork = default_rect; + info->dwFlags = MONITORINFOF_PRIMARY; + if (info->cbSize >= sizeof(MONITORINFOEXW)) + lstrcpyW( ((MONITORINFOEXW *)info)->szDevice, DEFAULT_ADAPTER_NAME ); + return TRUE; + } + + /* Use SetupAPI to get monitors */ + devinfo = SetupDiGetClassDevsW( &GUID_DEVCLASS_MONITOR, NULL, NULL, 0 ); + if (SetupDiEnumDeviceInfo(devinfo, (DWORD)(UINT_PTR)handle - 1, &device_data)) + { + SetupDiGetDevicePropertyW( devinfo, &device_data, &WINE_DEVPROPKEY_MONITOR_RCMONITOR, &type, + (BYTE *)&info->rcMonitor, sizeof(info->rcMonitor), NULL, 0 ); + SetupDiGetDevicePropertyW( devinfo, &device_data, &WINE_DEVPROPKEY_MONITOR_RCWORK, &type, + (BYTE *)&info->rcWork, sizeof(info->rcWork), NULL, 0 ); + SetupDiGetDevicePropertyW( devinfo, &device_data, &WINE_DEVPROPKEY_MONITOR_ADAPTERNAME, &type, + (BYTE *)adapter_name, sizeof(adapter_name), NULL, 0 ); + info->dwFlags = !lstrcmpW( DEFAULT_ADAPTER_NAME, adapter_name ) ? MONITORINFOF_PRIMARY : 0; + if (info->cbSize >= sizeof(MONITORINFOEXW)) + lstrcpyW( ((MONITORINFOEXW *)info)->szDevice, adapter_name ); + SetupDiDestroyDeviceInfoList( devinfo ); + return TRUE; + } + else + { + SetLastError( ERROR_INVALID_MONITOR_HANDLE ); + SetupDiDestroyDeviceInfoList( devinfo ); + return FALSE; + } +} + /*********************************************************************** * GetMonitorInfoA (USER32.@) */ diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h index a503ebe4db..c11aae707c 100644 --- a/dlls/user32/user_private.h +++ b/dlls/user32/user_private.h @@ -123,6 +123,7 @@ extern const USER_DRIVER *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;
diff --git a/dlls/winex11.drv/display.c b/dlls/winex11.drv/display.c index d6969b0cfe..f5ef65f428 100644 --- a/dlls/winex11.drv/display.c +++ b/dlls/winex11.drv/display.c @@ -42,12 +42,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(x11drv); /* Wine specific monitor properties */ DEFINE_DEVPROPKEY(WINE_DEVPROPKEY_MONITOR_STATEFLAGS, 0x233a9ef3, 0xafc4, 0x4abd, 0xb5, 0x64, 0xc3, 0x2f, 0x21, 0xf1, 0x53, 0x5b, 2); DEFINE_DEVPROPKEY(WINE_DEVPROPKEY_MONITOR_RCMONITOR, 0x233a9ef3, 0xafc4, 0x4abd, 0xb5, 0x64, 0xc3, 0x2f, 0x21, 0xf1, 0x53, 0x5b, 3); +DEFINE_DEVPROPKEY(WINE_DEVPROPKEY_MONITOR_RCWORK, 0x233a9ef3, 0xafc4, 0x4abd, 0xb5, 0x64, 0xc3, 0x2f, 0x21, 0xf1, 0x53, 0x5b, 4); +DEFINE_DEVPROPKEY(WINE_DEVPROPKEY_MONITOR_ADAPTERNAME, 0x233a9ef3, 0xafc4, 0x4abd, 0xb5, 0x64, 0xc3, 0x2f, 0x21, 0xf1, 0x53, 0x5b, 5);
static const WCHAR driver_descW[] = {'D','r','i','v','e','r','D','e','s','c',0}; static const WCHAR video_idW[] = {'V','i','d','e','o','I','D',0}; static const WCHAR symbolic_link_valueW[]= {'S','y','m','b','o','l','i','c','L','i','n','k','V','a','l','u','e',0}; static const WCHAR gpu_idW[] = {'G','P','U','I','D',0}; static const WCHAR mointor_id_fmtW[] = {'M','o','n','i','t','o','r','I','D','%','d',0}; +static const WCHAR adapter_name_fmtW[] = {'\','\','.','\','D','I','S','P','L','A','Y','%','d',0}; static const WCHAR state_flagsW[] = {'S','t','a','t','e','F','l','a','g','s',0}; static const WCHAR guid_fmtW[] = { '{','%','0','8','x','-','%','0','4','x','-','%','0','4','x','-','%','0','2','x','%','0','2','x','-', @@ -281,6 +284,15 @@ static BOOL X11DRV_InitMonitor(HDEVINFO devinfo, const struct x11drv_monitor *mo if (!SetupDiSetDevicePropertyW(devinfo, &device_data, &WINE_DEVPROPKEY_MONITOR_RCMONITOR, DEVPROP_TYPE_BINARY, (const BYTE *)&monitor->rc_monitor, sizeof(monitor->rc_monitor), 0)) goto done; + /* RcWork */ + if (!SetupDiSetDevicePropertyW(devinfo, &device_data, &WINE_DEVPROPKEY_MONITOR_RCWORK, DEVPROP_TYPE_BINARY, + (const BYTE *)&monitor->rc_work, sizeof(monitor->rc_work), 0)) + goto done; + /* Adapter name */ + sprintfW(bufferW, adapter_name_fmtW, video_index + 1); + if (!SetupDiSetDevicePropertyW(devinfo, &device_data, &WINE_DEVPROPKEY_MONITOR_ADAPTERNAME, DEVPROP_TYPE_STRING, + (const BYTE *)bufferW, (strlenW(bufferW) + 1) * sizeof(WCHAR), 0)) + goto done;
ret = TRUE; done: diff --git a/dlls/winex11.drv/winex11.drv.spec b/dlls/winex11.drv/winex11.drv.spec index 5b00a5dc5d..c0e24d8fe8 100644 --- a/dlls/winex11.drv/winex11.drv.spec +++ b/dlls/winex11.drv/winex11.drv.spec @@ -21,7 +21,6 @@ @ cdecl ClipCursor(ptr) X11DRV_ClipCursor @ cdecl ChangeDisplaySettingsEx(ptr ptr long long long) X11DRV_ChangeDisplaySettingsEx @ cdecl EnumDisplaySettingsEx(ptr long ptr long) X11DRV_EnumDisplaySettingsEx -@ cdecl GetMonitorInfo(long ptr) X11DRV_GetMonitorInfo @ cdecl CreateDesktopWindow(long) X11DRV_CreateDesktopWindow @ cdecl CreateWindow(long) X11DRV_CreateWindow @ cdecl DestroyWindow(long) X11DRV_DestroyWindow diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index a6b07699a7..9ab948f724 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -697,6 +697,8 @@ struct x11drv_monitor WCHAR name[128]; /* RcMonitor in MONITORINFO struct */ RECT rc_monitor; + /* RcWork in MONITORINFO struct */ + RECT rc_work; /* StateFlags in DISPLAY_DEVICE struct */ DWORD state_flags; }; diff --git a/dlls/winex11.drv/xinerama.c b/dlls/winex11.drv/xinerama.c index c8fa63f459..96d118a222 100644 --- a/dlls/winex11.drv/xinerama.c +++ b/dlls/winex11.drv/xinerama.c @@ -322,6 +322,7 @@ static BOOL xinerama_get_monitors( ULONG_PTR adapter_id, struct x11drv_monitor * { lstrcpyW( monitor[index].name, generic_nonpnp_monitorW ); monitor[index].rc_monitor = monitors[i].rcMonitor; + monitor[index].rc_work = monitors[i].rcWork; /* Xinerama only reports monitors already attached */ monitor[index].state_flags = DISPLAY_DEVICE_ATTACHED; if (!IsRectEmpty( &monitors[i].rcMonitor )) @@ -390,24 +391,3 @@ void xinerama_init( unsigned int width, unsigned int height ) TRACE( "virtual size: %s primary: %s\n", wine_dbgstr_rect(&virtual_screen_rect), wine_dbgstr_rect(&primary->rcMonitor) ); } - - -/*********************************************************************** - * X11DRV_GetMonitorInfo (X11DRV.@) - */ -BOOL CDECL X11DRV_GetMonitorInfo( HMONITOR handle, LPMONITORINFO info ) -{ - int i = monitor_to_index( handle ); - - if (i == -1) - { - SetLastError( ERROR_INVALID_HANDLE ); - return FALSE; - } - info->rcMonitor = monitors[i].rcMonitor; - info->rcWork = monitors[i].rcWork; - info->dwFlags = monitors[i].dwFlags; - if (info->cbSize >= sizeof(MONITORINFOEXW)) - lstrcpyW( ((MONITORINFOEXW *)info)->szDevice, monitors[i].szDevice ); - return TRUE; -}
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=53985
Your paranoid android.
=== debian9 (32 bit WoW report) ===
user32: msg.c:8713: Test failed: WaitForSingleObject failed 102 msg.c:8719: Test failed: destroy child on thread exit: 0: the msg 0x0082 was expected, but got msg 0x000f instead msg.c:8719: Test failed: destroy child on thread exit: 1: the msg 0x000f was expected, but got msg 0x0014 instead msg.c:8719: Test failed: destroy child on thread exit: 2: the msg sequence is not complete: expected 0014 - actual 0000
=== debian9 (64 bit WoW report) ===
user32: msg.c:8713: Test failed: WaitForSingleObject failed 102 msg.c:8719: Test failed: destroy child on thread exit: 0: the msg 0x0082 was expected, but got msg 0x000f instead msg.c:8719: Test failed: destroy child on thread exit: 1: the msg 0x000f was expected, but got msg 0x0014 instead msg.c:8719: Test failed: destroy child on thread exit: 2: the msg sequence is not complete: expected 0014 - actual 0000
Huw Davies huw@codeweavers.com writes:
Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com Signed-off-by: Huw Davies huw@codeweavers.com
dlls/user32/driver.c | 23 --------------- dlls/user32/sysparams.c | 47 +++++++++++++++++++++++++++++++ dlls/user32/user_private.h | 1 + dlls/winex11.drv/display.c | 12 ++++++++ dlls/winex11.drv/winex11.drv.spec | 1 - dlls/winex11.drv/x11drv.h | 2 ++ dlls/winex11.drv/xinerama.c | 22 +-------------- 7 files changed, 63 insertions(+), 45 deletions(-)
This is breaking the d3d tests, for instance:
../../../tools/runtest -q -P wine -T ../../.. -M d3d8.dll -p d3d8_test.exe device && touch device.ok device.c:1427: Test failed: Screen height is 1200, expected 1080. device.c:1482: Test failed: Screen height is 1200, expected 1080. device.c:1540: Test failed: Screen height is 1200, expected 1080. device.c:1553: Test failed: Screen height is 1200, expected 1080. device.c:2599: Test failed: Got unexpected wparam 0 for message 1c, expected 1. device.c:6012: Tests skipped: Format D3DFMT_YUY2 not supported, skipping lockrect offset tests. device.c:6012: Tests skipped: Format D3DFMT_UYVY not supported, skipping lockrect offset tests. make: *** [Makefile:178: device.ok] Error 5