[PATCH v7 3/6] ddraw: Remove topmost style when going from exclusive mode to normal.

Gabriel Ivăncescu gabrielopcode at gmail.com
Tue Jan 18 10:50:27 CST 2022


Unless DDSCL_NOWINDOWCHANGES was specified.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode at 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);
-- 
2.34.1




More information about the wine-devel mailing list