=?UTF-8?Q?Stefan=20D=C3=B6singer=20?=: wined3d: Deactivate the device before minimizing the window.

Alexandre Julliard julliard at winehq.org
Mon Oct 15 16:15:28 CDT 2018


Module: wine
Branch: master
Commit: 222d30754e55ac32939e0689dcb027e7a4518150
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=222d30754e55ac32939e0689dcb027e7a4518150

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Sat Oct 13 16:13:51 2018 -0700

wined3d: Deactivate the device before minimizing the window.

This fixes tabbing out of Deus Ex Game of the Year edition.

Signed-off-by: Stefan Dösinger <stefan at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wined3d/device.c    |  2 --
 dlls/wined3d/swapchain.c | 14 ++++++++++++++
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index abb2a89..70d43e0 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -5319,8 +5319,6 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL
 
         for (i = 0; i < device->swapchain_count; i++)
             wined3d_swapchain_activate(device->swapchains[i], wparam);
-
-        device->device_parent->ops->activate(device->device_parent, wparam);
     }
     else if (message == WM_SYSCOMMAND)
     {
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index b068cf1..9c48de2 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -1162,6 +1162,9 @@ void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activa
                     device->adapter->ordinal, &swapchain->d3d_mode)))
                 ERR("Failed to set display mode.\n");
         }
+
+        if (swapchain == device->swapchains[0])
+            device->device_parent->ops->activate(device->device_parent, TRUE);
     }
     else
     {
@@ -1171,6 +1174,17 @@ void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activa
 
         swapchain->reapply_mode = TRUE;
 
+        /* Some DDraw apps (Deus Ex: GOTY, and presumably all UT 1 based games) destroy the device
+         * during window minimization. Do our housekeeping now, as the device may not exist after
+         * the ShowWindow call.
+         *
+         * In d3d9, the device is marked lost after the window is minimized. If we find an app
+         * that needs this behavior (e.g. because it calls TestCooperativeLevel in the window proc)
+         * we'll have to control this via a create flag. Note that the device and swapchain are not
+         * safe to access after the ShowWindow call. */
+        if (swapchain == device->swapchains[0])
+            device->device_parent->ops->activate(device->device_parent, FALSE);
+
         if (!(device->create_parms.flags & WINED3DCREATE_NOWINDOWCHANGES)
                 && IsWindowVisible(swapchain->device_window))
             ShowWindow(swapchain->device_window, SW_MINIMIZE);




More information about the wine-cvs mailing list