[PATCH 6/7] wined3d: Use GetWindowRect if the swapchain is fullscreen exclusive.

Rémi Bernon rbernon at codeweavers.com
Sat Mar 7 04:29:25 CST 2020


Instead of GetClientRect: when fullscreen exclusive mode is supported,
the window decorations aren't removed anymore and the client rectangle
will not be sized as expected.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
 dlls/wined3d/context.c         | 5 ++++-
 dlls/wined3d/swapchain.c       | 8 ++++++--
 dlls/wined3d/texture.c         | 5 ++++-
 dlls/wined3d/wined3d_private.h | 2 ++
 4 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 28e0d262a57..a7023f83af6 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -2701,7 +2701,10 @@ static void wined3d_context_gl_get_rt_size(const struct wined3d_context_gl *cont
     {
         RECT window_size;
 
-        GetClientRect(context_gl->window, &window_size);
+        if (rt->swapchain->state.fullscreen_exclusive)
+            GetWindowRect(context_gl->window, &window_size);
+        else
+            GetClientRect(context_gl->window, &window_size);
         size->cx = window_size.right - window_size.left;
         size->cy = window_size.bottom - window_size.top;
 
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index 65c5d34def7..4b2c42b5bc4 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -203,7 +203,10 @@ HRESULT CDECL wined3d_swapchain_present(struct wined3d_swapchain *swapchain,
 
     if (!dst_rect)
     {
-        GetClientRect(swapchain->win_handle, &d);
+        if (swapchain->state.fullscreen_exclusive)
+            GetWindowRect(swapchain->win_handle, &d);
+        else
+            GetClientRect(swapchain->win_handle, &d);
         dst_rect = &d;
     }
 
@@ -856,6 +859,7 @@ static HRESULT wined3d_swapchain_state_init(struct wined3d_swapchain_state *stat
 
     GetWindowRect(window, &state->original_window_rect);
     state->device_window = window;
+    state->fullscreen_exclusive = FALSE;
 
     return hr;
 }
@@ -899,9 +903,9 @@ static HRESULT wined3d_swapchain_init(struct wined3d_swapchain *swapchain, struc
     swapchain->swap_interval = WINED3D_SWAP_INTERVAL_DEFAULT;
     swapchain_set_max_frame_latency(swapchain, device);
 
-    GetClientRect(window, &client_rect);
     if (desc->windowed)
     {
+        GetClientRect(window, &client_rect);
         TRACE("Client rect %s.\n", wine_dbgstr_rect(&client_rect));
 
         if (!desc->backbuffer_width)
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index b663a44fbb1..159e96792ea 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -89,7 +89,10 @@ void wined3d_texture_translate_drawable_coords(const struct wined3d_texture *tex
         OffsetRect(rect, offset.x, offset.y);
     }
 
-    GetClientRect(window, &windowsize);
+    if (texture->swapchain->state.fullscreen_exclusive)
+        GetWindowRect(window, &windowsize);
+    else
+        GetClientRect(window, &windowsize);
     drawable_height = windowsize.bottom - windowsize.top;
 
     rect->top = drawable_height - rect->top;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 25c4c2dcb26..3edfe17c87b 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -4446,6 +4446,8 @@ struct wined3d_swapchain_state
     LONG style;
     LONG exstyle;
     HWND device_window;
+
+    BOOL fullscreen_exclusive;
 };
 
 void wined3d_swapchain_state_restore_from_fullscreen(struct wined3d_swapchain_state *state,
-- 
2.25.0




More information about the wine-devel mailing list