Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/wined3d/swapchain.c | 49 ++++++++++++++++++++++------------ dlls/wined3d/wined3d_private.h | 1 + 2 files changed, 33 insertions(+), 17 deletions(-)
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index 6270c36..8741ed2 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -1763,7 +1763,6 @@ void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activa { struct wined3d_device *device = swapchain->device; HWND window = swapchain->state.device_window; - struct wined3d_output_desc output_desc; unsigned int screensaver_active; struct wined3d_output *output; BOOL focus_messages, filter; @@ -1790,22 +1789,7 @@ void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activa if ((device->restore_screensaver = !!screensaver_active)) SystemParametersInfoW(SPI_SETSCREENSAVEACTIVE, FALSE, NULL, 0);
- if (!(device->create_parms.flags & WINED3DCREATE_NOWINDOWCHANGES)) - { - /* The d3d versions do not agree on the exact messages here. D3d8 restores - * the window but leaves the size untouched, d3d9 sets the size on an - * invisible window, generates messages but doesn't change the window - * properties. The implementation follows d3d9. - * - * Guild Wars 1 wants a WINDOWPOSCHANGED message on the device window to - * resume drawing after a focus loss. */ - if (SUCCEEDED(hr = wined3d_output_get_desc(output, &output_desc))) - SetWindowPos(window, NULL, output_desc.desktop_rect.left, - output_desc.desktop_rect.top, swapchain->state.desc.backbuffer_width, - swapchain->state.desc.backbuffer_height, SWP_NOACTIVATE | SWP_NOZORDER); - else - ERR("Failed to get output description, hr %#x.\n", hr); - } + wined3d_swapchain_update_window_size(swapchain);
if (device->wined3d->flags & WINED3D_RESTORE_MODE_ON_ACTIVATE) { @@ -1849,6 +1833,37 @@ void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activa wined3d_filter_messages(window, filter); }
+void wined3d_swapchain_update_window_size(struct wined3d_swapchain *swapchain) +{ + struct wined3d_output_desc output_desc; + struct wined3d_output *output; + HRESULT hr; + + if (swapchain->device->create_parms.flags & WINED3DCREATE_NOWINDOWCHANGES) + return; + + output = wined3d_swapchain_get_output(swapchain); + if (!output) + { + ERR("Failed to get output from swapchain %p.\n", swapchain); + return; + } + + /* The d3d versions do not agree on the exact messages here. D3d8 restores + * the window but leaves the size untouched, d3d9 sets the size on an + * invisible window, generates messages but doesn't change the window + * properties. The implementation follows d3d9. + * + * Guild Wars 1 wants a WINDOWPOSCHANGED message on the device window to + * resume drawing after a focus loss. */ + if (SUCCEEDED(hr = wined3d_output_get_desc(output, &output_desc))) + SetWindowPos(swapchain->state.device_window, NULL, output_desc.desktop_rect.left, + output_desc.desktop_rect.top, swapchain->state.desc.backbuffer_width, + swapchain->state.desc.backbuffer_height, SWP_NOACTIVATE | SWP_NOZORDER); + else + ERR("Failed to get output description, hr %#x.\n", hr); +} + HRESULT CDECL wined3d_swapchain_resize_buffers(struct wined3d_swapchain *swapchain, unsigned int buffer_count, unsigned int width, unsigned int height, enum wined3d_format_id format_id, enum wined3d_multisample_type multisample_type, unsigned int multisample_quality) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index abc6e0e..2cf4aa6 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -5104,6 +5104,7 @@ struct wined3d_swapchain
void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activate) DECLSPEC_HIDDEN; void wined3d_swapchain_cleanup(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; +void wined3d_swapchain_update_window_size(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; struct wined3d_output * wined3d_swapchain_get_output(const struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; void swapchain_update_draw_bindings(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; void swapchain_set_max_frame_latency(struct wined3d_swapchain *swapchain,