Commit 6b519355 authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

wined3d: Replace NULL device_window with focus window in swapchain desc.

parent 832383f5
......@@ -1354,7 +1354,7 @@ static void test_swapchain(void)
ok(hr == D3D_OK, "Got hr %#lx.\n", hr);
hr = IDirect3DSwapChain9_GetPresentParameters(swapchain2, &d3dpp);
ok(hr == D3D_OK, "Got hr %#lx.\n", hr);
todo_wine ok(d3dpp.hDeviceWindow == window, "Got window %p, expected %p.\n", d3dpp.hDeviceWindow, window);
ok(d3dpp.hDeviceWindow == window, "Got window %p, expected %p.\n", d3dpp.hDeviceWindow, window);
d3dpp.BackBufferCount = 2;
hr = IDirect3DDevice9_CreateAdditionalSwapChain(device, &d3dpp, &swapchain3);
......@@ -12242,7 +12242,7 @@ static void test_swapchain_parameters(void)
hr = IDirect3DSwapChain9_GetPresentParameters(swapchain, &present_parameters2);
ok(hr == D3D_OK, "Got hr %#lx.\n", hr);
todo_wine ok(present_parameters2.hDeviceWindow == window, "Got window %p, expected %p.\n",
ok(present_parameters2.hDeviceWindow == window, "Got window %p, expected %p.\n",
present_parameters2.hDeviceWindow, window);
ok(present_parameters2.SwapEffect == tests[i].swap_effect, "Swap effect changed from %u to %u, test %u.\n",
tests[i].swap_effect, present_parameters2.SwapEffect, i);
......@@ -12283,7 +12283,7 @@ static void test_swapchain_parameters(void)
ok(hr == D3D_OK, "Got hr %#lx.\n", hr);
hr = IDirect3DSwapChain9_GetPresentParameters(swapchain, &present_parameters2);
ok(hr == D3D_OK, "Got hr %#lx.\n", hr);
todo_wine ok(present_parameters2.hDeviceWindow == window, "Got window %p, expected %p.\n",
ok(present_parameters2.hDeviceWindow == window, "Got window %p, expected %p.\n",
present_parameters2.hDeviceWindow, window);
IDirect3DSwapChain9_Release(swapchain);
IDirect3DDevice9_Release(device);
......
......@@ -5582,6 +5582,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
struct wined3d_view_desc view_desc;
BOOL backbuffer_resized, windowed;
HRESULT hr = WINED3D_OK;
HWND device_window;
unsigned int i;
TRACE("device %p, swapchain_desc %p, mode %p, callback %p, reset_state %#x.\n",
......@@ -5658,12 +5659,13 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
current_desc->refresh_rate = swapchain_desc->refresh_rate;
current_desc->auto_restore_display_mode = swapchain_desc->auto_restore_display_mode;
if (swapchain_desc->device_window && swapchain_desc->device_window != current_desc->device_window)
device_window = swapchain_desc->device_window ? swapchain_desc->device_window : device->create_parms.focus_window;
if (device_window && device_window != current_desc->device_window)
{
TRACE("Changing the device window from %p to %p.\n",
current_desc->device_window, swapchain_desc->device_window);
current_desc->device_window = swapchain_desc->device_window;
swapchain_state->device_window = swapchain_desc->device_window;
current_desc->device_window, device_window);
current_desc->device_window = device_window;
swapchain_state->device_window = device_window;
wined3d_swapchain_set_window(swapchain, NULL);
}
......
......@@ -1459,7 +1459,13 @@ static HRESULT wined3d_swapchain_init(struct wined3d_swapchain *swapchain, struc
&& desc->swap_effect != WINED3D_SWAP_EFFECT_COPY)
FIXME("Unimplemented swap effect %#x.\n", desc->swap_effect);
window = desc->device_window ? desc->device_window : device->create_parms.focus_window;
if (!desc->device_window)
{
TRACE("Updating device_window to %p.\n", device->create_parms.focus_window);
desc->device_window = device->create_parms.focus_window;
}
window = desc->device_window;
if (FAILED(hr = wined3d_swapchain_state_init(&swapchain->state, desc, window, device->wined3d, state_parent)))
{
ERR("Failed to initialise swapchain state, hr %#x.\n", hr);
......
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