[PATCH 2/5] d3d8: Minimize device windows on focus loss.

Stefan Dösinger stefan at codeweavers.com
Tue Sep 23 05:57:15 CDT 2014


---
 dlls/d3d8/Makefile.in |  2 +-
 dlls/d3d8/device.c    | 13 +++++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/dlls/d3d8/Makefile.in b/dlls/d3d8/Makefile.in
index 542a052..033c240 100644
--- a/dlls/d3d8/Makefile.in
+++ b/dlls/d3d8/Makefile.in
@@ -1,6 +1,6 @@
 MODULE    = d3d8.dll
 IMPORTLIB = d3d8
-IMPORTS   = dxguid uuid wined3d
+IMPORTS   = dxguid user32 uuid wined3d
 
 C_SRCS = \
 	buffer.c \
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index 2e74a41..0ff3dc2 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -2934,7 +2934,20 @@ static void CDECL device_parent_activate(struct wined3d_device_parent *device_pa
     TRACE("device_parent %p, activate %#x.\n", device_parent, activate);
 
     if (!activate)
+    {
+        UINT i, count = wined3d_device_get_swapchain_count(device->wined3d_device);
+        struct wined3d_swapchain *swapchain;
+        struct wined3d_swapchain_desc desc;
+
         InterlockedCompareExchange(&device->device_state, D3D8_DEVICE_STATE_LOST, D3D8_DEVICE_STATE_OK);
+
+        for (i = 0; i < count; i++)
+        {
+            swapchain = wined3d_device_get_swapchain(device->wined3d_device, i);
+            wined3d_swapchain_get_desc(swapchain, &desc);
+            ShowWindow(desc.device_window, SW_MINIMIZE);
+        }
+    }
     else
         InterlockedCompareExchange(&device->device_state, D3D8_DEVICE_STATE_NOT_RESET, D3D8_DEVICE_STATE_LOST);
 }
-- 
1.8.5.5




More information about the wine-patches mailing list