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 not foreground, are not set to topmost, while foreground ones are.
This is ddraw specific. d3d8 and d3d9ex treat hidden windows as "active" for the purposes of window changes (so only visible windows, if inactive, 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 3rd 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 | 67 ++++++++++++++++++++++++++++++++++++++- dlls/ddraw/tests/ddraw2.c | 67 ++++++++++++++++++++++++++++++++++++++- dlls/ddraw/tests/ddraw4.c | 67 ++++++++++++++++++++++++++++++++++++++- dlls/ddraw/tests/ddraw7.c | 67 ++++++++++++++++++++++++++++++++++++++- 5 files changed, 268 insertions(+), 6 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 efbecf0..137469c 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -2585,14 +2585,16 @@ static void test_window_style(void) { LONG style, exstyle, tmp, expected_style; RECT fullscreen_rect, r; + HWND window, window2; IDirectDraw *ddraw; - HWND window; HRESULT hr; ULONG ref; BOOL ret;
window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, 0, 0); + window2 = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 50, 50, 0, 0, 0, 0); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n");
@@ -2636,6 +2638,68 @@ 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"); + SetActiveWindow(window); + ok(GetActiveWindow() == window, "Unexpected active 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)); + + hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + SetWindowPos(window, NULL, 0, 0, 100, 100, SWP_NOZORDER | SWP_NOACTIVATE); + GetWindowRect(window, &r); + ok(!EqualRect(&r, &fullscreen_rect), "Window resize failed? got %s.\n", + wine_dbgstr_rect(&r)); + + ret = SetForegroundWindow(window2); + 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); @@ -2659,6 +2723,7 @@ static void test_window_style(void) ref = IDirectDraw_Release(ddraw); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref);
+ DestroyWindow(window2); DestroyWindow(window); }
diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 65ac21d..f3801ef 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -2663,14 +2663,16 @@ static void test_window_style(void) { LONG style, exstyle, tmp, expected_style; RECT fullscreen_rect, r; + HWND window, window2; IDirectDraw2 *ddraw; - HWND window; HRESULT hr; ULONG ref; BOOL ret;
window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, 0, 0); + window2 = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 50, 50, 0, 0, 0, 0); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n");
@@ -2714,6 +2716,68 @@ 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"); + SetActiveWindow(window); + ok(GetActiveWindow() == window, "Unexpected active 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)); + + hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + SetWindowPos(window, NULL, 0, 0, 100, 100, SWP_NOZORDER | SWP_NOACTIVATE); + GetWindowRect(window, &r); + ok(!EqualRect(&r, &fullscreen_rect), "Window resize failed? got %s.\n", + wine_dbgstr_rect(&r)); + + ret = SetForegroundWindow(window2); + 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); @@ -2737,6 +2801,7 @@ static void test_window_style(void) ref = IDirectDraw2_Release(ddraw); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref);
+ DestroyWindow(window2); DestroyWindow(window); }
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index ce2333d..9c22103 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -2899,14 +2899,16 @@ static void test_window_style(void) { LONG style, exstyle, tmp, expected_style; RECT fullscreen_rect, r; + HWND window, window2; IDirectDraw4 *ddraw; - HWND window; HRESULT hr; ULONG ref; BOOL ret;
window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, 0, 0); + window2 = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 50, 50, 0, 0, 0, 0); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n");
@@ -2950,6 +2952,68 @@ 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"); + SetActiveWindow(window); + ok(GetActiveWindow() == window, "Unexpected active 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)); + + hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + SetWindowPos(window, NULL, 0, 0, 100, 100, SWP_NOZORDER | SWP_NOACTIVATE); + GetWindowRect(window, &r); + ok(!EqualRect(&r, &fullscreen_rect), "Window resize failed? got %s.\n", + wine_dbgstr_rect(&r)); + + ret = SetForegroundWindow(window2); + 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); @@ -2973,6 +3037,7 @@ static void test_window_style(void) ref = IDirectDraw4_Release(ddraw); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref);
+ DestroyWindow(window2); DestroyWindow(window); }
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 4cf57bf..7cadb88 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -2564,14 +2564,16 @@ static void test_window_style(void) { LONG style, exstyle, tmp, expected_style; RECT fullscreen_rect, r; + HWND window, window2; IDirectDraw7 *ddraw; - HWND window; HRESULT hr; ULONG ref; BOOL ret;
window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, 0, 0); + window2 = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 50, 50, 0, 0, 0, 0); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n");
@@ -2615,6 +2617,68 @@ 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"); + SetActiveWindow(window); + ok(GetActiveWindow() == window, "Unexpected active 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)); + + hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + SetWindowPos(window, NULL, 0, 0, 100, 100, SWP_NOZORDER | SWP_NOACTIVATE); + GetWindowRect(window, &r); + ok(!EqualRect(&r, &fullscreen_rect), "Window resize failed? got %s.\n", + wine_dbgstr_rect(&r)); + + ret = SetForegroundWindow(window2); + 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); @@ -2638,6 +2702,7 @@ static void test_window_style(void) ref = IDirectDraw7_Release(ddraw); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref);
+ DestroyWindow(window2); DestroyWindow(window); }
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 137469c..95904ab 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -2638,6 +2638,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 f3801ef..6092528 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -2716,6 +2716,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 9c22103..50ea812 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -2952,6 +2952,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 7cadb88..67f6893 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -2617,6 +2617,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=105329
Your paranoid android.
=== w8adm (32 bit report) ===
ddraw: 0d1c:ddraw4: unhandled exception c0000005 at 6A8E3599
=== w8adm (32 bit report) ===
ddraw: ddraw7.c:18844: Test failed: Got unexpected color 0x0000ff00.
=== debian11 (32 bit report) ===
ddraw: ddraw4.c:4224: Test failed: Got unexpected screen width 640. ddraw4.c:4226: Test failed: Got unexpected screen height 480. ddraw4.c:4259: Test failed: Got unexpected screen width 640. ddraw4.c:4261: Test failed: Got unexpected screen height 480. ddraw4.c:4282: Test failed: Got unexpected screen width 640. ddraw4.c:4284: Test failed: Got unexpected screen height 480. ddraw4.c:4289: Test failed: Got unexpected screen width 640. ddraw4.c:4291: Test failed: Got unexpected screen height 480.
=== debian11 (32 bit Arabic:Morocco report) ===
ddraw: ddraw7.c:5263: Test failed: Display mode not restored after bad ddraw1::SetCooperativeLevel call ddraw7.c:18628: Test failed: Expect window rect (0,0)-(640,480), got (0,0)-(1024,737). ddraw7.c:18635: Test failed: Expect window rect (0,0)-(640,480), got (0,0)-(1024,737).
=== debian11 (32 bit German report) ===
ddraw: ddraw4.c:3966: Test failed: Expected screen size 2 640x480, got 720x480. ddraw4.c:3986: Test failed: Expected surface width 640, got 720.
=== debian11 (32 bit French report) ===
ddraw: ddraw1.c:868: Test failed: Got unexpected wparam 1 for message 5, expected 0. ddraw1.c:3121: Test failed: Expected message 0x7e, but didn't receive it. ddraw1.c:3126: Test failed: Got unexpected screen size 720x480. ddraw1.c:3182: Test failed: Expected screen size 800x600, got 720x480. ddraw1.c:3188: Test failed: Expected (0,0)-(800,600), got (0,0)-(720,480). ddraw1.c:3212: Test failed: Expected surface width 800, got 720. ddraw1.c:3214: Test failed: Expected surface height 600, got 480. ddraw1.c:3218: Test failed: Expected (0,0)-(800,600), got (0,0)-(720,480). ddraw1.c:3225: Test failed: Expected (0,0)-(800,600), got (0,0)-(720,480). ddraw1.c:3230: Test failed: Expected surface width 800, got 720. ddraw1.c:3232: Test failed: Expected surface height 600, got 480. ddraw1.c:3245: Test failed: Expected surface width 800, got 720. ddraw1.c:3247: Test failed: Expected surface height 600, got 480. ddraw1.c:3251: Test failed: Expected (0,0)-(800,600), got (0,0)-(720,480). ddraw1.c:3274: Test failed: Expected (0,0)-(800,600), got (0,0)-(720,480). ddraw1.c:3303: Test failed: Expected (0,0)-(800,600), got (0,0)-(720,480). ddraw1.c:3308: Test failed: Expected surface width 800, got 720. ddraw1.c:3310: Test failed: Expected surface height 600, got 480. ddraw1.c:3329: Test failed: Expected (0,0)-(800,600), got (0,0)-(720,480). ddraw1.c:3349: Test failed: Expected (0,0)-(800,600), got (0,0)-(720,480). ddraw1.c:3362: Test failed: Expected resolution 800x600, got 720x480. ddraw1.c:3379: Test failed: Expected surface width 800, got 720. ddraw1.c:3381: Test failed: Expected surface height 600, got 480. ddraw1.c:3385: Test failed: Expected (0,0)-(800,600), got (0,0)-(720,480). ddraw1.c:3395: Test failed: Expected (0,0)-(800,600), got (0,0)-(720,480). ddraw1.c:3400: Test failed: Expected surface width 800, got 720. ddraw1.c:3402: Test failed: Expected surface height 600, got 480. ddraw1.c:3415: Test failed: Expected surface width 800, got 720. ddraw1.c:3417: Test failed: Expected surface height 600, got 480. ddraw1.c:3421: Test failed: Expected (0,0)-(800,600), got (0,0)-(720,480). ddraw1.c:3444: Test failed: Expected (0,0)-(800,600), got (0,0)-(720,480). ddraw1.c:3466: Test failed: Expected (0,0)-(800,600), got (0,0)-(720,480). ddraw1.c:3471: Test failed: Expected surface width 800, got 720. ddraw1.c:3473: Test failed: Expected surface height 600, got 480. ddraw1.c:3492: Test failed: Expected (0,0)-(800,600), got (0,0)-(720,480). ddraw1.c:3512: Test failed: Expected (0,0)-(800,600), got (0,0)-(720,480). ddraw1.c:3525: Test failed: Expected resolution 800x600, got 720x480. ddraw1.c:3542: Test failed: Expected surface width 800, got 720. ddraw1.c:3544: Test failed: Expected surface height 600, got 480. ddraw1.c:3549: Test failed: Expected (0,0)-(800,600), got (0,0)-(720,480). ddraw1.c:5709: Test failed: Failed to attach surface, hr 0x8876000a. ddraw1.c:5712: Test failed: Got unexpected hr 0x8876000a. ddraw1.c:5714: Test failed: Failed to detach surface, hr 0x88760014. ddraw1.c:5717: Test failed: Failed to attach surface, hr 0x8876000a. ddraw1.c:5722: Test failed: Failed to detach surface, hr 0x88760014. ddraw2.c:2715: Test failed: Expected window style 0x4cf0000, got 0xa40b0000. ddraw2.c:2748: Test failed: Expected window style 0x4cf0000, got 0xa40b0000. ddraw2.c:2751: Test failed: Expected window extended style 0x108, got 0x8. ddraw2.c:2757: Test failed: Expected window style 0x4cf0000, got 0xa40b0000. ddraw2.c:2760: Test failed: Expected window extended style 0x108, got 0x8. ddraw2.c:2780: Test failed: Expected window style 0x4cf0000, got 0xa40b0000. ddraw2.c:2799: Test failed: Expected (0,0)-(640,480), got (-32000,-32000)-(-31840,-31976). ddraw2.c:2822: Test failed: Expected (0,0)-(640,480), got (-32000,-32000)-(-31840,-31976). ddraw2.c:2842: Test failed: Expected window style 0x4cf0000, got 0xa40b0000. ddraw2.c:3538: Test failed: Expected (0,0)-(640,480), got (0,0)-(1024,768). ddraw2.c:3560: Test failed: Expected (0,0)-(640,480), got (0,0)-(1024,768). ddraw2.c:3586: Test failed: Expected (0,0)-(640,480), got (0,0)-(1024,768). ddraw2.c:3606: Test failed: Expected (0,0)-(640,480), got (0,0)-(1024,768). ddraw2.c:3643: Test failed: Expected (0,0)-(640,480), got (0,0)-(1024,768).
=== debian11 (32 bit Hebrew:Israel report) ===
ddraw: ddraw1.c:14234: Test failed: Expect clip rect (0,0)-(640,480), got (0,0)-(800,600). ddraw1.c:14366: Test failed: Expected window rect (800,0)-(1824,737), got (0,0)-(1024,737). ddraw1.c:14381: Test failed: Expected window rect (800,0)-(1824,737), got (0,0)-(1024,737). ddraw1.c:14400: Test failed: Expect window rect (0,0)-(800,600), got (0,0)-(1024,737). ddraw1.c:14407: Test failed: Expect window rect (0,0)-(800,600), got (0,0)-(1024,737). ddraw2.c:2715: Test failed: Expected window style 0x4cf0000, got 0xa40b0000. ddraw2.c:2717: Test failed: Expected window extended style 0x100, got 0. ddraw2.c:2748: Test failed: Expected window style 0x4cf0000, got 0xa40b0000. ddraw2.c:2751: Test failed: Expected window extended style 0x108, got 0x8. ddraw2.c:2757: Test failed: Expected window style 0x4cf0000, got 0xa40b0000. ddraw2.c:2760: Test failed: Expected window extended style 0x108, got 0x8. ddraw2.c:2780: Test failed: Expected window style 0x4cf0000, got 0xa40b0000. ddraw2.c:2799: Test failed: Expected (0,0)-(800,600), got (-32000,-32000)-(-31840,-31976). ddraw2.c:2822: Test failed: Expected (0,0)-(800,600), got (-32000,-32000)-(-31840,-31976). ddraw2.c:2842: Test failed: Expected window style 0x4cf0000, got 0xa40b0000. ddraw2.c:15290: Test failed: Expected window rect (800,0)-(1824,737), got (0,0)-(1024,737). ddraw2.c:15305: Test failed: Expected window rect (800,0)-(1824,737), got (0,0)-(1024,737). ddraw7.c:2616: Test failed: Expected window style 0x4cf0000, got 0xa40b0000. ddraw7.c:2649: Test failed: Expected window style 0x4cf0000, got 0xa40b0000. ddraw7.c:2652: Test failed: Expected window extended style 0x108, got 0x8. ddraw7.c:2658: Test failed: Expected window style 0x4cf0000, got 0xa40b0000. ddraw7.c:2661: Test failed: Expected window extended style 0x108, got 0x8. ddraw7.c:2681: Test failed: Expected window style 0x4cf0000, got 0xa40b0000. ddraw7.c:2700: Test failed: Expected (0,0)-(640,480), got (-32000,-32000)-(-31840,-31976). ddraw7.c:2723: Test failed: Expected (0,0)-(640,480), got (-32000,-32000)-(-31840,-31976). ddraw7.c:2743: Test failed: Expected window style 0x4cf0000, got 0xa40b0000.
=== debian11 (32 bit Chinese:China report) ===
ddraw: ddraw2.c:3538: Test failed: Expected (0,0)-(640,480), got (0,0)-(1024,768). ddraw2.c:3560: Test failed: Expected (0,0)-(640,480), got (0,0)-(1024,768). ddraw2.c:3586: Test failed: Expected (0,0)-(640,480), got (0,0)-(1024,768). ddraw2.c:3606: Test failed: Expected (0,0)-(640,480), got (0,0)-(1024,768). ddraw2.c:3643: Test failed: Expected (0,0)-(640,480), got (0,0)-(1024,768). ddraw7.c:3515: Test failed: Expected resolution 640x480, got 720x480. ddraw7.c:3532: Test failed: Expected surface width 640, got 720. ddraw7.c:3556: Test failed: Expected message 0x47, but didn't receive it. ddraw7.c:3558: Test failed: Expected screen size 640x480, got 0x0. ddraw7.c:3565: Test failed: Expected (0,0)-(640,480), got (0,0)-(720,480). ddraw7.c:3577: Test failed: Expected surface width 640, got 720. ddraw7.c:3630: Test failed: Expected screen size 2 640x480, got 720x480. ddraw7.c:3638: Test failed: Expected (0,0)-(640,480), got (0,0)-(720,480). ddraw7.c:3650: Test failed: Expected surface width 640, got 720.
Report validation errors: ddraw7: Timeout
=== debian11 (build log) ===
WineRunWineTest.pl:error: The task timed out
=== debian11 (32 bit WoW report) ===
ddraw: ddraw4.c:3688: Test failed: Expected resolution 1024x768, got 720x480. ddraw4.c:3705: Test failed: Expected surface width 1024, got 720. ddraw4.c:3721: Test failed: Expected (0,0)-(1024,768), got (0,0)-(720,480). ddraw4.c:3726: Test failed: Expected surface width 1024, got 720. ddraw4.c:3741: Test failed: Expected surface width 1024, got 720. ddraw4.c:3747: Test failed: Expected (0,0)-(1024,768), got (0,0)-(720,480). ddraw4.c:3770: Test failed: Expected (0,0)-(1024,768), got (0,0)-(720,480). ddraw4.c:3792: Test failed: Expected (0,0)-(1024,768), got (0,0)-(720,480). ddraw4.c:3797: Test failed: Expected surface width 1024, got 720. ddraw4.c:3818: Test failed: Expected (0,0)-(1024,768), got (0,0)-(720,480). ddraw4.c:3838: Test failed: Expected (0,0)-(1024,768), got (0,0)-(720,480). ddraw4.c:3851: Test failed: Expected resolution 1024x768, got 720x480. ddraw4.c:3868: Test failed: Expected surface width 1024, got 720. ddraw4.c:3875: Test failed: Expected (0,0)-(1024,768), got (0,0)-(720,480). ddraw4.c:3894: Test failed: Expected screen size 1024x768, got 720x480. ddraw4.c:3901: Test failed: Expected (0,0)-(1024,768), got (0,0)-(720,480). ddraw4.c:3913: Test failed: Expected surface width 1024, got 720. ddraw4.c:3966: Test failed: Expected screen size 2 1024x768, got 720x480. ddraw4.c:3974: Test failed: Expected (0,0)-(1024,768), got (0,0)-(720,480). ddraw4.c:3986: Test failed: Expected surface width 1024, got 720.
=== debian11 (64 bit WoW report) ===
ddraw: ddraw1.c:14344: Test failed: Expect window rect (0,0)-(640,480), got (0,0)-(1024,768). ddraw1.c:14400: Test failed: Expect window rect (0,0)-(640,480), got (0,0)-(1024,768). ddraw1.c:14407: Test failed: Expect window rect (0,0)-(640,480), got (0,0)-(1024,768). ddraw1.c:14344: Test failed: Expect window rect (0,0)-(640,480), got (0,0)-(1024,737). ddraw1.c:14366: Test failed: Expected window rect (640,0)-(1664,737), got (0,0)-(1024,737). ddraw1.c:14381: Test failed: Expected window rect (640,0)-(1664,737), got (0,0)-(1024,737). ddraw1.c:14400: Test failed: Expect window rect (0,0)-(640,480), got (1024,0)-(2048,737). ddraw1.c:14407: Test failed: Expect window rect (0,0)-(640,480), got (1024,0)-(2048,737). ddraw2.c:4476: Test failed: Display mode restored after good ddraw1::SetCooperativeLevel call ddraw2.c:15324: Test failed: Expect window rect (0,0)-(640,480), got (1024,0)-(2048,737). ddraw2.c:15331: Test failed: Expect window rect (0,0)-(640,480), got (1024,0)-(2048,737).
Signed-off-by: Stefan Dösinger stefan@codeweavers.com
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
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 | 6 ++++++ 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, 14 insertions(+), 8 deletions(-)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index ff78dae..4e17d44 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -970,6 +970,12 @@ static HRESULT ddraw_set_cooperative_level(struct ddraw *ddraw, HWND window,
if (!(cooplevel & DDSCL_EXCLUSIVE) && (ddraw->cooperative_level & DDSCL_EXCLUSIVE)) { + /* When going from exclusive mode to normal, ddraw removes the + topmost bit unless the DDSCL_NOWINDOWCHANGES flag is set in + this call that sets it to normal, not in the old coop level. */ + 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 95904ab..c5afeff 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -2701,7 +2701,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()); @@ -2763,7 +2763,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 6092528..f80d4fe 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -2779,7 +2779,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()); @@ -2841,7 +2841,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 50ea812..4447c56 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -3015,7 +3015,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()); @@ -3077,7 +3077,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 67f6893..e5324cf 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -2680,7 +2680,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()); @@ -2742,7 +2742,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=105330
Your paranoid android.
=== w8 (32 bit report) ===
ddraw: 0d3c:ddraw2: unhandled exception c0000005 at 69E83599
=== w864 (64 bit report) ===
ddraw: ddraw2.c:3577: Test failed: Failed to create surface, hr 0x887601c2. 09e4:ddraw2: unhandled exception c0000005 at 00000000004805A8
=== w1064v1809 (32 bit report) ===
ddraw: ddraw7.c:18844: Test failed: Got unexpected color 0x00000040.
=== w864 (64 bit report) ===
ddraw: ddraw7.c:3473: Test failed: Failed to create surface, hr 0x887601c2. 0b2c:ddraw7: unhandled exception c0000005 at 000000000051150F
=== debian11 (32 bit report) ===
ddraw: ddraw4.c:2951: Test failed: Expected window style 0x4cf0000, got 0xa40b0000. ddraw4.c:2984: Test failed: Expected window style 0x4cf0000, got 0xa40b0000. ddraw4.c:2987: Test failed: Expected window extended style 0x108, got 0x8. ddraw4.c:2993: Test failed: Expected window style 0x4cf0000, got 0xa40b0000. ddraw4.c:2996: Test failed: Expected window extended style 0x108, got 0x8. ddraw4.c:3016: Test failed: Expected window style 0x4cf0000, got 0xa40b0000. ddraw4.c:3018: Test failed: Expected window extended style 0x100, got 0. ddraw4.c:3035: Test failed: Expected (0,0)-(640,480), got (-32000,-32000)-(-31840,-31976). ddraw4.c:3058: Test failed: Expected (0,0)-(640,480), got (-32000,-32000)-(-31840,-31976). ddraw4.c:3078: Test failed: Expected window style 0x4cf0000, got 0xa40b0000. ddraw4.c:3080: Test failed: Expected window extended style 0x100, got 0.
=== debian11 (32 bit Arabic:Morocco report) ===
ddraw: ddraw4.c:3892: Test failed: Expected message 0x5, but didn't receive it. ddraw4.c:3894: Test failed: Expected screen size 640x480, got 0x0. ddraw4.c:3901: Test failed: Expected (0,0)-(640,480), got (0,0)-(720,480). ddraw4.c:3913: Test failed: Expected surface width 640, got 720. ddraw4.c:3966: Test failed: Expected screen size 2 640x480, got 720x480. ddraw4.c:3974: Test failed: Expected (0,0)-(640,480), got (0,0)-(720,480). ddraw4.c:3986: Test failed: Expected surface width 640, got 720.
=== debian11 (32 bit Hebrew:Israel report) ===
ddraw: ddraw1.c:3754: Test failed: Got unexpected screen width 800. ddraw1.c:3756: Test failed: Got unexpected screen height 600. ddraw1.c:3761: Test failed: Got unexpected screen width 800. ddraw1.c:3763: Test failed: Got unexpected screen height 600. ddraw1.c:3785: Test failed: Got unexpected screen width 800. ddraw1.c:3787: Test failed: Got unexpected screen height 600. ddraw1.c:3792: Test failed: Got unexpected screen width 800. ddraw1.c:3794: Test failed: Got unexpected screen height 600. ddraw1.c:3816: Test failed: Got unexpected screen width 800. ddraw1.c:3818: Test failed: Got unexpected screen height 600. ddraw1.c:3851: Test failed: Got unexpected screen width 800. ddraw1.c:3853: Test failed: Got unexpected screen height 600. ddraw1.c:3874: Test failed: Got unexpected screen width 800. ddraw1.c:3876: Test failed: Got unexpected screen height 600. ddraw1.c:3881: Test failed: Got unexpected screen width 800. ddraw1.c:3883: Test failed: Got unexpected screen height 600.
=== debian11 (32 bit WoW report) ===
ddraw: ddraw4.c:5601: Test failed: Display mode not restored in new ddraw object ddraw7.c:2616: Test failed: Expected window style 0x4cf0000, got 0xa40b0000. ddraw7.c:2649: Test failed: Expected window style 0x4cf0000, got 0xa40b0000. ddraw7.c:2652: Test failed: Expected window extended style 0x108, got 0x8. ddraw7.c:2658: Test failed: Expected window style 0x4cf0000, got 0xa40b0000. ddraw7.c:2661: Test failed: Expected window extended style 0x108, got 0x8. ddraw7.c:2681: Test failed: Expected window style 0x4cf0000, got 0xa40b0000. ddraw7.c:2683: Test failed: Expected window extended style 0x100, got 0. ddraw7.c:2700: Test failed: Expected (0,0)-(640,480), got (-32000,-32000)-(-31840,-31976). ddraw7.c:2723: Test failed: Expected (0,0)-(640,480), got (-32000,-32000)-(-31840,-31976). ddraw7.c:2743: Test failed: Expected window style 0x4cf0000, got 0xa40b0000. ddraw7.c:2745: Test failed: Expected window extended style 0x100, got 0.
=== debian11 (64 bit WoW report) ===
ddraw: ddraw1.c:14344: Test failed: Expect window rect (0,0)-(640,480), got (0,0)-(1024,768). ddraw1.c:14400: Test failed: Expect window rect (0,0)-(640,480), got (0,0)-(1024,768). ddraw1.c:14407: Test failed: Expect window rect (0,0)-(640,480), got (0,0)-(1024,768). ddraw1.c:14344: Test failed: Expect window rect (0,0)-(640,480), got (0,0)-(1024,737). ddraw1.c:14366: Test failed: Expected window rect (640,0)-(1664,737), got (0,0)-(1024,737). ddraw1.c:14381: Test failed: Expected window rect (640,0)-(1664,737), got (0,0)-(1024,737). ddraw1.c:14400: Test failed: Expect window rect (0,0)-(640,480), got (1024,0)-(2048,737). ddraw1.c:14407: Test failed: Expect window rect (0,0)-(640,480), got (1024,0)-(2048,737). ddraw2.c:4476: Test failed: Display mode restored after good ddraw1::SetCooperativeLevel call ddraw2.c:15324: Test failed: Expect window rect (0,0)-(640,480), got (1024,0)-(2048,737). ddraw2.c:15331: Test failed: Expect window rect (0,0)-(640,480), got (1024,0)-(2048,737).
Signed-off-by: Stefan Dösinger stefan@codeweavers.com
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com ---
Minimizing/restoring and setting foreground twice + waiting for thread msgs seems to work in all cases for testing, both on native and wine.
dlls/d3d8/tests/device.c | 289 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 289 insertions(+)
diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index fc94dca..b565bc4 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -3935,16 +3935,50 @@ cleanup: DestroyWindow(hwnd); }
+struct create_window_thread_params +{ + HANDLE event; + HWND hwnd; +}; + +static DWORD WINAPI create_window_thread(void *data) +{ + struct create_window_thread_params *params = data; + HWND hwnd; + MSG msg; + + hwnd = CreateWindowA("static", "d3d8_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 10, 20, 30, 40, 0, 0, 0, 0); + ok(!!hwnd, "Failed to create window.\n"); + flush_events(); + params->hwnd = hwnd; + SetEvent(params->event); + while (GetMessageA(&msg, 0, 0, 0)) + { + TranslateMessage(&msg); + DispatchMessageA(&msg); + if (!params->hwnd) + break; + } + DestroyWindow(hwnd); + return 0; +} + static void test_window_style(void) { + struct create_window_thread_params thread_params; RECT focus_rect, fullscreen_rect, r; LONG device_style, device_exstyle; LONG focus_style, focus_exstyle; struct device_desc device_desc; LONG style, expected_style; IDirect3DDevice8 *device; + HWND active_window; IDirect3D8 *d3d8; + DWORD_PTR result; + HANDLE thread; HRESULT hr; + DWORD tid; ULONG ref; BOOL ret;
@@ -4055,6 +4089,261 @@ 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 the current process has the foreground window at creation */ + 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); + active_window = CreateWindowA("static", "d3d8_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 10, 20, 30, 40, 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(active_window); + ok(ret, "Failed to set foreground window.\n"); + ok(GetActiveWindow() == active_window, "Unexpected active 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"); + + 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); + + 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); + ShowWindow(device_window, SW_SHOWNOACTIVATE); + + 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); + GetWindowRect(device_window, &r); + ok(EqualRect(&r, &fullscreen_rect), "Expected %s, got %s.\n", wine_dbgstr_rect(&fullscreen_rect), wine_dbgstr_rect(&r)); + + ref = IDirect3DDevice8_Release(device); + ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); + DestroyWindow(active_window); + DestroyWindow(device_window); + DestroyWindow(focus_window); + + 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); + + thread_params.hwnd = NULL; + thread_params.event = CreateEventW(NULL, 0, 0, NULL); + ok(!!thread_params.event, "Failed to create event.\n"); + thread = CreateThread(NULL, 0, create_window_thread, &thread_params, 0, &tid); + ok(!!thread, "Failed to create thread.\n"); + ok(WaitForSingleObject(thread_params.event, INFINITE) == WAIT_OBJECT_0, "WaitForSingleObject failed.\n"); + ok(!!thread_params.hwnd, "Failed to create window in another thread.\n"); + CloseHandle(thread_params.event); + + /* Minimize and restore the other thread's window, otherwise native fails to + set the foreground window to it, even if it's done from the thread itself. */ + ShowWindow(thread_params.hwnd, SW_MINIMIZE); + ShowWindow(thread_params.hwnd, SW_RESTORE); + /* Set focus twice to make KDE and fvwm in focus-follows-mouse mode happy. */ + SetForegroundWindow(thread_params.hwnd); + flush_events(); + SetForegroundWindow(thread_params.hwnd); + flush_events(); + /* Wait for thread to process all related messages */ + SendMessageTimeoutW(thread_params.hwnd, WM_NULL, 0, 0, 0, 2000, &result); + + SetActiveWindow(NULL); + ok(GetForegroundWindow() == thread_params.hwnd, "Unexpected 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"); + + 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); + + ref = IDirect3DDevice8_Release(device); + ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); + thread_params.hwnd = NULL; + PostThreadMessageW(tid, WM_NULL, 0, 0); + DestroyWindow(device_window); + DestroyWindow(focus_window); + ok(WaitForSingleObject(thread, INFINITE) == WAIT_OBJECT_0, "WaitForSingleObject failed.\n"); + CloseHandle(thread); + + 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"); + SetActiveWindow(focus_window); + ok(GetActiveWindow() == focus_window, "Unexpected active 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); + + /* Windows 8 and some versions of Windows 10 have some 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...\n"); + 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"); + SetActiveWindow(focus_window); + ok(GetActiveWindow() == focus_window, "Unexpected active window."); + 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); + + ref = IDirect3DDevice8_Release(device); + ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); + DestroyWindow(device_window); + DestroyWindow(focus_window); + + 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"); + SetActiveWindow(device_window); + ok(GetActiveWindow() == device_window, "Unexpected active 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); + + 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); + +skip_inactive: + ref = IDirect3DDevice8_Release(device); + ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref);
done: IDirect3D8_Release(d3d8);
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=105331
Your paranoid android.
=== w8adm (32 bit report) ===
d3d8: device.c:5020: Test failed: Failed to reset device. device.c:5026: Test failed: Expected (0,0)-(1024,768), got (0,0)-(512,384). device.c:5033: Test failed: Expected wndproc != 0x422e00. device.c:11023: Test failed: Adapter 0: SetForegroundWindow failed, error 0.
=== w1064v1507 (32 bit report) ===
d3d8: device.c:11023: Test failed: Adapter 0: SetForegroundWindow failed, error 0.
=== w1064v1809 (32 bit report) ===
d3d8: device.c:11023: Test failed: Adapter 0: SetForegroundWindow failed, error 0.
=== w1064_tsign (32 bit report) ===
d3d8: device.c:11023: Test failed: Adapter 0: SetForegroundWindow failed, error 0.
=== debian11 (32 bit French report) ===
d3d8: device.c:3160: Test failed: Got unexpected screen size 1920x1440. device.c:3184: Test failed: Got unexpected screen size 1920x1440. device.c:3209: Test failed: Got unexpected width 1920. device.c:3210: Test failed: Got unexpected height 1440. device.c:4494: Test failed: Got a different mode. device.c:4497: Test failed: Got a different mode. device.c:4618: Test failed: Expected resolution 1024x768, got 1920x1440. device.c:4648: Test failed: Expected resolution 1024x768, got 1920x1440. device.c:4671: Test failed: Got a different mode.
=== debian11 (32 bit Japanese:Japan report) ===
d3d8: device.c:10997: Test failed: Adapter 1: Expect window rect (1024,-737)-(2048,0), got (4,14)-(644,494).
=== debian11 (64 bit WoW report) ===
d3d8: device.c:10997: Test failed: Adapter 1: Expect window rect (640,0)-(1664,737), got (640,0)-(1280,480). device.c:11027: Test failed: Adapter 1: Expect window rect (640,0)-(1664,737), got (0,0)-(1024,737).
Am Dienstag, 18. Jänner 2022, 19:50:28 EAT schrieb Gabriel Ivăncescu:
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com
Minimizing/restoring and setting foreground twice + waiting for thread msgs seems to work in all cases for testing, both on native and wine.
dlls/d3d8/tests/device.c | 289 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 289 insertions(+)
I finally dug out my Windows 7 box and ran the test there. Unfortunately it fails:
device.c:5020: Test failed: Failed to reset device. device.c:5026: Test failed: Expected (0,0)-(1920,1200), got (0,0)-(960,600). device.c:5033: Test failed: Expected wndproc != 0x2ed770. device.c:8677: Test failed: Failed to set foreground window. device.c:8728: Test failed: Failed to set foreground window.
The ddraw tests pass on that Windows 7 box though, so the important stuff looks good.
On 19/01/2022 21:39, Stefan Dösinger wrote:
Am Dienstag, 18. Jänner 2022, 19:50:28 EAT schrieb Gabriel Ivăncescu:
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com
Minimizing/restoring and setting foreground twice + waiting for thread msgs seems to work in all cases for testing, both on native and wine.
dlls/d3d8/tests/device.c | 289 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 289 insertions(+)
I finally dug out my Windows 7 box and ran the test there. Unfortunately it fails:
device.c:5020: Test failed: Failed to reset device. device.c:5026: Test failed: Expected (0,0)-(1920,1200), got (0,0)-(960,600). device.c:5033: Test failed: Expected wndproc != 0x2ed770. device.c:8677: Test failed: Failed to set foreground window. device.c:8728: Test failed: Failed to set foreground window.
The ddraw tests pass on that Windows 7 box though, so the important stuff looks good.
I tested on 32-bit version of Win7 and WinXP in a VM (not real hardware, I don't know if it matters; I doubt it affects focus results, but at least the device reset works I mean).
I also tested this on the original 64-bit Windows 10 version (1507) and it has the same behavior. It's always the same. No idea when it got changed though.
Am Mittwoch, 19. Jänner 2022, 22:51:47 EAT schrieb Gabriel Ivăncescu:
I tested on 32-bit version of Win7 and WinXP in a VM (not real hardware, I don't know if it matters; I doubt it affects focus results, but at least the device reset works I mean).
Hmm, I think WARP was added by Windows 8. If you look at https:// testbot.winehq.org/JobDetails.pl?Key=105331&f201=exe32.report#k201 (w7u_2qxl testbot results for your patch) you'll see that all the tests are effectively skipped.
Are you sure the tests did something useful when you ran them on the Win7 and XP VMs?
I also tested this on the original 64-bit Windows 10 version (1507) and it has the same behavior. It's always the same. No idea when it got changed though.
I'm happy to just drop the non-ddraw tests since the regression you are trying to fix is about ddraw only. The ddraw behavior is sensible in some way; d3d8, d3d9 and d3d9ex are all over the place though. That Win10's behavior changed at some point and didn't change back suggests (but doesn't prove) that there aren't any apps that care.
On 19/01/2022 22:48, Stefan Dösinger wrote:
Am Mittwoch, 19. Jänner 2022, 22:51:47 EAT schrieb Gabriel Ivăncescu:
I tested on 32-bit version of Win7 and WinXP in a VM (not real hardware, I don't know if it matters; I doubt it affects focus results, but at least the device reset works I mean).
Hmm, I think WARP was added by Windows 8. If you look at https:// testbot.winehq.org/JobDetails.pl?Key=105331&f201=exe32.report#k201 (w7u_2qxl testbot results for your patch) you'll see that all the tests are effectively skipped.
Yeah it does pass here, and it fails if I change the test conditions (so they are not skipped). I wonder why the device fails to reset in your case or on the testbot, though.
Are you sure the tests did something useful when you ran them on the Win7 and XP VMs?
I also tested this on the original 64-bit Windows 10 version (1507) and it has the same behavior. It's always the same. No idea when it got changed though.
I'm happy to just drop the non-ddraw tests since the regression you are trying to fix is about ddraw only. The ddraw behavior is sensible in some way; d3d8, d3d9 and d3d9ex are all over the place though. That Win10's behavior changed at some point and didn't change back suggests (but doesn't prove) that there aren't any apps that care.
I don't mind, they're at the end of the patch series anyway so can simply be dropped / are independent.
Just to note that d3d8 is a very old API, it's not inconceivable that newer Windows versions can break some apps. Though very unlikely they care about this, so yeah. I don't think d3d8 is even available in 64-bit, looking at testbot results.
Am 20.01.2022 um 19:51 schrieb Gabriel Ivăncescu gabrielopcode@gmail.com:
I don't mind, they're at the end of the patch series anyway so can simply be dropped / are independent.
Just to note that d3d8 is a very old API, it's not inconceivable that newer Windows versions can break some apps. Though very unlikely they care about this, so yeah. I don't think d3d8 is even available in 64-bit, looking at testbot results.
Yeah, e.g. ddraw apps tend to get worse and worse on Windows over time. d3d8 on the other hand did away with the worst offenses of ddraw, e.g. being able to lock the front buffer and just draw to the screen, ignoring any windows.
They do care about these things. For the past 20 years backwards compatibility has been Windows' entire raison d'être. Their QA might not find bugs though or fixing things might be harder than telling users to use virtual machines. As such d3d8 is available on 32 bit Windows, but as you've observed it is not available as a 64 bit DLL.
(Interestingly ddraw.dll is available as a 64 bit DLL, but 64 bit ddraw doesn't support the d3d parts. I assume the reason for this is that Internet Explorer and its third party plugins used ddraw a lot, and without a 64 bit ddraw a 64 bit IE would have been impossible)
Let's see if we run into any applications that need specific inactive window behavior in d3d8 or newer. We can always dust of your tests then :-)
On 21/01/2022 11:41, Stefan Dösinger wrote:
Am 20.01.2022 um 19:51 schrieb Gabriel Ivăncescu gabrielopcode@gmail.com:
I don't mind, they're at the end of the patch series anyway so can simply be dropped / are independent.
Just to note that d3d8 is a very old API, it's not inconceivable that newer Windows versions can break some apps. Though very unlikely they care about this, so yeah. I don't think d3d8 is even available in 64-bit, looking at testbot results.
Yeah, e.g. ddraw apps tend to get worse and worse on Windows over time. d3d8 on the other hand did away with the worst offenses of ddraw, e.g. being able to lock the front buffer and just draw to the screen, ignoring any windows.
They do care about these things. For the past 20 years backwards compatibility has been Windows' entire raison d'être. Their QA might not find bugs though or fixing things might be harder than telling users to use virtual machines. As such d3d8 is available on 32 bit Windows, but as you've observed it is not available as a 64 bit DLL.
(Interestingly ddraw.dll is available as a 64 bit DLL, but 64 bit ddraw doesn't support the d3d parts. I assume the reason for this is that Internet Explorer and its third party plugins used ddraw a lot, and without a 64 bit ddraw a 64 bit IE would have been impossible)
Let's see if we run into any applications that need specific inactive window behavior in d3d8 or newer. We can always dust of your tests then :-)
Yep. By "unlikely they care" I was referring to d3d8 apps, i.e. caring about this focus behavior.
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/d3d9/tests/d3d9ex.c | 210 +++++++++++++++++++++++++++++++++++++++ dlls/d3d9/tests/device.c | 57 ++++++++++- 2 files changed, 264 insertions(+), 3 deletions(-)
diff --git a/dlls/d3d9/tests/d3d9ex.c b/dlls/d3d9/tests/d3d9ex.c index 2afe730..84298c6 100644 --- a/dlls/d3d9/tests/d3d9ex.c +++ b/dlls/d3d9/tests/d3d9ex.c @@ -3475,6 +3475,7 @@ static void test_window_style(void) struct device_desc device_desc; LONG style; IDirect3DDevice9Ex *device; + HWND active_window; HRESULT hr; ULONG ref; BOOL ret; @@ -3662,6 +3663,215 @@ static void test_window_style(void) DestroyWindow(device_window); DestroyWindow(focus_window); } + + /* Window changes are done only if the focus window is foreground */ + 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); + active_window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 10, 20, 30, 40, 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(active_window); + ok(ret, "Failed to set foreground window.\n"); + ok(GetActiveWindow() == active_window, "Unexpected active 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(active_window); + ok(ret, "Failed to set foreground window.\n"); + ok(GetActiveWindow() == active_window, "Unexpected active 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); + + 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); + + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + SetActiveWindow(active_window); + ok(GetActiveWindow() == active_window, "Unexpected active 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(active_window); + DestroyWindow(device_window); + DestroyWindow(focus_window); + + 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"); + SetActiveWindow(focus_window); + ok(GetActiveWindow() == focus_window, "Unexpected active 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"); + SetActiveWindow(focus_window); + ok(GetActiveWindow() == focus_window, "Unexpected active 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"); + SetActiveWindow(focus_window); + ok(GetActiveWindow() == focus_window, "Unexpected active 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(device_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); + + 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=105332
Your paranoid android.
=== w1064v1507 (32 bit report) ===
d3d9: device.c:5311: Test failed: Didn't receive MOUSEMOVE 1 (75, 75).
=== 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:4197: Test failed: Got unexpected screen size 800x600. device.c:4232: Test failed: Got unexpected screen size 800x600. device.c:4257: Test failed: Got unexpected width 800. device.c:4258: Test failed: Got unexpected height 600. device.c:5467: Test failed: Expected resolution 640x480, got 800x600. device.c:5497: Test failed: Expected resolution 640x480, got 800x600. device.c:14728: Test failed: Adapter 1: Expect window rect (800,0)-(1824,737), got (0,0)-(1024,737).
=== debian11 (32 bit Hebrew:Israel report) ===
d3d9: d3d9ex.c:2986: Test failed: Got unexpected screen size 640x480. d3d9ex.c:3040: Test failed: Got unexpected width 640. device.c:5467: Test failed: Expected resolution 800x600, got 640x480. device.c:5497: Test failed: Expected resolution 800x600, got 640x480. device.c:14662: Test failed: Adapter 0: Expect window rect (0,0)-(800,600), got (4,14)-(644,494). device.c:14662: Test failed: Adapter 1: Expect window rect (800,0)-(1824,737), got (800,0)-(1440,480).
=== debian11 (32 bit Hindi:India report) ===
d3d9: d3d9ex.c:1689: Test failed: Got screen width 720, expected 800. d3d9ex.c:1690: Test failed: Got screen height 480, expected 600. d3d9ex.c:2986: Test failed: Got unexpected screen size 720x480. d3d9ex.c:3040: Test failed: Got unexpected width 720. device.c:5467: Test failed: Expected resolution 640x480, got 800x600. device.c:5497: Test failed: Expected resolution 640x480, got 800x600.
=== 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:4197: Test failed: Got unexpected screen size 800x600. device.c:4232: Test failed: Got unexpected screen size 800x600. device.c:4257: Test failed: Got unexpected width 800. device.c:4258: Test failed: Got unexpected height 600. device.c:5467: Test failed: Expected resolution 640x480, got 800x600. device.c:5497: Test failed: Expected resolution 640x480, got 800x600.
=== debian11 (64 bit WoW report) ===
d3d9: device.c:4197: Test failed: Got unexpected screen size 720x480. device.c:4232: Test failed: Got unexpected screen size 720x480. device.c:4257: Test failed: Got unexpected width 720. device.c:4258: Test failed: Got unexpected height 480. device.c:14662: Test failed: Adapter 0: Expect window rect (0,0)-(720,480), got (4,14)-(644,494). device.c:14662: Test failed: Adapter 1: Expect window rect (720,0)-(1744,737), got (4,14)-(644,494).
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=105333
Your paranoid android.
=== w1064_2qxl (64 bit report) ===
dxgi: dxgi.c:6237: Test failed: Failed to set foreground window. dxgi.c:6247: Test failed: Failed to set foreground window.
=== w10pro64 (64 bit report) ===
dxgi: dxgi.c:2836: Test failed: Got unexpected hr 0x887a0022. dxgi.c:2839: Test failed: Got unexpected fullscreen 0. dxgi.c:2842: Test failed: Got unexpected hr 0x887a0022. dxgi.c:2845: Test failed: Got unexpected fullscreen 0.
=== w10pro64_he (64 bit report) ===
dxgi: dxgi.c:2836: Test failed: Got unexpected hr 0x887a0022. dxgi.c:2839: Test failed: Got unexpected fullscreen 0. dxgi.c:2842: Test failed: Got unexpected hr 0x887a0022. dxgi.c:2845: Test failed: Got unexpected fullscreen 0.
=== debian11 (32 bit report) ===
dxgi: dxgi.c:2667: Test failed: Got window rect (800,0)-(1600,600), expected (1024,0)-(1824,600). dxgi.c:2667: Test failed: Got monitor rect (800,0)-(1600,600), expected (1024,0)-(1824,600). dxgi.c:2681: Test failed: Got window rect (800,0)-(1600,600), expected (1024,0)-(1824,600). dxgi.c:2681: Test failed: Got monitor rect (800,0)-(1600,600), expected (1024,0)-(1824,600). dxgi.c:2684: Test failed: Got window rect (800,0)-(1600,600), expected (1024,0)-(1824,600). dxgi.c:2684: Test failed: Got monitor rect (800,0)-(1600,600), expected (1024,0)-(1824,600). dxgi.c:2687: Test failed: Got monitor rect (0,0)-(800,600), expected (0,0)-(1024,768). dxgi.c:2694: Test failed: Got monitor rect (0,0)-(800,600), expected (0,0)-(1024,768). dxgi.c:2698: Test failed: Got monitor rect (800,0)-(1824,737), expected (1024,0)-(2048,737). dxgi.c:2709: Test failed: Got monitor rect (0,0)-(800,600), expected (0,0)-(1024,768). dxgi.c:2723: Test failed: Got monitor rect (0,0)-(800,600), expected (0,0)-(1024,768). dxgi.c:2723: Test failed: Got monitor rect (800,0)-(1824,737), expected (1024,0)-(2048,737). dxgi.c:2874: Test failed: Got monitor rect (0,0)-(800,600), expected (0,0)-(1024,768).
=== debian11 (32 bit Arabic:Morocco report) ===
dxgi: dxgi.c:3354: Test failed: Got monitor rect (0,0)-(848,480), expected (0,0)-(800,600). dxgi.c:3356: Test failed: Got monitor rect (0,0)-(848,480), expected (0,0)-(800,600). dxgi.c:3369: Test failed: Got monitor rect (0,0)-(848,480), expected (0,0)-(800,600).
=== debian11 (32 bit German report) ===
dxgi: dxgi.c:3354: Test failed: Got monitor rect (0,0)-(800,600), expected (0,0)-(848,480). dxgi.c:3356: Test failed: Got monitor rect (0,0)-(800,600), expected (0,0)-(848,480). dxgi.c:3369: Test failed: Got monitor rect (0,0)-(800,600), expected (0,0)-(848,480). dxgi.c:3354: Test failed: Got monitor rect (0,0)-(1152,768), expected (0,0)-(800,600). dxgi.c:3356: Test failed: Got monitor rect (0,0)-(1152,768), expected (0,0)-(800,600). dxgi.c:3369: Test failed: Got monitor rect (0,0)-(1152,768), expected (0,0)-(800,600).
=== debian11 (32 bit French report) ===
dxgi: dxgi.c:3354: Test failed: Got monitor rect (0,0)-(1280,800), expected (0,0)-(1152,768). dxgi.c:3356: Test failed: Got monitor rect (0,0)-(1280,800), expected (0,0)-(1152,768). dxgi.c:3369: Test failed: Got monitor rect (0,0)-(1280,800), expected (0,0)-(1152,768).
=== debian11 (32 bit Hebrew:Israel report) ===
dxgi: dxgi.c:3699: Test failed: Got monitor rect (0,0)-(800,600), expected (0,0)-(1280,800).
=== debian11 (32 bit Hindi:India report) ===
dxgi: dxgi.c:3354: Test failed: Got monitor rect (0,0)-(1280,854), expected (0,0)-(640,480). dxgi.c:3356: Test failed: Got monitor rect (0,0)-(1280,854), expected (0,0)-(640,480). dxgi.c:3369: Test failed: Got monitor rect (0,0)-(1280,854), expected (0,0)-(640,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=105328
Your paranoid android.
=== w8adm (32 bit report) ===
ddraw: ddraw1.c:3418: Test failed: Failed to create surface, hr 0x887601c2. 0d34:ddraw1: unhandled exception c0000005 at 0044B756
=== w1064_tsign (32 bit report) ===
ddraw: ddraw7.c:18779: Test failed: Got unexpected color 0x00000040.
=== debian11 (32 bit report) ===
ddraw: ddraw1.c:3115: Test failed: Expected message 0x47, but didn't receive it. ddraw1.c:3117: Test failed: Expected screen size 1024x768, got 0x0. ddraw1.c:3123: Test failed: Expected (0,0)-(1024,768), got (0,0)-(640,480). ddraw1.c:3147: Test failed: Expected surface width 1024, got 640. ddraw1.c:3149: Test failed: Expected surface height 768, got 480. ddraw1.c:3153: Test failed: Expected (0,0)-(1024,768), got (0,0)-(640,480). ddraw1.c:3160: Test failed: Expected (0,0)-(1024,768), got (0,0)-(640,480). ddraw1.c:3165: Test failed: Expected surface width 1024, got 640. ddraw1.c:3167: Test failed: Expected surface height 768, got 480. ddraw1.c:3180: Test failed: Expected surface width 1024, got 640. ddraw1.c:3182: Test failed: Expected surface height 768, got 480. ddraw1.c:3186: Test failed: Expected (0,0)-(1024,768), got (0,0)-(640,480). ddraw1.c:3209: Test failed: Expected (0,0)-(1024,768), got (0,0)-(640,480). ddraw1.c:3238: Test failed: Expected (0,0)-(1024,768), got (0,0)-(640,480). ddraw1.c:3243: Test failed: Expected surface width 1024, got 640. ddraw1.c:3245: Test failed: Expected surface height 768, got 480. ddraw1.c:3264: Test failed: Expected (0,0)-(1024,768), got (0,0)-(640,480). ddraw1.c:3284: Test failed: Expected (0,0)-(1024,768), got (0,0)-(640,480). ddraw1.c:3297: Test failed: Expected resolution 1024x768, got 640x480. ddraw1.c:3314: Test failed: Expected surface width 1024, got 640. ddraw1.c:3316: Test failed: Expected surface height 768, got 480. ddraw1.c:3320: Test failed: Expected (0,0)-(1024,768), got (0,0)-(640,480). ddraw1.c:3330: Test failed: Expected (0,0)-(1024,768), got (0,0)-(640,480). ddraw1.c:3335: Test failed: Expected surface width 1024, got 640. ddraw1.c:3337: Test failed: Expected surface height 768, got 480. ddraw1.c:3350: Test failed: Expected surface width 1024, got 640. ddraw1.c:3352: Test failed: Expected surface height 768, got 480. ddraw1.c:3356: Test failed: Expected (0,0)-(1024,768), got (0,0)-(640,480). ddraw1.c:3379: Test failed: Expected (0,0)-(1024,768), got (0,0)-(640,480). ddraw1.c:3392: Test failed: Got unexpected hr 0. ddraw1.c:3394: Test failed: Got unexpected hr 0. ddraw1.c:3401: Test failed: Expected (0,0)-(1024,768), got (0,0)-(640,480). ddraw1.c:3406: Test failed: Expected surface width 1024, got 640. ddraw1.c:3408: Test failed: Expected surface height 768, got 480. ddraw1.c:3427: Test failed: Expected (0,0)-(1024,768), got (0,0)-(640,480). ddraw1.c:3447: Test failed: Expected (0,0)-(1024,768), got (0,0)-(640,480). ddraw1.c:3460: Test failed: Expected resolution 1024x768, got 640x480. ddraw1.c:3477: Test failed: Expected surface width 1024, got 640. ddraw1.c:3479: Test failed: Expected surface height 768, got 480. ddraw1.c:3484: Test failed: Expected (0,0)-(1024,768), got (0,0)-(640,480). ddraw2.c:3669: Test failed: Expected screen size 2 1024x768, got 640x480. ddraw2.c:3677: Test failed: Expected (0,0)-(1024,768), got (0,0)-(640,480). ddraw2.c:3689: Test failed: Expected surface width 1024, got 640. ddraw4.c:2951: Test failed: Expected window style 0x4cf0000, got 0xa40b0000. ddraw4.c:2970: Test failed: Expected (0,0)-(640,480), got (-32000,-32000)-(-31840,-31976). ddraw4.c:2993: Test failed: Expected (0,0)-(640,480), got (-32000,-32000)-(-31840,-31976). ddraw4.c:3013: Test failed: Expected window style 0x4cf0000, got 0xa40b0000.
=== debian11 (32 bit Arabic:Morocco report) ===
ddraw: ddraw7.c:3058: Test failed: Got unexpected screen size 720x480. ddraw7.c:3064: Test failed: Expected message 0x7e, but didn't receive it. ddraw7.c:3112: Test failed: Expected message 0x47, but didn't receive it. ddraw7.c:3114: Test failed: Expected screen size 640x480, got 0x0. ddraw7.c:3120: Test failed: Expected (0,0)-(640,480), got (0,0)-(720,480). ddraw7.c:3144: Test failed: Expected surface width 640, got 720. ddraw7.c:3150: Test failed: Expected (0,0)-(640,480), got (0,0)-(720,480). ddraw7.c:3157: Test failed: Expected (0,0)-(640,480), got (0,0)-(720,480). ddraw7.c:3162: Test failed: Expected surface width 640, got 720. ddraw7.c:3177: Test failed: Expected surface width 640, got 720. ddraw7.c:3183: Test failed: Expected (0,0)-(640,480), got (0,0)-(720,480). ddraw7.c:3206: Test failed: Expected (0,0)-(640,480), got (0,0)-(720,480). ddraw7.c:3219: Test failed: Got unexpected hr 0. ddraw7.c:3221: Test failed: Got unexpected hr 0. ddraw7.c:3228: Test failed: Expected (0,0)-(640,480), got (0,0)-(720,480). ddraw7.c:3233: Test failed: Expected surface width 640, got 720. ddraw7.c:3254: Test failed: Expected (0,0)-(640,480), got (0,0)-(720,480). ddraw7.c:3274: Test failed: Expected (0,0)-(640,480), got (0,0)-(720,480). ddraw7.c:3287: Test failed: Expected resolution 640x480, got 720x480. ddraw7.c:3304: Test failed: Expected surface width 640, got 720. ddraw7.c:3310: Test failed: Expected (0,0)-(640,480), got (0,0)-(720,480). ddraw7.c:3320: Test failed: Expected (0,0)-(640,480), got (0,0)-(720,480). ddraw7.c:3325: Test failed: Expected surface width 640, got 720. ddraw7.c:3340: Test failed: Expected surface width 640, got 720. ddraw7.c:3346: Test failed: Expected (0,0)-(640,480), got (0,0)-(720,480). ddraw7.c:3369: Test failed: Expected (0,0)-(640,480), got (0,0)-(720,480). ddraw7.c:3382: Test failed: Got unexpected hr 0. ddraw7.c:3384: Test failed: Got unexpected hr 0. ddraw7.c:3391: Test failed: Expected (0,0)-(640,480), got (0,0)-(720,480). ddraw7.c:3396: Test failed: Expected surface width 640, got 720. ddraw7.c:3417: Test failed: Expected (0,0)-(640,480), got (0,0)-(720,480). ddraw7.c:3437: Test failed: Expected (0,0)-(640,480), got (0,0)-(720,480). ddraw7.c:3450: Test failed: Expected resolution 640x480, got 720x480. ddraw7.c:3467: Test failed: Expected surface width 640, got 720. ddraw7.c:3474: Test failed: Expected (0,0)-(640,480), got (0,0)-(720,480). ddraw7.c:3491: Test failed: Expected message 0x47, but didn't receive it. ddraw7.c:3493: Test failed: Expected screen size 640x480, got 0x0. ddraw7.c:3500: Test failed: Expected (0,0)-(640,480), got (0,0)-(720,480). ddraw7.c:3512: Test failed: Expected surface width 640, got 720. ddraw7.c:3565: Test failed: Expected screen size 2 640x480, got 720x480. ddraw7.c:3573: Test failed: Expected (0,0)-(640,480), got (0,0)-(720,480). ddraw7.c:3585: Test failed: Expected surface width 640, got 720.
=== debian11 (32 bit German report) ===
ddraw: ddraw2.c:4109: Test failed: Got a different mode.
=== debian11 (32 bit French report) ===
ddraw: ddraw7.c:3858: Test failed: Got unexpected screen width 800. ddraw7.c:3860: Test failed: Got unexpected screen height 600. ddraw7.c:3881: Test failed: Got unexpected screen width 800. ddraw7.c:3883: Test failed: Got unexpected screen height 600. ddraw7.c:3888: Test failed: Got unexpected screen width 800. ddraw7.c:3890: Test failed: Got unexpected screen height 600.
=== debian11 (32 bit Hindi:India report) ===
ddraw: ddraw7.c:3761: Test failed: Got unexpected screen width 800. ddraw7.c:3763: Test failed: Got unexpected screen height 600. ddraw7.c:3768: Test failed: Got unexpected screen width 800. ddraw7.c:3770: Test failed: Got unexpected screen height 600. ddraw7.c:3792: Test failed: Got unexpected screen width 800. ddraw7.c:3794: Test failed: Got unexpected screen height 600. ddraw7.c:3799: Test failed: Got unexpected screen width 800. ddraw7.c:3801: Test failed: Got unexpected screen height 600. ddraw7.c:3823: Test failed: Got unexpected screen width 800. ddraw7.c:3825: Test failed: Got unexpected screen height 600. ddraw7.c:3858: Test failed: Got unexpected screen width 800. ddraw7.c:3860: Test failed: Got unexpected screen height 600. ddraw7.c:3881: Test failed: Got unexpected screen width 800. ddraw7.c:3883: Test failed: Got unexpected screen height 600. ddraw7.c:3888: Test failed: Got unexpected screen width 800. ddraw7.c:3890: Test failed: Got unexpected screen height 600.
=== debian11 (32 bit Chinese:China report) ===
ddraw: ddraw7.c:3274: Test failed: Expected (0,0)-(640,480), got (0,0)-(1024,768). ddraw7.c:3310: Test failed: Expected (0,0)-(640,480), got (0,0)-(1024,768).
=== debian11 (32 bit WoW report) ===
ddraw: ddraw7.c:3736: Test failed: Got unexpected screen width 800. ddraw7.c:3738: Test failed: Got unexpected screen height 600.
=== debian11 (64 bit WoW report) ===
ddraw: ddraw7.c:2616: Test failed: Expected window style 0x4cf0000, got 0xa40b0000. ddraw7.c:2635: Test failed: Expected (0,0)-(640,480), got (-32000,-32000)-(-31840,-31976). ddraw7.c:2658: Test failed: Expected (0,0)-(640,480), got (-32000,-32000)-(-31840,-31976). ddraw7.c:2678: Test failed: Expected window style 0x4cf0000, got 0xa40b0000.