Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/wined3d/swapchain.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index ea93212a24f9..7a3f1ff95e90 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -796,15 +796,16 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3 GetClientRect(window, &client_rect); if (desc->windowed) { + TRACE("Client rect %s.\n", wine_dbgstr_rect(&client_rect)); + if (!desc->backbuffer_width) { - desc->backbuffer_width = client_rect.right; + desc->backbuffer_width = client_rect.right ? client_rect.right : 8; TRACE("Updating width to %u.\n", desc->backbuffer_width); } - if (!desc->backbuffer_height) { - desc->backbuffer_height = client_rect.bottom; + desc->backbuffer_height = client_rect.bottom ? client_rect.bottom : 8; TRACE("Updating height to %u.\n", desc->backbuffer_height); }
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/dxgi/tests/device.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
diff --git a/dlls/dxgi/tests/device.c b/dlls/dxgi/tests/device.c index 3ad968308e8b..b18ee5904fb5 100644 --- a/dlls/dxgi/tests/device.c +++ b/dlls/dxgi/tests/device.c @@ -1385,6 +1385,29 @@ static void test_create_swapchain(void) expected_width = expected_client_rect->right; expected_height = expected_client_rect->bottom;
+ creation_desc.BufferDesc.Width = 0; + creation_desc.BufferDesc.Height = 0; + hr = IDXGIFactory_CreateSwapChain(factory, obj, &creation_desc, &swapchain); + ok(SUCCEEDED(hr), "CreateSwapChain failed, hr %#x.\n", hr); + hr = IDXGISwapChain_GetDesc(swapchain, &result_desc); + ok(SUCCEEDED(hr), "GetDesc failed, hr %#x.\n", hr); + ok(result_desc.BufferDesc.Width == expected_width, "Got width %u, expected %u.\n", + result_desc.BufferDesc.Width, expected_width); + ok(result_desc.BufferDesc.Height == expected_height, "Got height %u, expected %u.\n", + result_desc.BufferDesc.Height, expected_height); + check_swapchain_fullscreen_state(swapchain, &expected_state); + IDXGISwapChain_Release(swapchain); + + DestroyWindow(creation_desc.OutputWindow); + creation_desc.OutputWindow = CreateWindowA("static", "dxgi_test", + WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, + 1, 1, 0, 0, 0, 0, 0, 0); + SetRect(&expected_state.fullscreen_state.window_rect, 1, 1, 1, 1); + SetRectEmpty(expected_client_rect); + expected_width = expected_height = 8; + + creation_desc.BufferDesc.Width = 0; + creation_desc.BufferDesc.Height = 0; hr = IDXGIFactory_CreateSwapChain(factory, obj, &creation_desc, &swapchain); ok(SUCCEEDED(hr), "CreateSwapChain failed, hr %#x.\n", hr); hr = IDXGISwapChain_GetDesc(swapchain, &result_desc);
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com