[PATCH 2/8] wined3d: Override WM_NCCALCSIZE for fullscreen windows.

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


This still passes the message to the application window proc, but then
overrides the result if the window is fullscreen.

Some games restore window style after D3D has changed the window state
to fullscreen. Overriding this message will make sure the client area
always covers the full screen, regardless of window styles.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
 dlls/wined3d/device.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 54efdb05a73..1ff616bc0f7 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -5652,6 +5652,32 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL
         }
     }
 
+    /* Testing shows we shouldn't hook that message, but doing it allows us
+     * to create fullscreen exclusive windows without altering window styles. */
+    if (message == WM_NCCALCSIZE && wparam == TRUE)
+    {
+        unsigned int i = device->swapchain_count;
+        NCCALCSIZE_PARAMS params = *(NCCALCSIZE_PARAMS*)lparam;
+        LRESULT res;
+
+        if (unicode)
+            res = CallWindowProcW(proc, window, message, wparam, lparam);
+        else
+            res = CallWindowProcA(proc, window, message, wparam, lparam);
+
+        while (i--)
+        {
+            if (device->swapchains[i]->state.device_window == window &&
+                !device->swapchains[i]->state.desc.windowed)
+            {
+                *(NCCALCSIZE_PARAMS*)lparam = params;
+                return 0;
+            }
+        }
+
+        return res;
+    }
+
     if (unicode)
         return CallWindowProcW(proc, window, message, wparam, lparam);
     else
-- 
2.25.0




More information about the wine-devel mailing list