[PATCH 8/8] wined3d: Always restore styles if changes are allowed.

Rémi Bernon rbernon at codeweavers.com
Wed Mar 11 09:36:34 CDT 2020


Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
 dlls/dxgi/tests/dxgi.c   | 11 ++++-------
 dlls/wined3d/swapchain.c | 22 ++--------------------
 2 files changed, 6 insertions(+), 27 deletions(-)

diff --git a/dlls/dxgi/tests/dxgi.c b/dlls/dxgi/tests/dxgi.c
index 44666515d19..0a11df9b1db 100644
--- a/dlls/dxgi/tests/dxgi.c
+++ b/dlls/dxgi/tests/dxgi.c
@@ -352,7 +352,6 @@ static void capture_fullscreen_state_(unsigned int line, struct fullscreen_state
 static void check_fullscreen_state_(unsigned int line, const struct fullscreen_state *state,
         const struct fullscreen_state *expected_state, BOOL windowed)
 {
-    todo_wine_if(!windowed)
     ok_(__FILE__, line)((state->style & ~WS_VISIBLE) == (expected_state->style & ~WS_VISIBLE),
             "Got style %x, expected %x.\n", (DWORD)(state->style & ~WS_VISIBLE), (DWORD)(expected_state->style & ~WS_VISIBLE));
     ok_(__FILE__, line)((state->exstyle & ~WS_EX_TOPMOST) == (expected_state->exstyle & ~WS_EX_TOPMOST),
@@ -5239,7 +5238,6 @@ static void test_swapchain_window_messages(void)
         goto done;
     }
     flush_events();
-    todo_wine
     ok(!expect_messages->message || broken(!expect_messages_broken->message),
             "Expected message %#x or %#x.\n",
             expect_messages->message, expect_messages_broken->message);
@@ -5270,7 +5268,6 @@ static void test_swapchain_window_messages(void)
     hr = IDXGIFactory_CreateSwapChain(factory, (IUnknown *)device, &swapchain_desc, &swapchain);
     ok(hr == S_OK, "Failed to create swapchain, hr %#x.\n", hr);
     flush_events();
-    todo_wine
     ok(!expect_messages->message || broken(!expect_messages_broken->message),
             "Expected message %#x or %#x.\n",
             expect_messages->message, expect_messages_broken->message);
@@ -5448,10 +5445,10 @@ static void test_swapchain_window_styles(void)
 
             style = GetWindowLongA(swapchain_desc.OutputWindow, GWL_STYLE);
             exstyle = GetWindowLongA(swapchain_desc.OutputWindow, GWL_EXSTYLE);
-            todo_wine
+            todo_wine_if(!(tests[i].expected_style & WS_VISIBLE))
             ok(style == tests[i].expected_style, "Test %u: Got style %#x, expected %#x.\n",
                     i, style, tests[i].expected_style);
-            todo_wine
+            todo_wine_if(!(tests[i].expected_exstyle & WS_EX_TOPMOST))
             ok(exstyle == tests[i].expected_exstyle, "Test %u: Got exstyle %#x, expected %#x.\n",
                     i, exstyle, tests[i].expected_exstyle);
         }
@@ -5465,10 +5462,10 @@ static void test_swapchain_window_styles(void)
 
         style = GetWindowLongA(swapchain_desc.OutputWindow, GWL_STYLE);
         exstyle = GetWindowLongA(swapchain_desc.OutputWindow, GWL_EXSTYLE);
-        todo_wine
+        todo_wine_if(!(tests[i].expected_style & WS_VISIBLE))
         ok(style == tests[i].expected_style, "Test %u: Got style %#x, expected %#x.\n",
                 i, style, tests[i].expected_style);
-        todo_wine
+        todo_wine_if(!(tests[i].expected_exstyle & WS_EX_TOPMOST))
         ok(exstyle == tests[i].expected_exstyle, "Test %u: Got exstyle %#x, expected %#x.\n",
                 i, exstyle, tests[i].expected_exstyle);
 
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index 49f30792a7a..4dff7f4a303 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -1572,34 +1572,16 @@ HRESULT wined3d_swapchain_state_setup_fullscreen(struct wined3d_swapchain_state
 void wined3d_swapchain_state_restore_from_fullscreen(struct wined3d_swapchain_state *state,
         HWND window, const RECT *window_rect)
 {
-    unsigned int window_pos_flags = SWP_NOZORDER | SWP_NOACTIVATE;
-    LONG style, exstyle;
+    unsigned int window_pos_flags = SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOZORDER;
     RECT rect = {0};
     BOOL filter;
 
     if (!state->style && !state->exstyle)
         return;
 
-    style = GetWindowLongW(window, GWL_STYLE);
-    exstyle = GetWindowLongW(window, GWL_EXSTYLE);
-
-    /* These flags are set by wined3d_device_setup_fullscreen_window, not the
-     * application, and we want to ignore them in the test below, since it's
-     * not the application's fault that they changed. Additionally, we want to
-     * preserve the current status of these flags (i.e. don't restore them) to
-     * more closely emulate the behavior of Direct3D, which leaves these flags
-     * alone when returning to windowed mode. */
-    state->style ^= (state->style ^ style) & WS_VISIBLE;
-    state->exstyle ^= (state->exstyle ^ exstyle) & WS_EX_TOPMOST;
-
     filter = wined3d_filter_messages(window, TRUE);
 
-    /* Only restore the style if the application didn't modify it during the
-     * fullscreen phase. Some applications change it before calling Reset()
-     * when switching between windowed and fullscreen modes (HL2), some
-     * depend on the original style (Eve Online). */
-    if (!(state->desc.flags & WINED3D_SWAPCHAIN_NO_STYLE_CHANGES) &&
-        style == fullscreen_style(state->style) && exstyle == fullscreen_exstyle(state->exstyle))
+    if (!(state->desc.flags & WINED3D_SWAPCHAIN_NO_STYLE_CHANGES))
     {
         TRACE("Restoring window style of window %p to %08x, %08x.\n",
                 window, state->style, state->exstyle);
-- 
2.25.0




More information about the wine-devel mailing list