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@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Stefan Dösinger 2018-10-13 16:13:51 -07:00 committed by Alexandre Julliard
parent 4e80641d87
commit 222d30754e
2 changed files with 14 additions and 2 deletions

View File

@ -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)
{

View File

@ -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);