[PATCH v2 5/9] wined3d: Don't show the window if no window changes were requested.

Gabriel Ivăncescu gabrielopcode at gmail.com
Mon Jul 6 09:57:16 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 | 4 ++--
 dlls/d3d9/tests/device.c | 5 ++---
 dlls/wined3d/swapchain.c | 7 +++++--
 include/wine/wined3d.h   | 1 +
 4 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/dlls/d3d9/tests/d3d9ex.c b/dlls/d3d9/tests/d3d9ex.c
index 76565c4..2836fdd 100644
--- a/dlls/d3d9/tests/d3d9ex.c
+++ b/dlls/d3d9/tests/d3d9ex.c
@@ -3569,7 +3569,7 @@ static void test_window_style(void)
 
         style = GetWindowLongA(device_window, GWL_STYLE);
         expected_style = device_style;
-        todo_wine_if (!(tests[i].style_flags & WS_VISIBLE))
+        todo_wine_if (!(tests[i].style_flags & WS_VISIBLE) && !(tests[i].device_flags & CREATE_DEVICE_NOWINDOWCHANGES))
             ok(style == expected_style, "Expected device window style %#x, got %#x, i=%u.\n",
                     expected_style, style, i);
         style = GetWindowLongA(device_window, GWL_EXSTYLE);
@@ -3590,7 +3590,7 @@ static void test_window_style(void)
 
         style = GetWindowLongA(device_window, GWL_STYLE);
         expected_style = device_style;
-        todo_wine_if (!(tests[i].style_flags & WS_VISIBLE))
+        todo_wine_if (!(tests[i].style_flags & WS_VISIBLE) && !(tests[i].device_flags & CREATE_DEVICE_NOWINDOWCHANGES))
             ok(style == expected_style, "Expected device window style %#x, got %#x, i=%u.\n",
                     expected_style, style, i);
         style = GetWindowLongA(device_window, GWL_EXSTYLE);
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index 6f10a6c..f2b420c 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -5020,9 +5020,8 @@ static void test_window_style(void)
 
         style = GetWindowLongA(device_window, GWL_STYLE);
         expected_style = device_style | tests[i].style;
-        todo_wine_if ((tests[i].device_flags & CREATE_DEVICE_NOWINDOWCHANGES) && !(tests[i].style & WS_VISIBLE))
-            ok(style == expected_style, "Expected device window style %#x, got %#x, i=%u.\n",
-                    expected_style, style, i);
+        ok(style == expected_style, "Expected device window style %#x, got %#x, i=%u.\n",
+                expected_style, style, i);
         style = GetWindowLongA(device_window, GWL_EXSTYLE);
         expected_style = device_exstyle | tests[i].focus_loss_exstyle | tests[i].exstyle;
         ok(style == expected_style, "Expected device window extended style %#x, got %#x, i=%u.\n",
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index 4c380e0..8ded2cb 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -1350,7 +1350,7 @@ static HRESULT wined3d_swapchain_init(struct wined3d_swapchain *swapchain, struc
         FIXME("Unimplemented swap effect %#x.\n", desc->swap_effect);
 
     if (device->create_parms.flags & WINED3DCREATE_NOWINDOWCHANGES)
-        desc->flags |= WINED3D_SWAPCHAIN_NO_ZORDER_CHANGES;
+        desc->flags |= WINED3D_SWAPCHAIN_NO_VISIBILITY_CHANGES | 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)))
@@ -2068,7 +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;
+    unsigned int window_pos_flags = SWP_FRAMECHANGED | SWP_NOACTIVATE;
     LONG style, exstyle;
     BOOL filter;
 
@@ -2086,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_VISIBILITY_CHANGES))
+        window_pos_flags |= SWP_SHOWWINDOW;
+
     if (state->desc.flags & WINED3D_SWAPCHAIN_NO_ZORDER_CHANGES)
         window_pos_flags |= SWP_NOZORDER;
 
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index ba14e4b..726c715 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -906,6 +906,7 @@ enum wined3d_shader_type
 #define WINED3D_SWAPCHAIN_IMPLICIT                              0x00010000u
 #define WINED3D_SWAPCHAIN_HOOK                                  0x00020000u
 #define WINED3D_SWAPCHAIN_NO_ZORDER_CHANGES                     0x00040000u
+#define WINED3D_SWAPCHAIN_NO_VISIBILITY_CHANGES                 0x00080000u
 
 #define WINED3DDP_MAXTEXCOORD                                   8
 
-- 
2.21.0




More information about the wine-devel mailing list