[PATCH v2 4/9] wined3d: Don't change the Z-Order if no window changes were requested.

Gabriel Ivăncescu gabrielopcode at gmail.com
Mon Jul 6 09:57:15 CDT 2020


Based on a patch by Rémi Bernon.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
---
 dlls/d3d9/tests/d3d9ex.c |  6 ++++--
 dlls/d3d9/tests/device.c |  5 ++---
 dlls/wined3d/swapchain.c | 10 ++++++++--
 include/wine/wined3d.h   |  1 +
 4 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/dlls/d3d9/tests/d3d9ex.c b/dlls/d3d9/tests/d3d9ex.c
index f475d55..76565c4 100644
--- a/dlls/d3d9/tests/d3d9ex.c
+++ b/dlls/d3d9/tests/d3d9ex.c
@@ -3574,7 +3574,8 @@ static void test_window_style(void)
                     expected_style, style, i);
         style = GetWindowLongA(device_window, GWL_EXSTYLE);
         expected_style = device_exstyle;
-        todo_wine ok(style == expected_style, "Expected device window extended style %#x, got %#x, i=%u.\n",
+        todo_wine_if (!(tests[i].device_flags & CREATE_DEVICE_NOWINDOWCHANGES))
+        ok(style == expected_style, "Expected device window extended style %#x, got %#x, i=%u.\n",
                 expected_style, style, i);
 
         style = GetWindowLongA(focus_window, GWL_STYLE);
@@ -3594,7 +3595,8 @@ static void test_window_style(void)
                     expected_style, style, i);
         style = GetWindowLongA(device_window, GWL_EXSTYLE);
         expected_style = device_exstyle;
-        todo_wine ok(style == expected_style, "Expected device window extended style %#x, got %#x, i=%u.\n",
+        todo_wine_if (!(tests[i].device_flags & CREATE_DEVICE_NOWINDOWCHANGES))
+        ok(style == expected_style, "Expected device window extended style %#x, got %#x, i=%u.\n",
                 expected_style, style, i);
 
         style = GetWindowLongA(focus_window, GWL_STYLE);
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index 9f6a677..6f10a6c 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -5025,9 +5025,8 @@ static void test_window_style(void)
                     expected_style, style, i);
         style = GetWindowLongA(device_window, GWL_EXSTYLE);
         expected_style = device_exstyle | tests[i].focus_loss_exstyle | tests[i].exstyle;
-        todo_wine_if (tests[i].device_flags & CREATE_DEVICE_NOWINDOWCHANGES)
-            ok(style == expected_style, "Expected device window extended style %#x, got %#x, i=%u.\n",
-                    expected_style, style, i);
+        ok(style == expected_style, "Expected device window extended style %#x, got %#x, i=%u.\n",
+                expected_style, style, i);
 
         style = GetWindowLongA(focus_window, GWL_STYLE);
         ok(style == focus_style, "Expected focus window style %#x, got %#x, i=%u.\n",
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index e9d6272..4c380e0 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -1349,6 +1349,9 @@ static HRESULT wined3d_swapchain_init(struct wined3d_swapchain *swapchain, struc
             && desc->swap_effect != WINED3D_SWAP_EFFECT_COPY)
         FIXME("Unimplemented swap effect %#x.\n", desc->swap_effect);
 
+    if (device->create_parms.flags & WINED3DCREATE_NOWINDOWCHANGES)
+        desc->flags |= WINED3D_SWAPCHAIN_NO_ZORDER_CHANGES;
+
     window = desc->device_window ? desc->device_window : device->create_parms.focus_window;
     if (FAILED(hr = wined3d_swapchain_state_init(&swapchain->state, desc, window)))
     {
@@ -2065,6 +2068,7 @@ static LONG fullscreen_exstyle(LONG exstyle)
 HRESULT wined3d_swapchain_state_setup_fullscreen(struct wined3d_swapchain_state *state,
         HWND window, int x, int y, int width, int height)
 {
+    unsigned int window_pos_flags = SWP_FRAMECHANGED | SWP_SHOWWINDOW | SWP_NOACTIVATE;
     LONG style, exstyle;
     BOOL filter;
 
@@ -2082,6 +2086,9 @@ HRESULT wined3d_swapchain_state_setup_fullscreen(struct wined3d_swapchain_state
                 window, state->style, state->exstyle);
     }
 
+    if (state->desc.flags & WINED3D_SWAPCHAIN_NO_ZORDER_CHANGES)
+        window_pos_flags |= SWP_NOZORDER;
+
     state->style = GetWindowLongW(window, GWL_STYLE);
     state->exstyle = GetWindowLongW(window, GWL_EXSTYLE);
 
@@ -2095,8 +2102,7 @@ HRESULT wined3d_swapchain_state_setup_fullscreen(struct wined3d_swapchain_state
 
     SetWindowLongW(window, GWL_STYLE, style);
     SetWindowLongW(window, GWL_EXSTYLE, exstyle);
-    SetWindowPos(window, HWND_TOPMOST, x, y, width, height,
-            SWP_FRAMECHANGED | SWP_SHOWWINDOW | SWP_NOACTIVATE);
+    SetWindowPos(window, HWND_TOPMOST, x, y, width, height, window_pos_flags);
 
     wined3d_filter_messages(window, filter);
 
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 346d1d0..ba14e4b 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -905,6 +905,7 @@ enum wined3d_shader_type
 #define WINED3D_SWAPCHAIN_GDI_COMPATIBLE                        0x00008000u
 #define WINED3D_SWAPCHAIN_IMPLICIT                              0x00010000u
 #define WINED3D_SWAPCHAIN_HOOK                                  0x00020000u
+#define WINED3D_SWAPCHAIN_NO_ZORDER_CHANGES                     0x00040000u
 
 #define WINED3DDP_MAXTEXCOORD                                   8
 
-- 
2.21.0




More information about the wine-devel mailing list