[PATCH 2/2] wined3d: Update the swapchain windows' sizes after it has been unminimized.

Gabriel Ivăncescu gabrielopcode at gmail.com
Tue Sep 29 10:45:13 CDT 2020


Fixes a regression introduced by commit
82c6ec3a32f44e8b3e0cc88b7f10e0c0d7fa1b89, which caused the WM_ACTIVATEAPP
to be sent while the window is minimized, if it has been clicked on in the
taskbar to be restored. The behavior is correct wrt Windows, but some games
expect the window pos change messages to be sent while they are unminimized,
but we only sent it during the WM_ACTIVATEAPP hook.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
---
 dlls/wined3d/device.c    | 11 ++++++++---
 dlls/wined3d/swapchain.c |  3 ++-
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 754dd76..e76eaa5 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -5818,6 +5818,8 @@ void device_invalidate_state(const struct wined3d_device *device, unsigned int s
 LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL unicode,
         UINT message, WPARAM wparam, LPARAM lparam, WNDPROC proc)
 {
+    unsigned int i;
+
     if (message == WM_DESTROY)
     {
         TRACE("unregister window %p.\n", window);
@@ -5832,13 +5834,11 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL
     }
     else if (message == WM_ACTIVATEAPP)
     {
-        unsigned int i = device->swapchain_count;
-
         /* Deactivating the implicit swapchain may cause the application
          * (e.g. Deus Ex: GOTY) to destroy the device, so take care to
          * deactivate the implicit swapchain last, and to avoid accessing the
          * "device" pointer afterwards. */
-        while (i--)
+        for (i = device->swapchain_count; i--;)
             wined3d_swapchain_activate(device->swapchains[i], wparam);
     }
     else if (message == WM_SYSCOMMAND)
@@ -5849,6 +5849,11 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL
                 DefWindowProcW(window, message, wparam, lparam);
             else
                 DefWindowProcA(window, message, wparam, lparam);
+
+            /* Heroes of Might and Magic V depends on this being
+               done after the window has been unminimized. */
+            for (i = device->swapchain_count; i--;)
+                wined3d_swapchain_update_window_size(device->swapchains[i]);
         }
     }
 
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index 8741ed2..dad795a 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -1839,7 +1839,8 @@ void wined3d_swapchain_update_window_size(struct wined3d_swapchain *swapchain)
     struct wined3d_output *output;
     HRESULT hr;
 
-    if (swapchain->device->create_parms.flags & WINED3DCREATE_NOWINDOWCHANGES)
+    if (swapchain->device->create_parms.flags & WINED3DCREATE_NOWINDOWCHANGES ||
+        (GetWindowLongW(swapchain->state.device_window, GWL_STYLE) & WS_MINIMIZE))
         return;
 
     output = wined3d_swapchain_get_output(swapchain);
-- 
2.21.0




More information about the wine-devel mailing list