[PATCH 3/8] wined3d: Add WINED3D_SWAPCHAIN_NO_STYLE_CHANGES flag.

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


Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
 dlls/wined3d/swapchain.c | 34 +++++++++++++++++++++-------------
 include/wine/wined3d.h   |  1 +
 2 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index c5fd2879c05..ad91f506cc1 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -1544,6 +1544,7 @@ static LONG fullscreen_exstyle(LONG exstyle)
 HRESULT wined3d_swapchain_state_setup_fullscreen(struct wined3d_swapchain_state *state,
         HWND window, unsigned int w, unsigned int h)
 {
+    unsigned int window_pos_flags = SWP_SHOWWINDOW | SWP_NOACTIVATE;
     LONG style, exstyle;
     BOOL filter;
 
@@ -1564,17 +1565,22 @@ HRESULT wined3d_swapchain_state_setup_fullscreen(struct wined3d_swapchain_state
     state->style = GetWindowLongW(window, GWL_STYLE);
     state->exstyle = GetWindowLongW(window, GWL_EXSTYLE);
 
-    style = fullscreen_style(state->style);
-    exstyle = fullscreen_exstyle(state->exstyle);
+    filter = wined3d_filter_messages(window, TRUE);
+
+    if (!(state->desc.flags & WINED3D_SWAPCHAIN_NO_STYLE_CHANGES))
+    {
+        style = fullscreen_style(state->style);
+        exstyle = fullscreen_exstyle(state->exstyle);
 
-    TRACE("Old style was %08x, %08x, setting to %08x, %08x.\n",
-            state->style, state->exstyle, style, exstyle);
+        TRACE("Old style was %08x, %08x, setting to %08x, %08x.\n",
+                state->style, state->exstyle, style, exstyle);
 
-    filter = wined3d_filter_messages(window, TRUE);
+        SetWindowLongW(window, GWL_STYLE, style);
+        SetWindowLongW(window, GWL_EXSTYLE, exstyle);
+        window_pos_flags |= SWP_FRAMECHANGED;
+    }
 
-    SetWindowLongW(window, GWL_STYLE, style);
-    SetWindowLongW(window, GWL_EXSTYLE, exstyle);
-    SetWindowPos(window, HWND_TOPMOST, 0, 0, w, h, SWP_FRAMECHANGED | SWP_SHOWWINDOW | SWP_NOACTIVATE);
+    SetWindowPos(window, HWND_TOPMOST, 0, 0, w, h, window_pos_flags);
 
     wined3d_filter_messages(window, filter);
 
@@ -1584,7 +1590,7 @@ 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_FRAMECHANGED | SWP_NOZORDER | SWP_NOACTIVATE;
+    unsigned int window_pos_flags = SWP_NOZORDER | SWP_NOACTIVATE;
     LONG style, exstyle;
     RECT rect = {0};
     BOOL filter;
@@ -1604,19 +1610,21 @@ void wined3d_swapchain_state_restore_from_fullscreen(struct wined3d_swapchain_st
     state->style ^= (state->style ^ style) & WS_VISIBLE;
     state->exstyle ^= (state->exstyle ^ exstyle) & WS_EX_TOPMOST;
 
-    TRACE("Restoring window style of window %p to %08x, %08x.\n",
-            window, state->style, state->exstyle);
-
     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 (style == fullscreen_style(state->style) && exstyle == fullscreen_exstyle(state->exstyle))
+    if (!(state->desc.flags & WINED3D_SWAPCHAIN_NO_STYLE_CHANGES) &&
+        style == fullscreen_style(state->style) && exstyle == fullscreen_exstyle(state->exstyle))
     {
+        TRACE("Restoring window style of window %p to %08x, %08x.\n",
+                window, state->style, state->exstyle);
+
         SetWindowLongW(window, GWL_STYLE, state->style);
         SetWindowLongW(window, GWL_EXSTYLE, state->exstyle);
+        window_pos_flags |= SWP_FRAMECHANGED;
     }
 
     if (window_rect)
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 923f184d96d..aab3780d08f 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -906,6 +906,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_STYLE_CHANGES                      0x00040000u
 
 #define WINED3DDP_MAXTEXCOORD                                   8
 
-- 
2.25.0




More information about the wine-devel mailing list