[PATCH 05/11] dxgi: Implement dxgi_swapchain_SetFullscreenState().
Józef Kucia
jkucia at codeweavers.com
Mon Aug 1 15:28:39 CDT 2016
Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
dlls/dxgi/swapchain.c | 38 ++++++++++++++++++++++++++++++++++++--
dlls/dxgi/tests/device.c | 6 +++---
2 files changed, 39 insertions(+), 5 deletions(-)
diff --git a/dlls/dxgi/swapchain.c b/dlls/dxgi/swapchain.c
index 6b80ead..596da42 100644
--- a/dlls/dxgi/swapchain.c
+++ b/dlls/dxgi/swapchain.c
@@ -204,9 +204,43 @@ static HRESULT STDMETHODCALLTYPE dxgi_swapchain_GetBuffer(IDXGISwapChain *iface,
static HRESULT STDMETHODCALLTYPE DECLSPEC_HOTPATCH dxgi_swapchain_SetFullscreenState(IDXGISwapChain *iface,
BOOL fullscreen, IDXGIOutput *target)
{
- FIXME("iface %p, fullscreen %#x, target %p stub!\n", iface, fullscreen, target);
+ struct dxgi_swapchain *swapchain = impl_from_IDXGISwapChain(iface);
+ struct wined3d_swapchain_desc swapchain_desc;
+ HRESULT hr;
- return E_NOTIMPL;
+ TRACE("iface %p, fullscreen %#x, target %p.\n", iface, fullscreen, target);
+
+ if (!fullscreen && target)
+ {
+ WARN("Invalid call.\n");
+ return DXGI_ERROR_INVALID_CALL;
+ }
+
+ if (fullscreen)
+ {
+ if (target)
+ {
+ IDXGIOutput_AddRef(target);
+ }
+ else if (!target && FAILED(hr = IDXGISwapChain_GetContainingOutput(iface, &target)))
+ {
+ WARN("Failed to get default target output for swapchain, hr %#x.\n", hr);
+ return hr;
+ }
+ }
+
+ swapchain->fullscreen = fullscreen;
+ if (swapchain->target)
+ IDXGIOutput_Release(swapchain->target);
+ swapchain->target = target;
+
+ wined3d_mutex_lock();
+ wined3d_swapchain_get_desc(swapchain->wined3d_swapchain, &swapchain_desc);
+ swapchain_desc.windowed = !fullscreen;
+ hr = wined3d_swapchain_set_fullscreen(swapchain->wined3d_swapchain, &swapchain_desc, NULL);
+ wined3d_mutex_unlock();
+
+ return hr;
}
static HRESULT STDMETHODCALLTYPE dxgi_swapchain_GetFullscreenState(IDXGISwapChain *iface,
diff --git a/dlls/dxgi/tests/device.c b/dlls/dxgi/tests/device.c
index 3c43895..9c0aa9d 100644
--- a/dlls/dxgi/tests/device.c
+++ b/dlls/dxgi/tests/device.c
@@ -545,7 +545,7 @@ static void test_create_swapchain(void)
"Denominator %u is %u.\n", i ,result_desc.BufferDesc.RefreshRate.Denominator);
hr = IDXGISwapChain_SetFullscreenState(swapchain, FALSE, NULL);
- todo_wine ok(SUCCEEDED(hr), "SetFullscreenState failed, hr %#x.\n", hr);
+ ok(SUCCEEDED(hr), "SetFullscreenState failed, hr %#x.\n", hr);
IDXGISwapChain_Release(swapchain);
}
@@ -1301,7 +1301,7 @@ static void test_swapchain_parameters(void)
if (FAILED(hr))
{
hr = IDXGISwapChain_SetFullscreenState(swapchain, FALSE, NULL);
- todo_wine ok(SUCCEEDED(hr), "SetFullscreenState failed, hr %#x.\n", hr);
+ ok(SUCCEEDED(hr), "SetFullscreenState failed, hr %#x.\n", hr);
IDXGISwapChain_Release(swapchain);
continue;
@@ -1357,7 +1357,7 @@ static void test_swapchain_parameters(void)
ok(hr == DXGI_ERROR_INVALID_CALL, "GetBuffer(%u) returned unexpected hr %#x, test %u.\n", j, hr, i);
hr = IDXGISwapChain_SetFullscreenState(swapchain, FALSE, NULL);
- todo_wine ok(SUCCEEDED(hr), "SetFullscreenState failed, hr %#x.\n", hr);
+ ok(SUCCEEDED(hr), "SetFullscreenState failed, hr %#x.\n", hr);
IDXGISwapChain_Release(swapchain);
}
--
2.7.3
More information about the wine-patches
mailing list