Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- Fix failures to change display modes like in https://test.winehq.org/data/93107c08f5aa7f37ad7ece9cd7ca248dba3030ce/linux_...
dlls/user32/sysparams.c | 16 ++++++++++++++++ dlls/user32/tests/monitor.c | 16 +++------------- 2 files changed, 19 insertions(+), 13 deletions(-)
diff --git a/dlls/user32/sysparams.c b/dlls/user32/sysparams.c index d4640e0068e..1381f387e03 100644 --- a/dlls/user32/sysparams.c +++ b/dlls/user32/sysparams.c @@ -3182,6 +3182,22 @@ LONG WINAPI ChangeDisplaySettingsExW( LPCWSTR devname, LPDEVMODEW devmode, HWND return DISP_CHANGE_BADMODE; }
+ if (!is_detached_mode(devmode) && (!devmode->dmPelsWidth || !devmode->dmPelsHeight)) + { + memset(&dm, 0, sizeof(dm)); + dm.dmSize = sizeof(dm); + if (!EnumDisplaySettingsExW(devname, ENUM_CURRENT_SETTINGS, &dm, 0)) + { + ERR("Current mode not found!\n"); + return DISP_CHANGE_BADMODE; + } + + if (!devmode->dmPelsWidth) + devmode->dmPelsWidth = dm.dmPelsWidth; + if (!devmode->dmPelsHeight) + devmode->dmPelsHeight = dm.dmPelsHeight; + } + ret = USER_Driver->pChangeDisplaySettingsEx(devname, devmode, hwnd, flags, lparam); if (ret != DISP_CHANGE_SUCCESSFUL) ERR("Changing %s display settings returned %d.\n", wine_dbgstr_w(devname), ret); diff --git a/dlls/user32/tests/monitor.c b/dlls/user32/tests/monitor.c index d7d9086672d..009fc0d626e 100644 --- a/dlls/user32/tests/monitor.c +++ b/dlls/user32/tests/monitor.c @@ -602,8 +602,7 @@ static void test_ChangeDisplaySettingsEx(void) }
/* Test changing to a mode with depth set but with zero width and height */ - /* This test is only ran for non-primary adapters for now as it may detach the adapters on Wine */ - for (device = 1; device < device_count; ++device) + for (device = 0; device < device_count; ++device) { for (test = 0; test < ARRAY_SIZE(depths); ++test) { @@ -689,10 +688,8 @@ static void test_ChangeDisplaySettingsEx(void) dd.cb = sizeof(dd); res = EnumDisplayDevicesA(NULL, devices[device].index, &dd, 0); ok(res, "EnumDisplayDevicesA %s failed, error %#x.\n", devices[device].name, GetLastError()); - todo_wine ok(dd.StateFlags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP, "Expect %s attached.\n", - devices[device].name); - if (!(dd.StateFlags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP)) - continue; + ok(dd.StateFlags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP, "Expect %s attached.\n", + devices[device].name);
memset(&dm, 0, sizeof(dm)); dm.dmSize = sizeof(dm); @@ -715,13 +712,6 @@ static void test_ChangeDisplaySettingsEx(void) /* Detach all non-primary adapters to avoid position conflicts */ for (device = 1; device < device_count; ++device) { - dd.cb = sizeof(dd); - res = EnumDisplayDevicesA(NULL, devices[device].index, &dd, 0); - ok(res, "EnumDisplayDevicesA %s failed, error %#x.\n", devices[device].name, GetLastError()); - /* Already detached by previous tests */ - if (!(dd.StateFlags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP)) - continue; - old_count = GetSystemMetrics(SM_CMONITORS);
memset(&dm, 0, sizeof(dm));
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=81035
Your paranoid android.
=== debiant (32 bit report) ===
user32: monitor: Timeout
=== debiant (32 bit Chinese:China report) ===
user32: clipboard.c:760: Test failed: 2: gle 5 clipboard.c:765: Test failed: 2.0: got 0000 instead of 000d clipboard.c:805: Test failed: 2: gle 1418 clipboard.c:815: Test failed: 2: count 4 clipboard.c:818: Test failed: 2: gle 1418 clipboard.c:853: Test failed: 2.0: formats 00000000 have been rendered clipboard.c:858: Test failed: 2.0: formats 00000000 have been rendered clipboard.c:853: Test failed: 2.2: formats 00000000 have been rendered clipboard.c:858: Test failed: 2.2: formats 00000000 have been rendered clipboard.c:853: Test failed: 2.3: formats 00000000 have been rendered clipboard.c:858: Test failed: 2.3: formats 00000000 have been rendered clipboard.c:760: Test failed: 6: gle 5 clipboard.c:765: Test failed: 6.0: got 0000 instead of 0008 clipboard.c:805: Test failed: 6: gle 1418 clipboard.c:815: Test failed: 6: count 3 clipboard.c:818: Test failed: 6: gle 1418 clipboard.c:852: Test failed: 6: format 0008 got data 0012F0C8 clipboard.c:853: Test failed: 6.0: formats 00000000 have been rendered clipboard.c:858: Test failed: 6.0: formats 00000000 have been rendered clipboard.c:852: Test failed: 6: format 0002 got data 00050045 clipboard.c:853: Test failed: 6.1: formats 00000000 have been rendered clipboard.c:858: Test failed: 6.1: formats 00000000 have been rendered clipboard.c:852: Test failed: 6: format 0011 got data 0012FD58 clipboard.c:853: Test failed: 6.2: formats 00000000 have been rendered clipboard.c:858: Test failed: 6.2: formats 00000000 have been rendered monitor: Timeout
=== debiant (32 bit WoW report) ===
user32: monitor: Timeout
=== debiant (64 bit WoW report) ===
user32: clipboard.c:833: Test failed: 3: gle 5 clipboard.c:838: Test failed: 3.0: got 0000 instead of 000e clipboard.c:868: Test failed: 3: gle 1418 win.c:10149: Test failed: Expected foreground window 000E013E, got 00E10102 win.c:10152: Test failed: Received WM_ACTIVATEAPP(0), did not expect it. win.c:10159: Test failed: Expected foreground window 000E013E, got 00000000 win.c:10169: Test failed: Received WM_ACTIVATEAPP(1), did not expect it.