Commit 7962c319 authored by Zhiyi Zhang's avatar Zhiyi Zhang Committed by Alexandre Julliard

wined3d: Move device window to the correct output when handling WM_ACTIVATEAPP…

wined3d: Move device window to the correct output when handling WM_ACTIVATEAPP with full screen swapchains. Signed-off-by: 's avatarZhiyi Zhang <zzhang@codeweavers.com> Signed-off-by: 's avatarHenri Verbeet <hverbeet@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 5f14b635
...@@ -1239,9 +1239,11 @@ void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activa ...@@ -1239,9 +1239,11 @@ void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activa
{ {
struct wined3d_device *device = swapchain->device; struct wined3d_device *device = swapchain->device;
HWND window = swapchain->state.device_window; HWND window = swapchain->state.device_window;
struct wined3d_output_desc output_desc;
unsigned int screensaver_active; unsigned int screensaver_active;
struct wined3d_output *output; struct wined3d_output *output;
BOOL focus_messages, filter; BOOL focus_messages, filter;
HRESULT hr;
/* This code is not protected by the wined3d mutex, so it may run while /* This code is not protected by the wined3d mutex, so it may run while
* wined3d_device_reset is active. Testing on Windows shows that changing * wined3d_device_reset is active. Testing on Windows shows that changing
...@@ -1251,6 +1253,13 @@ void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activa ...@@ -1251,6 +1253,13 @@ void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activa
if (!(focus_messages = device->wined3d->flags & WINED3D_FOCUS_MESSAGES)) if (!(focus_messages = device->wined3d->flags & WINED3D_FOCUS_MESSAGES))
filter = wined3d_filter_messages(window, TRUE); filter = wined3d_filter_messages(window, TRUE);
output = wined3d_swapchain_get_output(swapchain);
if (!output)
{
ERR("Failed to get output from swapchain %p.\n", swapchain);
return;
}
if (activate) if (activate)
{ {
SystemParametersInfoW(SPI_GETSCREENSAVEACTIVE, 0, &screensaver_active, 0); SystemParametersInfoW(SPI_GETSCREENSAVEACTIVE, 0, &screensaver_active, 0);
...@@ -1266,16 +1275,19 @@ void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activa ...@@ -1266,16 +1275,19 @@ void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activa
* *
* Guild Wars 1 wants a WINDOWPOSCHANGED message on the device window to * Guild Wars 1 wants a WINDOWPOSCHANGED message on the device window to
* resume drawing after a focus loss. */ * resume drawing after a focus loss. */
SetWindowPos(window, NULL, 0, 0, swapchain->state.desc.backbuffer_width, if (SUCCEEDED(hr = wined3d_output_get_desc(output, &output_desc)))
swapchain->state.desc.backbuffer_height, SWP_NOACTIVATE | SWP_NOZORDER); 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);
} }
if (device->wined3d->flags & WINED3D_RESTORE_MODE_ON_ACTIVATE) if (device->wined3d->flags & WINED3D_RESTORE_MODE_ON_ACTIVATE)
{ {
output = wined3d_swapchain_get_output(swapchain); if (FAILED(hr = wined3d_output_set_display_mode(output,
if (!output || FAILED(wined3d_output_set_display_mode(output,
&swapchain->state.d3d_mode))) &swapchain->state.d3d_mode)))
ERR("Failed to set display mode.\n"); ERR("Failed to set display mode, hr %#x.\n", hr);
} }
if (swapchain == device->swapchains[0]) if (swapchain == device->swapchains[0])
...@@ -1289,9 +1301,8 @@ void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activa ...@@ -1289,9 +1301,8 @@ void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activa
device->restore_screensaver = FALSE; device->restore_screensaver = FALSE;
} }
output = wined3d_swapchain_get_output(swapchain); if (FAILED(hr = wined3d_output_set_display_mode(output, NULL)))
if (!output || FAILED(wined3d_output_set_display_mode(output, NULL))) ERR("Failed to set display mode, hr %#x.\n", hr);
ERR("Failed to set display mode.\n");
swapchain->reapply_mode = TRUE; swapchain->reapply_mode = TRUE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment