Gabriel Ivăncescu : wined3d: Don't change the swapchain window z-order if no window changes were requested.

Alexandre Julliard julliard at winehq.org
Tue Jul 7 15:47:08 CDT 2020


Module: wine
Branch: master
Commit: 7c0e2a0ca6c8423e886871fd853d9c39bbdeae14
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=7c0e2a0ca6c8423e886871fd853d9c39bbdeae14

Author: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Date:   Wed Jul  8 00:01:12 2020 +0430

wined3d: Don't change the swapchain window z-order if no window changes were requested.

Based on a patch by Rémi Bernon.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/d3d9/device.c       | 6 ++++++
 dlls/d3d9/tests/d3d9ex.c | 6 ++++--
 dlls/d3d9/tests/device.c | 2 +-
 dlls/wined3d/swapchain.c | 7 +++++--
 include/wine/wined3d.h   | 1 +
 5 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 9b1dac0b58..0cf9677c97 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -886,6 +886,7 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_device_CreateAdditionalSwapChain(ID
         D3DPRESENT_PARAMETERS *present_parameters, IDirect3DSwapChain9 **swapchain)
 {
     struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface);
+    struct wined3d_device_creation_parameters creation_parameters;
     struct wined3d_swapchain_desc desc;
     struct d3d9_swapchain *object;
     unsigned int swap_interval;
@@ -924,6 +925,9 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_device_CreateAdditionalSwapChain(ID
     if (!wined3d_swapchain_desc_from_d3d9(&desc, device->d3d_parent->wined3d_outputs[output_idx],
             present_parameters, device->d3d_parent->extended))
         return D3DERR_INVALIDCALL;
+    wined3d_device_get_creation_parameters(device->wined3d_device, &creation_parameters);
+    if (creation_parameters.flags & WINED3DCREATE_NOWINDOWCHANGES)
+        desc.flags |= WINED3D_SWAPCHAIN_NO_WINDOW_CHANGES;
     swap_interval = wined3dswapinterval_from_d3d(present_parameters->PresentationInterval);
     if (SUCCEEDED(hr = d3d9_swapchain_create(device, &desc, swap_interval, &object)))
         *swapchain = (IDirect3DSwapChain9 *)&object->IDirect3DSwapChain9Ex_iface;
@@ -4780,6 +4784,8 @@ HRESULT device_init(struct d3d9_device *device, struct d3d9 *parent, struct wine
             return D3DERR_INVALIDCALL;
         }
         swapchain_desc[i].flags |= WINED3D_SWAPCHAIN_IMPLICIT;
+        if (flags & D3DCREATE_NOWINDOWCHANGES)
+            swapchain_desc[i].flags |= WINED3D_SWAPCHAIN_NO_WINDOW_CHANGES;
     }
 
     if (FAILED(hr = d3d9_swapchain_create(device, swapchain_desc,
diff --git a/dlls/d3d9/tests/d3d9ex.c b/dlls/d3d9/tests/d3d9ex.c
index f475d55cc8..76565c4ec2 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 a15c04fa45..14ca12ecd8 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -5025,7 +5025,7 @@ static void test_window_style(void)
                     expected_style, style, i);
         style = GetWindowLongA(device_window, GWL_EXSTYLE);
         expected_style = device_exstyle | tests[i].exstyle;
-        todo_wine_if ((tests[i].device_flags & CREATE_DEVICE_NOWINDOWCHANGES) || (tests[i].create_style & WS_VISIBLE))
+        todo_wine_if (!(tests[i].device_flags & CREATE_DEVICE_NOWINDOWCHANGES) && (tests[i].create_style & WS_VISIBLE))
             ok(style == expected_style, "Expected device window extended style %#x, got %#x, i=%u.\n",
                     expected_style, style, i);
 
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index e9d62728b4..00d51d6f6d 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -2065,6 +2065,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 +2083,9 @@ HRESULT wined3d_swapchain_state_setup_fullscreen(struct wined3d_swapchain_state
                 window, state->style, state->exstyle);
     }
 
+    if (state->desc.flags & WINED3D_SWAPCHAIN_NO_WINDOW_CHANGES)
+        window_pos_flags |= SWP_NOZORDER;
+
     state->style = GetWindowLongW(window, GWL_STYLE);
     state->exstyle = GetWindowLongW(window, GWL_EXSTYLE);
 
@@ -2095,8 +2099,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 346d1d0dfa..0d40d38c56 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_WINDOW_CHANGES                     0x00040000u
 
 #define WINED3DDP_MAXTEXCOORD                                   8
 




More information about the wine-cvs mailing list