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@gmail.com ---
I've added an interactive test in the next patch that the game depends on, and will fail without this patch.
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 b077d53..343df46 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -5845,6 +5845,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); @@ -5859,13 +5861,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) @@ -5876,6 +5876,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..32f52b1 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 || + IsIconic(swapchain->state.device_window)) return;
output = wined3d_swapchain_get_output(swapchain);