From: Stefan Dösinger Subject: [PATCH 1/7] wined3d: Minimize device windows on focus loss (v2). Message-Id: <1412595782-19231-1-git-send-email-stefan@codeweavers.com> Date: Mon, 6 Oct 2014 13:42:56 +0200 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 aa97c7d..2791443 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -4982,6 +4982,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 1eb2abb..f308731 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) + ShowWindow(swapchain->device_window, SW_MINIMIZE); +} diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 0a65059..aed4369 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2693,6 +2693,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