Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com ---
I'm sending these tests first to show the behavior across d3d versions. I do not plan to fix them during code freeze, except for ddraw, since I'm not aware of any regressions due to them. I might fix them after code freeze though.
dlls/d3d8/tests/device.c | 91 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+)
diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index fc94dca..9e7c0fb 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -4055,6 +4055,97 @@ static void test_window_style(void)
ref = IDirect3DDevice8_Release(device); ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); + DestroyWindow(device_window); + DestroyWindow(focus_window); + + /* Window changes are done only if either the device or focus windows are active */ + focus_window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, registry_mode.dmPelsWidth / 2, registry_mode.dmPelsHeight / 2, 0, 0, 0, 0); + device_window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, registry_mode.dmPelsWidth / 2, registry_mode.dmPelsHeight / 2, 0, 0, 0, 0); + + device_style = GetWindowLongA(device_window, GWL_STYLE); + device_exstyle = GetWindowLongA(device_window, GWL_EXSTYLE); + focus_style = GetWindowLongA(focus_window, GWL_STYLE); + focus_exstyle = GetWindowLongA(focus_window, GWL_EXSTYLE); + + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + + device_desc.device_window = device_window; + device_desc.flags = CREATE_DEVICE_FULLSCREEN; + device = create_device(d3d8, focus_window, &device_desc); + ok(!!device, "Failed to create a D3D device.\n"); + ShowWindow(device_window, SW_SHOWNOACTIVATE); + + /* 32-bit tests ran under Windows 8 and 10 testbots have pretty + inconsistent behavior but topmost is set even when inactive. */ + style = GetWindowLongA(device_window, GWL_EXSTYLE); + if (broken(style & WS_EX_TOPMOST)) + { + win_skip("topmost set when inactive due to inconsistent behavior, skipping related tests..."); + goto skip_inactive; + } + todo_wine ok(style == device_exstyle || broken(style == (device_exstyle & ~WS_EX_OVERLAPPEDWINDOW)) /* w1064v1809 */, + "Expected device window extended style %#x, got %#x.\n", device_exstyle, style); + style = GetWindowLongA(device_window, GWL_STYLE); + todo_wine ok(style == device_style || broken(style == (device_style & ~WS_OVERLAPPEDWINDOW)) /* w1064v1809 */, + "Expected device window style %#x, got %#x.\n", device_style, style); + + style = GetWindowLongA(focus_window, GWL_STYLE); + ok(style == focus_style, "Expected focus window style %#x, got %#x.\n", focus_style, style); + style = GetWindowLongA(focus_window, GWL_EXSTYLE); + ok(style == focus_exstyle, "Expected focus window extended style %#x, got %#x.\n", focus_exstyle, style); + + device_desc.flags = 0; + hr = reset_device(device, &device_desc); + ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); + + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + device_desc.flags = CREATE_DEVICE_FULLSCREEN; + hr = reset_device(device, &device_desc); + ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); + + style = GetWindowLongA(device_window, GWL_STYLE); + todo_wine ok(style == device_style || broken(style == (device_style & ~WS_OVERLAPPEDWINDOW)) /* w1064v1809 */, + "Expected device window style %#x, got %#x.\n", device_style, style); + style = GetWindowLongA(device_window, GWL_EXSTYLE); + todo_wine ok(style == device_exstyle || broken(style == (device_exstyle & ~WS_EX_OVERLAPPEDWINDOW)) /* w1064v1809 */, + "Expected device window extended style %#x, got %#x.\n", device_exstyle, style); + GetWindowRect(device_window, &r); + ok(EqualRect(&r, &fullscreen_rect), "Expected %s, got %s.\n", wine_dbgstr_rect(&fullscreen_rect), wine_dbgstr_rect(&r)); + + SetForegroundWindow(focus_window); + ok(ret, "Failed to set foreground window.\n"); + hr = reset_device(device, &device_desc); + ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); + + style = GetWindowLongA(device_window, GWL_STYLE); + todo_wine ok(style == device_style || broken(style == (device_style & ~WS_OVERLAPPEDWINDOW)) /* w1064v1809 */, + "Expected device window style %#x, got %#x.\n", device_style, style); + style = GetWindowLongA(device_window, GWL_EXSTYLE); + todo_wine ok(style == device_exstyle || broken(style == (device_exstyle & ~WS_EX_OVERLAPPEDWINDOW)) /* w1064v1809 */, + "Expected device window extended style %#x, got %#x.\n", device_exstyle, style); + + device_desc.flags = 0; + hr = reset_device(device, &device_desc); + ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); + + device_desc.flags = CREATE_DEVICE_FULLSCREEN; + hr = reset_device(device, &device_desc); + ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); + + style = GetWindowLongA(device_window, GWL_STYLE); + todo_wine ok(style == device_style || broken(style == (device_style & ~WS_OVERLAPPEDWINDOW)) /* w1064v1809 */, + "Expected device window style %#x, got %#x.\n", device_style, style); + style = GetWindowLongA(device_window, GWL_EXSTYLE); + todo_wine ok(style == device_exstyle || broken(style == (device_exstyle & ~WS_EX_OVERLAPPEDWINDOW)) /* w1064v1809 */, + "Expected device window extended style %#x, got %#x.\n", device_exstyle, style); + +skip_inactive: + ref = IDirect3DDevice8_Release(device); + ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref);
done: IDirect3D8_Release(d3d8);
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/d3d9/tests/d3d9ex.c | 89 ++++++++++++++++++++++++++++++++++++++++ dlls/d3d9/tests/device.c | 57 +++++++++++++++++++++++-- 2 files changed, 143 insertions(+), 3 deletions(-)
diff --git a/dlls/d3d9/tests/d3d9ex.c b/dlls/d3d9/tests/d3d9ex.c index 2afe730..e181c72 100644 --- a/dlls/d3d9/tests/d3d9ex.c +++ b/dlls/d3d9/tests/d3d9ex.c @@ -3662,6 +3662,95 @@ static void test_window_style(void) DestroyWindow(device_window); DestroyWindow(focus_window); } + + /* Window changes are done only if either the device or focus windows are active */ + focus_window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, registry_mode.dmPelsWidth / 2, registry_mode.dmPelsHeight / 2, 0, 0, 0, 0); + device_window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, registry_mode.dmPelsWidth / 2, registry_mode.dmPelsHeight / 2, 0, 0, 0, 0); + + device_style = GetWindowLongA(device_window, GWL_STYLE); + device_exstyle = GetWindowLongA(device_window, GWL_EXSTYLE); + focus_style = GetWindowLongA(focus_window, GWL_STYLE); + focus_exstyle = GetWindowLongA(focus_window, GWL_EXSTYLE); + + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + + device_desc.device_window = device_window; + device_desc.flags = CREATE_DEVICE_FULLSCREEN; + device = create_device(focus_window, &device_desc); + ok(!!device, "Failed to create a D3D device.\n"); + ref = IDirect3DDevice9Ex_Release(device); + ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); + + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + + device_desc.flags = CREATE_DEVICE_FULLSCREEN; + device = create_device(focus_window, &device_desc); + ok(!!device, "Failed to create a D3D device.\n"); + style = GetWindowLongA(device_window, GWL_STYLE); + todo_wine ok(style == device_style || broken(style == (device_style & ~WS_OVERLAPPEDWINDOW)) /* w1064v1809 */, + "Expected device window style %#x, got %#x.\n", device_style, style); + style = GetWindowLongA(device_window, GWL_EXSTYLE); + todo_wine ok(style == device_exstyle || broken(style == (device_exstyle & ~WS_EX_OVERLAPPEDWINDOW)) /* w1064v1809 */, + "Expected device window extended style %#x, got %#x.\n", device_exstyle, style); + + style = GetWindowLongA(focus_window, GWL_STYLE); + ok(style == focus_style, "Expected focus window style %#x, got %#x.\n", focus_style, style); + style = GetWindowLongA(focus_window, GWL_EXSTYLE); + ok(style == focus_exstyle, "Expected focus window extended style %#x, got %#x.\n", focus_exstyle, style); + GetWindowRect(device_window, &r); + ok(EqualRect(&r, &fullscreen_rect), "Expected %s, got %s.\n", wine_dbgstr_rect(&fullscreen_rect), wine_dbgstr_rect(&r)); + + device_desc.flags = 0; + hr = reset_device(device, &device_desc); + ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); + + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + device_desc.flags = CREATE_DEVICE_FULLSCREEN; + hr = reset_device(device, &device_desc); + ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); + + style = GetWindowLongA(device_window, GWL_STYLE); + todo_wine ok(style == device_style || broken(style == (device_style & ~WS_OVERLAPPEDWINDOW)) /* w1064v1809 */, + "Expected device window style %#x, got %#x.\n", device_style, style); + style = GetWindowLongA(device_window, GWL_EXSTYLE); + todo_wine ok(style == device_exstyle || broken(style == (device_exstyle & ~WS_EX_OVERLAPPEDWINDOW)) /* w1064v1809 */, + "Expected device window extended style %#x, got %#x.\n", device_exstyle, style); + + SetForegroundWindow(focus_window); + ok(ret, "Failed to set foreground window.\n"); + hr = reset_device(device, &device_desc); + ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); + + style = GetWindowLongA(device_window, GWL_STYLE); + todo_wine ok(style == device_style || broken(style == (device_style & ~WS_OVERLAPPEDWINDOW)) /* w1064v1809 */, + "Expected device window style %#x, got %#x.\n", device_style, style); + style = GetWindowLongA(device_window, GWL_EXSTYLE); + expected_style = device_exstyle | WS_EX_TOPMOST; + todo_wine ok(style == expected_style || broken(style == (expected_style & ~WS_EX_OVERLAPPEDWINDOW)) /* w1064v1809 */, + "Expected device window extended style %#x, got %#x.\n", expected_style, style); + + device_desc.flags = 0; + hr = reset_device(device, &device_desc); + ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); + + style = GetWindowLongA(device_window, GWL_STYLE); + todo_wine ok(style == device_style || broken(style == (device_style & ~WS_OVERLAPPEDWINDOW)) /* w1064v1809 */, + "Expected device window style %#x, got %#x.\n", device_style, style); + style = GetWindowLongA(device_window, GWL_EXSTYLE); + expected_style = device_exstyle | WS_EX_TOPMOST; + todo_wine ok(style == expected_style || broken(style == (expected_style & ~WS_EX_OVERLAPPEDWINDOW)) /* w1064v1809 */, + "Expected device window extended style %#x, got %#x.\n", expected_style, style); + + ref = IDirect3DDevice9Ex_Release(device); + ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); + + DestroyWindow(device_window); + DestroyWindow(focus_window); }
static void test_swapchain_parameters(void) diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index c480a9d..b922c88 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -5051,9 +5051,7 @@ static void test_window_style(void) if (!(device = create_device(d3d9, focus_window, &device_desc))) { skip("Failed to create a D3D device, skipping tests.\n"); - DestroyWindow(device_window); - DestroyWindow(focus_window); - break; + goto done; }
style = GetWindowLongA(device_window, GWL_STYLE); @@ -5148,6 +5146,59 @@ static void test_window_style(void) DestroyWindow(device_window); DestroyWindow(focus_window); } + + /* Window changes are always done no matter if it is active or not */ + focus_window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, registry_mode.dmPelsWidth / 2, registry_mode.dmPelsHeight / 2, 0, 0, 0, 0); + device_window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, registry_mode.dmPelsWidth / 2, registry_mode.dmPelsHeight / 2, 0, 0, 0, 0); + + device_style = GetWindowLongA(device_window, GWL_STYLE); + device_exstyle = GetWindowLongA(device_window, GWL_EXSTYLE); + focus_style = GetWindowLongA(focus_window, GWL_STYLE); + focus_exstyle = GetWindowLongA(focus_window, GWL_EXSTYLE); + + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + + device_desc.device_window = device_window; + device_desc.flags = CREATE_DEVICE_FULLSCREEN; + device = create_device(d3d9, focus_window, &device_desc); + ok(!!device, "Failed to create a D3D device.\n"); + + style = GetWindowLongA(device_window, GWL_STYLE); + todo_wine ok(style == device_style || broken(style == (device_style & ~WS_OVERLAPPEDWINDOW)) /* w1064v1809 */, + "Expected device window style %#x, got %#x.\n", device_style, style); + style = GetWindowLongA(device_window, GWL_EXSTYLE); + expected_style = device_exstyle | WS_EX_TOPMOST; + todo_wine ok(style == expected_style || broken(style == (expected_style & ~WS_EX_OVERLAPPEDWINDOW)) /* w1064v1809 */, + "Expected device window extended style %#x, got %#x.\n", expected_style, style); + + style = GetWindowLongA(focus_window, GWL_STYLE); + ok(style == focus_style, "Expected focus window style %#x, got %#x.\n", focus_style, style); + style = GetWindowLongA(focus_window, GWL_EXSTYLE); + ok(style == focus_exstyle, "Expected focus window extended style %#x, got %#x.\n", focus_exstyle, style); + GetWindowRect(device_window, &r); + ok(EqualRect(&r, &fullscreen_rect), "Expected %s, got %s.\n", wine_dbgstr_rect(&fullscreen_rect), wine_dbgstr_rect(&r)); + + device_desc.flags = 0; + hr = reset_device(device, &device_desc); + ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); + + style = GetWindowLongA(device_window, GWL_STYLE); + ok(style == device_style || broken(style == (device_style & ~WS_OVERLAPPEDWINDOW)) /* w1064v1809 */, + "Expected device window style %#x, got %#x.\n", device_style, style); + style = GetWindowLongA(device_window, GWL_EXSTYLE); + expected_style = device_exstyle | WS_EX_TOPMOST; + ok(style == expected_style || broken(style == (expected_style & ~WS_EX_OVERLAPPEDWINDOW)) /* w1064v1809 */, + "Expected device window extended style %#x, got %#x.\n", expected_style, style); + + ref = IDirect3DDevice9_Release(device); + ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); + +done: + DestroyWindow(device_window); + DestroyWindow(focus_window); IDirect3D9_Release(d3d9); }
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=104804
Your paranoid android.
=== w864 (64 bit report) ===
d3d9: device.c:5311: Test failed: Didn't receive MOUSEMOVE 2 (100, 100).
=== w1064v1507 (64 bit report) ===
d3d9: device.c:2213: Test failed: IDirect3DDevice9_Reset failed, hr 0x88760873. device.c:2215: Test failed: IDirect3DDevice9_TestCooperativeLevel after a successful reset returned 0x88760869. device.c:2224: Test failed: IDirect3DDevice9_GetViewport failed, hr 0x8876086c. device.c:2227: Test failed: D3DVIEWPORT->Width = 0. device.c:2228: Test failed: D3DVIEWPORT->Height = 0. device.c:2230: Test failed: D3DVIEWPORT->MaxZ = 0.000000. device.c:2233: Test failed: Failed to get swapchain, hr 0x8876086c. device.c:2236: Test failed: Failed to get present parameters, hr 0x8876086c. device.c:2237: Test failed: Got unexpected BackBufferWidth 0. device.c:2238: Test failed: Got unexpected BackBufferHeight 0.
=== debian11 (32 bit German report) ===
d3d9: d3d9ex.c:2986: Test failed: Got unexpected screen size 720x480. d3d9ex.c:3040: Test failed: Got unexpected width 720. d3d9ex.c:3041: Test failed: Got unexpected height 480. d3d9ex.c:2986: Test failed: Got unexpected screen size 720x480. d3d9ex.c:3040: Test failed: Got unexpected width 720. d3d9ex.c:3041: Test failed: Got unexpected height 480. device.c:14662: Test failed: Adapter 1: Expect window rect (640,0)-(1664,737), got (640,0)-(1280,480).
=== debian11 (32 bit French report) ===
d3d9: d3d9ex.c:3132: Test failed: Expected message 0x46 for window 0x1, but didn't receive it, i=0. device.c:14662: Test failed: Adapter 1: Expect window rect (640,0)-(1664,737), got (4,14)-(644,494).
=== debian11 (32 bit Hebrew:Israel report) ===
d3d9: device.c:4378: Test failed: Expected message 0x3 for window 0x1, but didn't receive it, i=0.
=== debian11 (32 bit Hindi:India report) ===
d3d9: d3d9ex.c:3132: Test failed: Expected message 0x46 for window 0x1, but didn't receive it, i=0. device.c:4223: Test failed: Expected message 0x46 for window 0, but didn't receive it, i=0.
=== debian11 (32 bit Japanese:Japan report) ===
d3d9: d3d9ex.c:3132: Test failed: Expected message 0x46 for window 0x1, but didn't receive it, i=0.
=== debian11 (32 bit Chinese:China report) ===
d3d9: d3d9ex.c:3132: Test failed: Expected message 0x46 for window 0x1, but didn't receive it, i=0. device.c:14662: Test failed: Adapter 0: Expect window rect (0,0)-(640,480), got (0,0)-(1024,768).
=== debian11 (32 bit WoW report) ===
d3d9: d3d9ex.c:1110: Test failed: Got screen width 720, expected 1024. d3d9ex.c:1111: Test failed: Got screen height 480, expected 768. d3d9ex.c:1689: Test failed: Got screen width 720, expected 1024. d3d9ex.c:1690: Test failed: Got screen height 480, expected 768. d3d9ex.c:2986: Test failed: Got unexpected screen size 720x480. d3d9ex.c:3040: Test failed: Got unexpected width 720. d3d9ex.c:3041: Test failed: Got unexpected height 480. d3d9ex.c:2986: Test failed: Got unexpected screen size 720x480. d3d9ex.c:3040: Test failed: Got unexpected width 720. d3d9ex.c:3041: Test failed: Got unexpected height 480. d3d9ex.c:3151: Test failed: Expected message 0x3 for window 0x1, but didn't receive it, i=1. device.c:14662: Test failed: Adapter 0: Expect window rect (0,0)-(720,480), got (4,14)-(644,494). device.c:14728: Test failed: Adapter 1: Expect window rect (720,0)-(1744,737), got (0,0)-(1024,737).
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/dxgi/tests/dxgi.c | 46 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-)
diff --git a/dlls/dxgi/tests/dxgi.c b/dlls/dxgi/tests/dxgi.c index a83964d..a7d36ac 100644 --- a/dlls/dxgi/tests/dxgi.c +++ b/dlls/dxgi/tests/dxgi.c @@ -6049,7 +6049,7 @@ done:
static void test_swapchain_window_styles(void) { - LONG style, exstyle, fullscreen_style, fullscreen_exstyle; + LONG style, exstyle, fullscreen_style, fullscreen_exstyle, expected_style; DXGI_SWAP_CHAIN_DESC swapchain_desc; IDXGISwapChain *swapchain; IDXGIFactory *factory; @@ -6058,6 +6058,7 @@ static void test_swapchain_window_styles(void) ULONG refcount; unsigned int i; HRESULT hr; + BOOL ret;
static const struct { @@ -6225,6 +6226,49 @@ static void test_swapchain_window_styles(void) DestroyWindow(swapchain_desc.OutputWindow); }
+ /* Window changes are always done no matter if it is active or not */ + swapchain_desc.OutputWindow = CreateWindowExA(0, "static", "dxgi_test", + WS_OVERLAPPED | WS_VISIBLE, 0, 0, 400, 200, 0, 0, 0, 0); + + expected_style = WS_OVERLAPPED | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CAPTION; + fullscreen_style = WS_VISIBLE | WS_CLIPSIBLINGS; + + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + hr = IDXGIFactory_CreateSwapChain(factory, (IUnknown *)device, &swapchain_desc, &swapchain); + ok(hr == S_OK, "Failed to create swapchain, hr %#x.\n", hr); + + style = GetWindowLongA(swapchain_desc.OutputWindow, GWL_STYLE); + exstyle = GetWindowLongA(swapchain_desc.OutputWindow, GWL_EXSTYLE); + ok(style == expected_style, "Got style %#x, expected %#x.\n", style, expected_style); + ok(exstyle == WS_EX_WINDOWEDGE, "Got exstyle %#x, expected %#x.\n", exstyle, (DWORD)WS_EX_WINDOWEDGE); + + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + hr = IDXGISwapChain_SetFullscreenState(swapchain, TRUE, NULL); + ok(hr == S_OK || hr == DXGI_ERROR_NOT_CURRENTLY_AVAILABLE + || broken(hr == DXGI_ERROR_UNSUPPORTED), /* Win 7 testbot */ + "Failed to set fullscreen state, hr %#x.\n", hr); + if (SUCCEEDED(hr)) + { + style = GetWindowLongA(swapchain_desc.OutputWindow, GWL_STYLE); + exstyle = GetWindowLongA(swapchain_desc.OutputWindow, GWL_EXSTYLE); + todo_wine + ok(style == fullscreen_style, "Got style %#x, expected %#x.\n", style, fullscreen_style); + ok(exstyle == WS_EX_TOPMOST, "Got exstyle %#x, expected %#x.\n", exstyle, (DWORD)WS_EX_TOPMOST); + + hr = IDXGISwapChain_SetFullscreenState(swapchain, FALSE, NULL); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + } + else + { + skip("Could not change fullscreen state %08x.\n", hr); + } + + refcount = IDXGISwapChain_Release(swapchain); + ok(!refcount, "IDXGISwapChain has %u references left.\n", refcount); + DestroyWindow(swapchain_desc.OutputWindow); + refcount = IDXGIDevice_Release(device); ok(!refcount, "Device has %u references left.\n", refcount); refcount = IDXGIFactory_Release(factory);
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=104805
Your paranoid android.
=== w1064v1507 (64 bit report) ===
dxgi: dxgi.c:5830: Test failed: Got unexpected message 0x31f, hwnd 00000000000B00A4, wparam 0x1, lparam 0.
=== debian11 (32 bit report) ===
dxgi: dxgi.c:3354: Test failed: Got monitor rect (0,0)-(720,480), expected (0,0)-(1024,768). dxgi.c:3356: Test failed: Got monitor rect (0,0)-(720,480), expected (0,0)-(1024,768). dxgi.c:3369: Test failed: Got monitor rect (0,0)-(720,480), expected (0,0)-(1024,768). dxgi.c:3354: Test failed: Got monitor rect (0,0)-(1152,768), expected (0,0)-(720,480). dxgi.c:3356: Test failed: Got monitor rect (0,0)-(1152,768), expected (0,0)-(720,480). dxgi.c:3369: Test failed: Got monitor rect (0,0)-(1152,768), expected (0,0)-(720,480).
=== debian11 (32 bit German report) ===
dxgi: dxgi.c:3354: Test failed: Got monitor rect (0,0)-(800,600), expected (0,0)-(1152,768). dxgi.c:3356: Test failed: Got monitor rect (0,0)-(800,600), expected (0,0)-(1152,768). dxgi.c:3369: Test failed: Got monitor rect (0,0)-(800,600), expected (0,0)-(1152,768).
=== debian11 (32 bit French report) ===
dxgi: dxgi.c:3644: Test failed: Got monitor rect (0,0)-(640,480), expected (0,0)-(800,600). dxgi.c:3670: Test failed: Got monitor rect (0,0)-(640,480), expected (0,0)-(800,600). dxgi.c:3699: Test failed: Got monitor rect (0,0)-(640,480), expected (0,0)-(800,600). dxgi.c:3644: Test failed: Got monitor rect (0,0)-(640,480), expected (0,0)-(800,600). dxgi.c:3670: Test failed: Got monitor rect (0,0)-(640,480), expected (0,0)-(800,600). dxgi.c:3699: Test failed: Got monitor rect (0,0)-(640,480), expected (0,0)-(800,600). dxgi.c:2614: Test failed: Got monitor rect (0,0)-(800,600), expected (0,0)-(640,480). dxgi.c:2618: Test failed: Got monitor rect (0,0)-(800,600), expected (0,0)-(640,480). dxgi.c:2687: Test failed: Got monitor rect (0,0)-(800,600), expected (0,0)-(640,480). dxgi.c:2694: Test failed: Got monitor rect (0,0)-(800,600), expected (0,0)-(640,480). dxgi.c:2687: Test failed: Got monitor rect (0,0)-(800,600), expected (0,0)-(640,480). dxgi.c:2694: Test failed: Got monitor rect (0,0)-(800,600), expected (0,0)-(640,480). dxgi.c:2709: Test failed: Got monitor rect (0,0)-(800,600), expected (0,0)-(640,480). dxgi.c:2874: Test failed: Got monitor rect (0,0)-(800,600), expected (0,0)-(640,480).
=== debian11 (32 bit Hindi:India report) ===
dxgi: dxgi.c:2196: Test failed: Got monitor rect (0,0)-(640,480), expected (0,0)-(800,600). dxgi.c:2209: Test failed: Got monitor rect (0,0)-(640,480), expected (0,0)-(800,600). dxgi.c:3354: Test failed: Got monitor rect (0,0)-(1024,768), expected (0,0)-(640,480). dxgi.c:3356: Test failed: Got monitor rect (0,0)-(1024,768), expected (0,0)-(640,480). dxgi.c:3369: Test failed: Got monitor rect (0,0)-(1024,768), expected (0,0)-(640,480).
Fixes a regression introduced by f90d607c67768f19e36d9d74b498594252faa3fd.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50370 Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com ---
The current tests were testing a hidden window only, which ddraw treats as inactive (but not d3d8/d3d9ex). Tests were added to show that even visible windows, but inactive, are not set to topmost, while active ones are.
This is ddraw specific. d3d8 and d3d9ex treat hidden windows as "active" for the purposes of window changes (so only inactive visible windows prevent changes). We have existing tests for that.
Unfortunately, most of the tests are still todo_wine, even though the WS_EX_TOPMOST style matches (except when exiting, that's fixed on last patch). That's because we don't have WS_EX_WINDOWEDGE on fullscreen windows (long-standing issue), but the topmost bit is set correctly.
dlls/ddraw/ddraw.c | 6 ++++-- dlls/ddraw/tests/ddraw1.c | 37 +++++++++++++++++++++++++++++++++++++ dlls/ddraw/tests/ddraw2.c | 37 +++++++++++++++++++++++++++++++++++++ dlls/ddraw/tests/ddraw4.c | 37 +++++++++++++++++++++++++++++++++++++ dlls/ddraw/tests/ddraw7.c | 37 +++++++++++++++++++++++++++++++++++++ 5 files changed, 152 insertions(+), 2 deletions(-)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index 5b70bb4..77172d4 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -583,8 +583,10 @@ static HRESULT ddraw_attach_d3d_device(struct ddraw *ddraw, HWND window, swapchain_desc.swap_effect = WINED3D_SWAP_EFFECT_DISCARD; swapchain_desc.device_window = window; swapchain_desc.windowed = windowed; - swapchain_desc.flags = WINED3D_SWAPCHAIN_ALLOW_MODE_SWITCH - | WINED3D_SWAPCHAIN_IMPLICIT | WINED3D_SWAPCHAIN_NO_WINDOW_CHANGES; + swapchain_desc.flags = WINED3D_SWAPCHAIN_ALLOW_MODE_SWITCH | WINED3D_SWAPCHAIN_IMPLICIT; + + if (window != GetForegroundWindow()) + swapchain_desc.flags |= WINED3D_SWAPCHAIN_NO_WINDOW_CHANGES;
if (ddraw->flags & DDRAW_NO3D) return wined3d_swapchain_create(ddraw->wined3d_device, &swapchain_desc, diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index c9f2aea..f613d91 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -2636,6 +2636,43 @@ static void test_window_style(void) tmp = GetWindowLongA(window, GWL_EXSTYLE); ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp);
+ ShowWindow(window, SW_SHOW); + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + expected_style = style | WS_VISIBLE; + todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + + GetWindowRect(window, &r); + ok(EqualRect(&r, &fullscreen_rect), "Expected %s, got %s.\n", + wine_dbgstr_rect(&fullscreen_rect), wine_dbgstr_rect(&r)); + + ret = SetForegroundWindow(window); + ok(ret, "Failed to set foreground window.\n"); + hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + expected_style = style | WS_VISIBLE; + todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + + ShowWindow(window, SW_HIDE); + hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + ShowWindow(window, SW_SHOW); hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 7285c1c..88e5659 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -2714,6 +2714,43 @@ static void test_window_style(void) tmp = GetWindowLongA(window, GWL_EXSTYLE); ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp);
+ ShowWindow(window, SW_SHOW); + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + expected_style = style | WS_VISIBLE; + todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + + GetWindowRect(window, &r); + ok(EqualRect(&r, &fullscreen_rect), "Expected %s, got %s.\n", + wine_dbgstr_rect(&fullscreen_rect), wine_dbgstr_rect(&r)); + + ret = SetForegroundWindow(window); + ok(ret, "Failed to set foreground window.\n"); + hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + expected_style = style | WS_VISIBLE; + todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + + ShowWindow(window, SW_HIDE); + hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + ShowWindow(window, SW_SHOW); hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 07afc44..170d843 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -2950,6 +2950,43 @@ static void test_window_style(void) tmp = GetWindowLongA(window, GWL_EXSTYLE); ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp);
+ ShowWindow(window, SW_SHOW); + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + expected_style = style | WS_VISIBLE; + todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + + GetWindowRect(window, &r); + ok(EqualRect(&r, &fullscreen_rect), "Expected %s, got %s.\n", + wine_dbgstr_rect(&fullscreen_rect), wine_dbgstr_rect(&r)); + + ret = SetForegroundWindow(window); + ok(ret, "Failed to set foreground window.\n"); + hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + expected_style = style | WS_VISIBLE; + todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + + ShowWindow(window, SW_HIDE); + hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + ShowWindow(window, SW_SHOW); hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 29fa343..22f581b 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -2615,6 +2615,43 @@ static void test_window_style(void) tmp = GetWindowLongA(window, GWL_EXSTYLE); ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp);
+ ShowWindow(window, SW_SHOW); + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + expected_style = style | WS_VISIBLE; + todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + + GetWindowRect(window, &r); + ok(EqualRect(&r, &fullscreen_rect), "Expected %s, got %s.\n", + wine_dbgstr_rect(&fullscreen_rect), wine_dbgstr_rect(&r)); + + ret = SetForegroundWindow(window); + ok(ret, "Failed to set foreground window.\n"); + hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + expected_style = style | WS_VISIBLE; + todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + + ShowWindow(window, SW_HIDE); + hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + ShowWindow(window, SW_SHOW); hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr);
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=104806
Your paranoid android.
=== w10pro64 (32 bit report) ===
ddraw: ddraw7.c:18713: Test failed: Got unexpected color 0x00000040.
=== debian11 (32 bit report) ===
ddraw: ddraw1.c:3952: Test failed: Got a different mode.
=== debian11 (32 bit Arabic:Morocco report) ===
ddraw: ddraw4.c:3873: Test failed: Expected screen size 2 1024x768, got 640x480. ddraw4.c:3881: Test failed: Expected (0,0)-(1024,768), got (0,0)-(640,480). ddraw4.c:3893: Test failed: Expected surface width 1024, got 640. ddraw4.c:3895: Test failed: Expected surface height 768, got 480. ddraw4.c:4391: Test failed: Got a different mode.
=== debian11 (32 bit German report) ===
ddraw: ddraw2.c:4081: Test failed: Got a different mode.
=== debian11 (32 bit French report) ===
ddraw: ddraw7.c:3948: Test failed: Got a different mode.
=== debian11 (32 bit Hebrew:Israel report) ===
ddraw: ddraw4.c:4166: Test failed: Got unexpected screen width 640. ddraw4.c:4168: Test failed: Got unexpected screen height 480. ddraw4.c:4189: Test failed: Got unexpected screen width 640. ddraw4.c:4191: Test failed: Got unexpected screen height 480. ddraw4.c:4196: Test failed: Got unexpected screen width 640. ddraw4.c:4198: Test failed: Got unexpected screen height 480.
=== debian11 (32 bit Hindi:India report) ===
ddraw: ddraw4.c:4196: Test failed: Got unexpected screen width 800. ddraw4.c:4198: Test failed: Got unexpected screen height 600. ddraw7.c:3708: Test failed: Got unexpected screen width 800. ddraw7.c:3710: Test failed: Got unexpected screen height 600. ddraw7.c:3733: Test failed: Got unexpected screen width 800. ddraw7.c:3735: Test failed: Got unexpected screen height 600. ddraw7.c:3740: Test failed: Got unexpected screen width 800. ddraw7.c:3742: Test failed: Got unexpected screen height 600. ddraw7.c:3764: Test failed: Got unexpected screen width 800. ddraw7.c:3766: Test failed: Got unexpected screen height 600. ddraw7.c:3771: Test failed: Got unexpected screen width 800. ddraw7.c:3773: Test failed: Got unexpected screen height 600. ddraw7.c:3795: Test failed: Got unexpected screen width 800. ddraw7.c:3797: Test failed: Got unexpected screen height 600. ddraw7.c:3830: Test failed: Got unexpected screen width 800. ddraw7.c:3832: Test failed: Got unexpected screen height 600. ddraw7.c:3853: Test failed: Got unexpected screen width 800. ddraw7.c:3855: Test failed: Got unexpected screen height 600. ddraw7.c:3860: Test failed: Got unexpected screen width 800. ddraw7.c:3862: Test failed: Got unexpected screen height 600. ddraw7.c:4055: Test failed: Got a different mode.
=== debian11 (32 bit Japanese:Japan report) ===
ddraw: ddraw2.c:3641: Test failed: Expected screen size 2 1024x768, got 640x480. ddraw2.c:3649: Test failed: Expected (0,0)-(1024,768), got (0,0)-(640,480). ddraw2.c:3661: Test failed: Expected surface width 1024, got 640. ddraw2.c:3663: Test failed: Expected surface height 768, got 480.
=== debian11 (32 bit Chinese:China report) ===
ddraw: ddraw1.c:14269: Test failed: Expect window rect (0,0)-(640,480), got (0,0)-(1024,737). ddraw1.c:14276: Test failed: Expect window rect (0,0)-(640,480), got (0,0)-(1024,737). ddraw2.c:2730: Test failed: Expected (0,0)-(640,480), got (-32000,-32000)-(-31840,-31975). ddraw2.c:2750: Test failed: Expected window style 0x4cf0000, got 0xb40b0000.
=== debian11 (32 bit WoW report) ===
ddraw: ddraw4.c:4100: Test failed: Got unexpected screen width 800. ddraw4.c:4102: Test failed: Got unexpected screen height 600. ddraw4.c:4107: Test failed: Got unexpected screen width 800. ddraw4.c:4109: Test failed: Got unexpected screen height 600. ddraw4.c:4131: Test failed: Got unexpected screen width 800. ddraw4.c:4133: Test failed: Got unexpected screen height 600. ddraw4.c:4166: Test failed: Got unexpected screen width 800. ddraw4.c:4168: Test failed: Got unexpected screen height 600. ddraw4.c:4189: Test failed: Got unexpected screen width 800. ddraw4.c:4191: Test failed: Got unexpected screen height 600. ddraw4.c:4196: Test failed: Got unexpected screen width 800. ddraw4.c:4198: Test failed: Got unexpected screen height 600. ddraw7.c:2631: Test failed: Expected (0,0)-(640,480), got (-32000,-32000)-(-31840,-31976). ddraw7.c:2651: Test failed: Expected window style 0x4cf0000, got 0xb40b0000.
=== debian11 (64 bit WoW report) ===
ddraw: ddraw1.c:14251: Test failed: Expect window rect (0,0)-(640,480), got (0,0)-(1024,768). ddraw1.c:14269: Test failed: Expect window rect (0,0)-(640,480), got (0,0)-(1024,768). ddraw1.c:14276: Test failed: Expect window rect (0,0)-(640,480), got (0,0)-(1024,768). ddraw1.c:14251: Test failed: Expect window rect (0,0)-(640,480), got (0,0)-(1024,737). ddraw1.c:14269: Test failed: Expect window rect (0,0)-(640,480), got (1024,0)-(2048,737). ddraw1.c:14276: Test failed: Expect window rect (0,0)-(640,480), got (1024,0)-(2048,737). ddraw2.c:4383: Test failed: Display mode restored after good ddraw1::SetCooperativeLevel call ddraw2.c:15193: Test failed: Expect window rect (0,0)-(640,480), got (1024,0)-(2048,737). ddraw2.c:15200: Test failed: Expect window rect (0,0)-(640,480), got (1024,0)-(2048,737).
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/ddraw/ddraw.c | 14 ++++----- dlls/ddraw/tests/ddraw1.c | 65 +++++++++++++++++++++++++++++++++++++++ dlls/ddraw/tests/ddraw2.c | 65 +++++++++++++++++++++++++++++++++++++++ dlls/ddraw/tests/ddraw4.c | 65 +++++++++++++++++++++++++++++++++++++++ dlls/ddraw/tests/ddraw7.c | 65 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 267 insertions(+), 7 deletions(-)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index 77172d4..ff78dae 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -559,7 +559,7 @@ static HRESULT ddraw_set_focus_window(struct ddraw *ddraw, HWND window) }
static HRESULT ddraw_attach_d3d_device(struct ddraw *ddraw, HWND window, - BOOL windowed, struct wined3d_swapchain **wined3d_swapchain) + DWORD cooplevel, struct wined3d_swapchain **wined3d_swapchain) { struct wined3d_swapchain_desc swapchain_desc; struct wined3d_display_mode mode; @@ -582,10 +582,10 @@ static HRESULT ddraw_attach_d3d_device(struct ddraw *ddraw, HWND window, swapchain_desc.backbuffer_count = 1; swapchain_desc.swap_effect = WINED3D_SWAP_EFFECT_DISCARD; swapchain_desc.device_window = window; - swapchain_desc.windowed = windowed; + swapchain_desc.windowed = !(cooplevel & DDSCL_FULLSCREEN); swapchain_desc.flags = WINED3D_SWAPCHAIN_ALLOW_MODE_SWITCH | WINED3D_SWAPCHAIN_IMPLICIT;
- if (window != GetForegroundWindow()) + if ((cooplevel & DDSCL_NOWINDOWCHANGES) || window != GetForegroundWindow()) swapchain_desc.flags |= WINED3D_SWAPCHAIN_NO_WINDOW_CHANGES;
if (ddraw->flags & DDRAW_NO3D) @@ -642,7 +642,7 @@ static HRESULT ddraw_attach_d3d_device(struct ddraw *ddraw, HWND window, return DD_OK; }
-static HRESULT ddraw_create_swapchain(struct ddraw *ddraw, HWND window, BOOL windowed) +static HRESULT ddraw_create_swapchain(struct ddraw *ddraw, HWND window, DWORD cooplevel) { HRESULT hr;
@@ -652,7 +652,7 @@ static HRESULT ddraw_create_swapchain(struct ddraw *ddraw, HWND window, BOOL win return E_FAIL; }
- if (FAILED(hr = ddraw_attach_d3d_device(ddraw, window, windowed, &ddraw->wined3d_swapchain))) + if (FAILED(hr = ddraw_attach_d3d_device(ddraw, window, cooplevel, &ddraw->wined3d_swapchain))) { ERR("Failed to create swapchain, hr %#x.\n", hr); return hr; @@ -778,7 +778,7 @@ static HRESULT WINAPI ddraw1_RestoreDisplayMode(IDirectDraw *iface) * Unsure about this: DDSCL_FPUSETUP * * These don't seem very important for wine: - * DDSCL_ALLOWREBOOT, DDSCL_NOWINDOWCHANGES, DDSCL_ALLOWMODEX + * DDSCL_ALLOWREBOOT, DDSCL_ALLOWMODEX * * Returns: * DD_OK if the cooperative level was set successfully @@ -947,7 +947,7 @@ static HRESULT ddraw_set_cooperative_level(struct ddraw *ddraw, HWND window, ddraw_destroy_swapchain(ddraw); }
- if (FAILED(hr = ddraw_create_swapchain(ddraw, window, !(cooplevel & DDSCL_FULLSCREEN)))) + if (FAILED(hr = ddraw_create_swapchain(ddraw, window, cooplevel))) ERR("Failed to create swapchain, hr %#x.\n", hr);
if (restore_state) diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index f613d91..c9cb638 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -2636,6 +2636,71 @@ static void test_window_style(void) tmp = GetWindowLongA(window, GWL_EXSTYLE); ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp);
+ hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN | DDSCL_NOWINDOWCHANGES); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + todo_wine ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + + hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + expected_style = style | WS_VISIBLE; + todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + + ShowWindow(window, SW_HIDE); + tmp = GetWindowLongA(window, GWL_STYLE); + todo_wine ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + + hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL | DDSCL_NOWINDOWCHANGES); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + + hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + + ret = SetForegroundWindow(window); + ok(ret, "Failed to set foreground window.\n"); + + hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + expected_style = style | WS_VISIBLE; + todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + + ShowWindow(window, SW_HIDE); + hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + ShowWindow(window, SW_SHOW); ret = SetForegroundWindow(GetDesktopWindow()); ok(ret, "Failed to set foreground window.\n"); diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 88e5659..fa53319 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -2714,6 +2714,71 @@ static void test_window_style(void) tmp = GetWindowLongA(window, GWL_EXSTYLE); ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp);
+ hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN | DDSCL_NOWINDOWCHANGES); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + todo_wine ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + + hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + expected_style = style | WS_VISIBLE; + todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + + ShowWindow(window, SW_HIDE); + tmp = GetWindowLongA(window, GWL_STYLE); + todo_wine ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + + hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL | DDSCL_NOWINDOWCHANGES); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + + hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + + ret = SetForegroundWindow(window); + ok(ret, "Failed to set foreground window.\n"); + + hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + expected_style = style | WS_VISIBLE; + todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + + ShowWindow(window, SW_HIDE); + hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + ShowWindow(window, SW_SHOW); ret = SetForegroundWindow(GetDesktopWindow()); ok(ret, "Failed to set foreground window.\n"); diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 170d843..738448f 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -2950,6 +2950,71 @@ static void test_window_style(void) tmp = GetWindowLongA(window, GWL_EXSTYLE); ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp);
+ hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN | DDSCL_NOWINDOWCHANGES); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + todo_wine ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + + hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + expected_style = style | WS_VISIBLE; + todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + + ShowWindow(window, SW_HIDE); + tmp = GetWindowLongA(window, GWL_STYLE); + todo_wine ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + + hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL | DDSCL_NOWINDOWCHANGES); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + + hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + + ret = SetForegroundWindow(window); + ok(ret, "Failed to set foreground window.\n"); + + hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + expected_style = style | WS_VISIBLE; + todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + + ShowWindow(window, SW_HIDE); + hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + ShowWindow(window, SW_SHOW); ret = SetForegroundWindow(GetDesktopWindow()); ok(ret, "Failed to set foreground window.\n"); diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 22f581b..9d43a9b 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -2615,6 +2615,71 @@ static void test_window_style(void) tmp = GetWindowLongA(window, GWL_EXSTYLE); ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp);
+ hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN | DDSCL_NOWINDOWCHANGES); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + todo_wine ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + + hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + expected_style = style | WS_VISIBLE; + todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + + ShowWindow(window, SW_HIDE); + tmp = GetWindowLongA(window, GWL_STYLE); + todo_wine ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + + hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL | DDSCL_NOWINDOWCHANGES); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + + hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + + ret = SetForegroundWindow(window); + ok(ret, "Failed to set foreground window.\n"); + + hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + expected_style = style | WS_VISIBLE; + todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + + ShowWindow(window, SW_HIDE); + hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + ShowWindow(window, SW_SHOW); ret = SetForegroundWindow(GetDesktopWindow()); ok(ret, "Failed to set foreground window.\n");
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=104807
Your paranoid android.
=== w1064_tsign (32 bit report) ===
ddraw: ddraw7.c:18778: Test failed: Got unexpected color 0x0000ff00.
=== w864 (64 bit report) ===
ddraw: ddraw7.c:3445: Test failed: Failed to create surface, hr 0x887601c2. 0b2c:ddraw7: unhandled exception c0000005 at 000000000050F2BF
=== debian11 (32 bit Arabic:Morocco report) ===
ddraw: ddraw2.c:6772: Test failed: Failed to attach surface, hr 0x8876000a. ddraw2.c:6775: Test failed: Got unexpected hr 0x8876000a. ddraw2.c:6777: Test failed: Failed to detach surface, hr 0x88760014. ddraw2.c:6780: Test failed: Failed to attach surface, hr 0x8876000a. ddraw2.c:6785: Test failed: Failed to detach surface, hr 0x88760014. ddraw4.c:2982: Test failed: Expected window style 0x4cf0000, got 0xb40b0000. ddraw4.c:2985: Test failed: Expected window extended style 0x108, got 0x8. ddraw4.c:2991: Test failed: Expected window style 0x4cf0000, got 0xb40b0000. ddraw4.c:2994: Test failed: Expected window extended style 0x108, got 0x8. ddraw4.c:3014: Test failed: Expected window style 0x4cf0000, got 0xb40b0000. ddraw4.c:3031: Test failed: Expected (0,0)-(640,480), got (-32000,-32000)-(-31840,-31976). ddraw4.c:3051: Test failed: Expected window style 0x4cf0000, got 0xb40b0000.
=== debian11 (32 bit French report) ===
ddraw: ddraw2.c:15258: Test failed: Expect window rect (0,0)-(640,480), got (1024,0)-(2048,737). ddraw2.c:15265: Test failed: Expect window rect (0,0)-(640,480), got (1024,0)-(2048,737).
=== debian11 (32 bit Hebrew:Israel report) ===
ddraw: ddraw4.c:3938: Test failed: Expected screen size 2 640x480, got 720x480. ddraw4.c:3946: Test failed: Expected (0,0)-(640,480), got (0,0)-(720,480). ddraw4.c:3958: Test failed: Expected surface width 640, got 720.
=== debian11 (32 bit Japanese:Japan report) ===
ddraw: ddraw2.c:3510: Test failed: Expected (0,0)-(640,480), got (0,0)-(1024,768). ddraw2.c:3532: Test failed: Expected (0,0)-(640,480), got (0,0)-(1024,768). ddraw2.c:3558: Test failed: Expected (0,0)-(640,480), got (0,0)-(1024,768).
=== debian11 (32 bit Chinese:China report) ===
ddraw: ddraw1.c:3962: Test failed: Got a different mode.
=== debian11 (32 bit WoW report) ===
ddraw: ddraw2.c:15258: Test failed: Expect window rect (0,0)-(640,480), got (0,0)-(1024,737). ddraw2.c:15265: Test failed: Expect window rect (0,0)-(640,480), got (0,0)-(1024,737). ddraw4.c:2982: Test failed: Expected window style 0x4cf0000, got 0xb40b0000. ddraw4.c:2985: Test failed: Expected window extended style 0x108, got 0x8. ddraw4.c:2991: Test failed: Expected window style 0x4cf0000, got 0xb40b0000. ddraw4.c:2994: Test failed: Expected window extended style 0x108, got 0x8. ddraw4.c:3014: Test failed: Expected window style 0x4cf0000, got 0xb40b0000. ddraw4.c:3031: Test failed: Expected (0,0)-(640,480), got (-32000,-32000)-(-31840,-31976). ddraw4.c:3051: Test failed: Expected window style 0x4cf0000, got 0xb40b0000. ddraw7.c:3798: Test failed: Got unexpected screen width 800. ddraw7.c:3800: Test failed: Got unexpected screen height 600. ddraw7.c:3805: Test failed: Got unexpected screen width 800. ddraw7.c:3807: Test failed: Got unexpected screen height 600. ddraw7.c:3829: Test failed: Got unexpected screen width 800. ddraw7.c:3831: Test failed: Got unexpected screen height 600. ddraw7.c:3836: Test failed: Got unexpected screen width 800. ddraw7.c:3838: Test failed: Got unexpected screen height 600. ddraw7.c:3860: Test failed: Got unexpected screen width 800. ddraw7.c:3862: Test failed: Got unexpected screen height 600. ddraw7.c:3895: Test failed: Got unexpected screen width 800. ddraw7.c:3897: Test failed: Got unexpected screen height 600. ddraw7.c:3918: Test failed: Got unexpected screen width 800. ddraw7.c:3920: Test failed: Got unexpected screen height 600. ddraw7.c:3925: Test failed: Got unexpected screen width 800. ddraw7.c:3927: Test failed: Got unexpected screen height 600.
=== debian11 (64 bit WoW report) ===
ddraw: ddraw1.c:14316: Test failed: Expect window rect (0,0)-(640,480), got (0,0)-(1024,768). ddraw1.c:14334: Test failed: Expect window rect (0,0)-(640,480), got (0,0)-(1024,768). ddraw1.c:14341: Test failed: Expect window rect (0,0)-(640,480), got (0,0)-(1024,768). ddraw1.c:14316: Test failed: Expect window rect (0,0)-(640,480), got (0,0)-(1024,737). ddraw1.c:14334: Test failed: Expect window rect (0,0)-(640,480), got (1024,0)-(2048,737). ddraw1.c:14341: Test failed: Expect window rect (0,0)-(640,480), got (1024,0)-(2048,737). ddraw2.c:3510: Test failed: Expected (0,0)-(640,480), got (0,0)-(1024,768). ddraw2.c:3532: Test failed: Expected (0,0)-(640,480), got (0,0)-(1024,768). ddraw2.c:3558: Test failed: Expected (0,0)-(640,480), got (0,0)-(1024,768). ddraw2.c:3578: Test failed: Expected (0,0)-(640,480), got (0,0)-(1024,768). ddraw2.c:3615: Test failed: Expected (0,0)-(640,480), got (0,0)-(1024,768). ddraw2.c:4448: Test failed: Display mode restored after good ddraw1::SetCooperativeLevel call ddraw2.c:15258: Test failed: Expect window rect (0,0)-(640,480), got (1024,0)-(2048,737). ddraw2.c:15265: Test failed: Expect window rect (0,0)-(640,480), got (1024,0)-(2048,737).
Unless DDSCL_NOWINDOWCHANGES was specified.
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com ---
This is ddraw specific, because the flag specified when exiting fullscreen is what matters. wined3d restores from fullscreen when the swapchain is destroyed, in wined3d_swapchain_cleanup, which uses the *original* flags passed when the swapchain was created, so WINED3D_SWAPCHAIN_RESTORE_WINDOW_STATE can't be used; that would affect the restoring behavior at creation, which is not correct for ddraw (but is for dxgi).
I'm not sure how to do this on wined3d side cleanly without passing the flag somehow at swapchain destruction...
dlls/ddraw/ddraw.c | 3 +++ dlls/ddraw/tests/ddraw1.c | 4 ++-- dlls/ddraw/tests/ddraw2.c | 4 ++-- dlls/ddraw/tests/ddraw4.c | 4 ++-- dlls/ddraw/tests/ddraw7.c | 4 ++-- 5 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index ff78dae..8b95860 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -970,6 +970,9 @@ static HRESULT ddraw_set_cooperative_level(struct ddraw *ddraw, HWND window,
if (!(cooplevel & DDSCL_EXCLUSIVE) && (ddraw->cooperative_level & DDSCL_EXCLUSIVE)) { + if (!(cooplevel & DDSCL_NOWINDOWCHANGES)) + SetWindowPos(window, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); + if (restore_mode_on_normal && FAILED(ddraw7_RestoreDisplayMode(&ddraw->IDirectDraw7_iface))) ERR("RestoreDisplayMode failed\n"); ClipCursor(NULL); diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index c9cb638..89352fb 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -2699,7 +2699,7 @@ static void test_window_style(void) tmp = GetWindowLongA(window, GWL_STYLE); ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp); tmp = GetWindowLongA(window, GWL_EXSTYLE); - todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp);
ShowWindow(window, SW_SHOW); ret = SetForegroundWindow(GetDesktopWindow()); @@ -2736,7 +2736,7 @@ static void test_window_style(void) tmp = GetWindowLongA(window, GWL_STYLE); ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp); tmp = GetWindowLongA(window, GWL_EXSTYLE); - todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp);
ShowWindow(window, SW_SHOW); hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index fa53319..4fd5506 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -2777,7 +2777,7 @@ static void test_window_style(void) tmp = GetWindowLongA(window, GWL_STYLE); ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp); tmp = GetWindowLongA(window, GWL_EXSTYLE); - todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp);
ShowWindow(window, SW_SHOW); ret = SetForegroundWindow(GetDesktopWindow()); @@ -2814,7 +2814,7 @@ static void test_window_style(void) tmp = GetWindowLongA(window, GWL_STYLE); ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp); tmp = GetWindowLongA(window, GWL_EXSTYLE); - todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp);
ShowWindow(window, SW_SHOW); hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 738448f..03a7101 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -3013,7 +3013,7 @@ static void test_window_style(void) tmp = GetWindowLongA(window, GWL_STYLE); ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp); tmp = GetWindowLongA(window, GWL_EXSTYLE); - todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp);
ShowWindow(window, SW_SHOW); ret = SetForegroundWindow(GetDesktopWindow()); @@ -3050,7 +3050,7 @@ static void test_window_style(void) tmp = GetWindowLongA(window, GWL_STYLE); ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp); tmp = GetWindowLongA(window, GWL_EXSTYLE); - todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp);
ShowWindow(window, SW_SHOW); hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 9d43a9b..6551ee2 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -2678,7 +2678,7 @@ static void test_window_style(void) tmp = GetWindowLongA(window, GWL_STYLE); ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp); tmp = GetWindowLongA(window, GWL_EXSTYLE); - todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp);
ShowWindow(window, SW_SHOW); ret = SetForegroundWindow(GetDesktopWindow()); @@ -2715,7 +2715,7 @@ static void test_window_style(void) tmp = GetWindowLongA(window, GWL_STYLE); ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp); tmp = GetWindowLongA(window, GWL_EXSTYLE); - todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp);
ShowWindow(window, SW_SHOW); hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
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=104808
Your paranoid android.
=== debian11 (32 bit report) ===
ddraw: ddraw2.c:3451: Test failed: Expected (0,0)-(1024,768), got (0,0)-(640,480). ddraw2.c:4232: Test failed: Got a different mode.
=== debian11 (32 bit German report) ===
ddraw: ddraw1.c:3334: Test failed: Expected resolution 1024x768, got 640x480. ddraw1.c:3351: Test failed: Expected surface width 1024, got 640. ddraw1.c:3353: Test failed: Expected surface height 768, got 480. ddraw1.c:3367: Test failed: Expected (0,0)-(1024,768), got (0,0)-(640,480). ddraw1.c:3372: Test failed: Expected surface width 1024, got 640. ddraw1.c:3374: Test failed: Expected surface height 768, got 480. ddraw1.c:3387: Test failed: Expected surface width 1024, got 640. ddraw1.c:3389: Test failed: Expected surface height 768, got 480. ddraw1.c:3393: Test failed: Expected (0,0)-(1024,768), got (0,0)-(640,480). ddraw1.c:3416: Test failed: Expected (0,0)-(1024,768), got (0,0)-(640,480). ddraw1.c:3429: Test failed: Got unexpected hr 0. ddraw1.c:3431: Test failed: Got unexpected hr 0. ddraw1.c:3438: Test failed: Expected (0,0)-(1024,768), got (0,0)-(640,480). ddraw1.c:3443: Test failed: Expected surface width 1024, got 640. ddraw1.c:3445: Test failed: Expected surface height 768, got 480. ddraw1.c:3464: Test failed: Expected (0,0)-(1024,768), got (0,0)-(640,480). ddraw1.c:3484: Test failed: Expected (0,0)-(1024,768), got (0,0)-(640,480). ddraw1.c:3497: Test failed: Expected resolution 1024x768, got 640x480. ddraw1.c:3514: Test failed: Expected surface width 1024, got 640. ddraw1.c:3516: Test failed: Expected surface height 768, got 480. ddraw1.c:3521: Test failed: Expected (0,0)-(1024,768), got (0,0)-(640,480). ddraw2.c:6772: Test failed: Failed to attach surface, hr 0x8876000a. ddraw2.c:6775: Test failed: Got unexpected hr 0x8876000a. ddraw2.c:6777: Test failed: Failed to detach surface, hr 0x88760014. ddraw2.c:6780: Test failed: Failed to attach surface, hr 0x8876000a. ddraw2.c:6785: Test failed: Failed to detach surface, hr 0x88760014. ddraw2.c:15258: Test failed: Expect window rect (0,0)-(640,480), got (0,0)-(1024,737). ddraw2.c:15265: Test failed: Expect window rect (0,0)-(640,480), got (0,0)-(1024,737). ddraw4.c:2949: Test failed: Expected window style 0x4cf0000, got 0xb40b0000. ddraw4.c:2951: Test failed: Expected window extended style 0x100, got 0. ddraw4.c:2982: Test failed: Expected window style 0x4cf0000, got 0xb40b0000. ddraw4.c:2985: Test failed: Expected window extended style 0x108, got 0x8. ddraw4.c:2991: Test failed: Expected window style 0x4cf0000, got 0xb40b0000. ddraw4.c:2994: Test failed: Expected window extended style 0x108, got 0x8. ddraw4.c:3014: Test failed: Expected window style 0x4cf0000, got 0xb40b0000. ddraw4.c:3016: Test failed: Expected window extended style 0x100, got 0. ddraw4.c:3031: Test failed: Expected (0,0)-(640,480), got (-32000,-32000)-(-31840,-31976). ddraw4.c:3051: Test failed: Expected window style 0x4cf0000, got 0xb40b0000. ddraw4.c:3053: Test failed: Expected window extended style 0x100, got 0.
=== debian11 (32 bit French report) ===
ddraw: ddraw1.c:3104: Test failed: Expected message 0x7e, but didn't receive it. ddraw1.c:3152: Test failed: Expected message 0x47, but didn't receive it. ddraw1.c:3154: Test failed: Expected screen size 640x480, got 0x0. ddraw1.c:3160: Test failed: Expected (0,0)-(640,480), got (0,0)-(720,480). ddraw1.c:3184: Test failed: Expected surface width 640, got 720. ddraw1.c:3190: Test failed: Expected (0,0)-(640,480), got (0,0)-(720,480). ddraw1.c:3197: Test failed: Expected (0,0)-(640,480), got (0,0)-(720,480). ddraw1.c:3202: Test failed: Expected surface width 640, got 720. ddraw1.c:3217: Test failed: Expected surface width 640, got 720. ddraw1.c:3223: Test failed: Expected (0,0)-(640,480), got (0,0)-(720,480). ddraw1.c:3246: Test failed: Expected (0,0)-(640,480), got (0,0)-(720,480). ddraw1.c:3275: Test failed: Expected (0,0)-(640,480), got (0,0)-(720,480). ddraw1.c:3280: Test failed: Expected surface width 640, got 720. ddraw1.c:3301: Test failed: Expected (0,0)-(640,480), got (0,0)-(720,480). ddraw1.c:3321: Test failed: Expected (0,0)-(640,480), got (0,0)-(720,480). ddraw1.c:3334: Test failed: Expected resolution 640x480, got 720x480. ddraw1.c:3351: Test failed: Expected surface width 640, got 720. ddraw1.c:3357: Test failed: Expected (0,0)-(640,480), got (0,0)-(720,480). ddraw1.c:3367: Test failed: Expected (0,0)-(640,480), got (0,0)-(720,480). ddraw1.c:3372: Test failed: Expected surface width 640, got 720. ddraw1.c:3387: Test failed: Expected surface width 640, got 720. ddraw1.c:3393: Test failed: Expected (0,0)-(640,480), got (0,0)-(720,480). ddraw1.c:3416: Test failed: Expected (0,0)-(640,480), got (0,0)-(720,480). ddraw1.c:3429: Test failed: Got unexpected hr 0. ddraw1.c:3431: Test failed: Got unexpected hr 0. ddraw1.c:3438: Test failed: Expected (0,0)-(640,480), got (0,0)-(720,480). ddraw1.c:3443: Test failed: Expected surface width 640, got 720. ddraw1.c:3464: Test failed: Expected (0,0)-(640,480), got (0,0)-(720,480). ddraw1.c:3484: Test failed: Expected (0,0)-(640,480), got (0,0)-(720,480). ddraw1.c:3497: Test failed: Expected resolution 640x480, got 720x480. ddraw1.c:3514: Test failed: Expected surface width 640, got 720. ddraw1.c:3521: Test failed: Expected (0,0)-(640,480), got (0,0)-(720,480). ddraw2.c:15258: Test failed: Expect window rect (0,0)-(640,480), got (1024,0)-(2048,737). ddraw2.c:15265: Test failed: Expect window rect (0,0)-(640,480), got (1024,0)-(2048,737).
=== debian11 (32 bit Hindi:India report) ===
ddraw: ddraw2.c:4125: Test failed: Got a different mode.
=== debian11 (32 bit WoW report) ===
ddraw: ddraw2.c:4030: Test failed: Got unexpected screen width 640. ddraw2.c:4032: Test failed: Got unexpected screen height 480. ddraw2.c:4037: Test failed: Got unexpected screen width 640. ddraw2.c:4039: Test failed: Got unexpected screen height 480.
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=104803
Your paranoid android.
=== w8adm (32 bit report) ===
d3d8: device.c:4102: Test failed: Failed to reset device, hr 0x88760868. device.c:4822: Test failed: Failed to reset device. device.c:4828: Test failed: Expected (0,0)-(1024,768), got (0,0)-(512,384). device.c:4835: Test failed: Expected wndproc != 0x422e00. device.c:10825: Test failed: Adapter 0: SetForegroundWindow failed, error 0.
=== w1064v1809 (32 bit report) ===
d3d8: device.c:10825: Test failed: Adapter 0: SetForegroundWindow failed, error 0.
=== w1064_tsign (32 bit report) ===
d3d8: device.c:10825: Test failed: Adapter 0: SetForegroundWindow failed, error 0.
=== w10pro64 (32 bit report) ===
d3d8: device.c:10825: Test failed: Adapter 0: SetForegroundWindow failed, error 0.
=== debian11 (32 bit Hindi:India report) ===
d3d8: device.c:10799: Test failed: Adapter 1: Expect window rect (640,0)-(1664,737), got (640,0)-(1280,480). device.c:10829: Test failed: Adapter 1: Expect window rect (640,0)-(1664,737), got (0,0)-(1024,737).
=== debian11 (32 bit Japanese:Japan report) ===
d3d8: device.c:3175: Test failed: Expected message 0x3 for window 0, but didn't receive it, i=2. device.c:10799: Test failed: Adapter 0: Expect window rect (0,0)-(640,480), got (4,14)-(644,494). device.c:10799: Test failed: Adapter 1: Expect window rect (640,0)-(1664,737), got (4,14)-(644,494). device.c:10829: Test failed: Adapter 1: Expect window rect (640,0)-(1664,737), got (0,0)-(1024,737).
=== debian11 (32 bit Chinese:China report) ===
d3d8: device.c:3175: Test failed: Expected message 0x3 for window 0, but didn't receive it, i=2. device.c:10799: Test failed: Adapter 0: Expect window rect (0,0)-(640,480), got (4,15)-(644,495). device.c:10829: Test failed: Adapter 1: Expect window rect (640,0)-(1664,737), got (0,0)-(1024,737).
Am Montag, 3. Jänner 2022, 15:08:07 CET schrieb Gabriel Ivăncescu:
- ret = SetForegroundWindow(GetDesktopWindow());
- ok(ret, "Failed to set foreground window.\n");
- device_desc.device_window = device_window;
- device_desc.flags = CREATE_DEVICE_FULLSCREEN;
- device = create_device(d3d8, focus_window, &device_desc);
- ok(!!device, "Failed to create a D3D device.\n");
- ShowWindow(device_window, SW_SHOWNOACTIVATE);
- /* 32-bit tests ran under Windows 8 and 10 testbots have pretty
inconsistent behavior but topmost is set even when inactive. */
- style = GetWindowLongA(device_window, GWL_EXSTYLE);
Is it a matter of the active window, foreground window or the current thread being foreground? The active Window (Get/SetActiveWindow) is a per-thread property and the foreground window the desktop-global properly. Afaiu a window can be active for the current thread without being the foreground window.
One way to test this would be to create a third window on the same thread and make it the foreground window instead of the desktop window. I don't remember exactly what happens when you call SetForegroundWindow(desktop); SetActiveWindow(device_window). I assume it makes the test behave differently, which is why you use SW_SHOWNOACTIVATE.
If what I wrote is complete junk ignore me. It's been a few years since I worked on the alt-tab stuff...
On 04/01/2022 15:53, Stefan Dösinger wrote:
Am Montag, 3. Jänner 2022, 15:08:07 CET schrieb Gabriel Ivăncescu:
- ret = SetForegroundWindow(GetDesktopWindow());
- ok(ret, "Failed to set foreground window.\n");
- device_desc.device_window = device_window;
- device_desc.flags = CREATE_DEVICE_FULLSCREEN;
- device = create_device(d3d8, focus_window, &device_desc);
- ok(!!device, "Failed to create a D3D device.\n");
- ShowWindow(device_window, SW_SHOWNOACTIVATE);
- /* 32-bit tests ran under Windows 8 and 10 testbots have pretty
inconsistent behavior but topmost is set even when inactive. */
- style = GetWindowLongA(device_window, GWL_EXSTYLE);
Is it a matter of the active window, foreground window or the current thread being foreground? The active Window (Get/SetActiveWindow) is a per-thread property and the foreground window the desktop-global properly. Afaiu a window can be active for the current thread without being the foreground window.
One way to test this would be to create a third window on the same thread and make it the foreground window instead of the desktop window. I don't remember exactly what happens when you call SetForegroundWindow(desktop); SetActiveWindow(device_window). I assume it makes the test behave differently, which is why you use SW_SHOWNOACTIVATE.
If what I wrote is complete junk ignore me. It's been a few years since I worked on the alt-tab stuff...
I see what you mean, I'll have to test it. The reason I do ShowWindow(device_window, SW_SHOWNOACTIVATE) though is because on some Windows versions it seems to have it minimized when created inactive—I don't think it's worth replicating this though.
Looks like d3d8 is unique; unlike d3d9ex, it checks if the foreground window belongs to the thread, where d3d9ex explicitly checks for focus_window instead.
ddraw is like d3d9ex where it checks its window explicitly, but it differs from both d3d8 and d3d9ex in that it treats an invisible window as "not active" and doesn't do changes—both d3d8 and d3d9ex do changes if the window is invisible.