[PATCH 2/6] wined3d: Minimize device windows on focus loss (v3).

Stefan Dösinger stefan at codeweavers.com
Wed Nov 12 15:15:35 CST 2014


Tests for d3d8 will follow after 107631 has been committed.

v3: Check for D3DCREATE_NOWINDOWCHANGES.

v2: Move to wined3d. The different behavior in d3d9ex was due to a
hidden window and not a difference how d3d9ex handles focus loss. See
patch 7.

Another patch will add an action (resize the window to match the
backbuffer size) on window activation. For this reason the swapchain
helper function is called on both activation and deactivation.
---
 dlls/wined3d/device.c          | 5 +++++
 dlls/wined3d/swapchain.c       | 6 ++++++
 dlls/wined3d/wined3d_private.h | 1 +
 3 files changed, 12 insertions(+)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index ee3636e..0de444b 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4983,6 +4983,11 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL
     }
     else if (message == WM_ACTIVATEAPP)
     {
+        UINT i;
+
+        for (i = 0; i < device->swapchain_count; i++)
+            wined3d_swapchain_activate(device->swapchains[i], wparam);
+
         device->device_parent->ops->activate(device->device_parent, wparam);
     }
 
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index 25e2107..4c0948f 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -1175,3 +1175,9 @@ void swapchain_update_draw_bindings(struct wined3d_swapchain *swapchain)
         wined3d_resource_update_draw_binding(&swapchain->back_buffers[i]->resource);
     }
 }
+
+void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activate)
+{
+    if (!activate && !(swapchain->device->create_parms.flags & WINED3DCREATE_NOWINDOWCHANGES))
+        ShowWindow(swapchain->device_window, SW_MINIMIZE);
+}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 0f302c4..5f90e9a 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2701,6 +2701,7 @@ struct wined3d_swapchain
 
 void x11_copy_to_screen(const struct wined3d_swapchain *swapchain, const RECT *rect) DECLSPEC_HIDDEN;
 
+void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activate) DECLSPEC_HIDDEN;
 struct wined3d_context *swapchain_get_context(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
 void swapchain_destroy_contexts(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
 HDC swapchain_get_backup_dc(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
-- 
2.0.4




More information about the wine-patches mailing list