wined3d: Validate that we got a valid window in wined3d_device_setup_fullscreen_window().

Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Andrew Eikum 2019-06-20 02:29:48 +04:30 committed by Alexandre Julliard
parent 45166d3313
commit 628d60a159
4 changed files with 17 additions and 5 deletions

View File

@ -2292,7 +2292,7 @@ static void test_set_fullscreen(void)
hr = IDXGISwapChain_SetFullscreenState(swapchain, FALSE, NULL);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
hr = IDXGISwapChain_SetFullscreenState(swapchain, TRUE, NULL);
todo_wine ok(hr == DXGI_ERROR_NOT_CURRENTLY_AVAILABLE, "Got unexpected hr %#x.\n", hr);
ok(hr == DXGI_ERROR_NOT_CURRENTLY_AVAILABLE, "Got unexpected hr %#x.\n", hr);
hr = IDXGISwapChain_SetFullscreenState(swapchain, FALSE, NULL);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
refcount = IDXGISwapChain_Release(swapchain);
@ -2310,7 +2310,7 @@ static void test_set_fullscreen(void)
hr = IDXGISwapChain_SetFullscreenState(swapchain, FALSE, NULL);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
hr = IDXGISwapChain_SetFullscreenState(swapchain, TRUE, NULL);
todo_wine ok(hr == DXGI_ERROR_NOT_CURRENTLY_AVAILABLE, "Got unexpected hr %#x.\n", hr);
ok(hr == DXGI_ERROR_NOT_CURRENTLY_AVAILABLE, "Got unexpected hr %#x.\n", hr);
hr = IDXGISwapChain_SetFullscreenState(swapchain, FALSE, NULL);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
refcount = IDXGISwapChain_Release(swapchain);

View File

@ -927,13 +927,20 @@ static LONG fullscreen_exstyle(LONG exstyle)
return exstyle;
}
void CDECL wined3d_device_setup_fullscreen_window(struct wined3d_device *device, HWND window, UINT w, UINT h)
HRESULT CDECL wined3d_device_setup_fullscreen_window(struct wined3d_device *device,
HWND window, unsigned int w, unsigned int h)
{
BOOL filter_messages;
LONG style, exstyle;
TRACE("Setting up window %p for fullscreen mode.\n", window);
if (!IsWindow(window))
{
WARN("%p is not a valid window.\n", window);
return WINED3DERR_NOTAVAILABLE;
}
if (device->style || device->exStyle)
{
ERR("Changing the window style for window %p, but another style (%08x, %08x) is already stored.\n",
@ -957,6 +964,8 @@ void CDECL wined3d_device_setup_fullscreen_window(struct wined3d_device *device,
SetWindowPos(window, HWND_TOPMOST, 0, 0, w, h, SWP_FRAMECHANGED | SWP_SHOWWINDOW | SWP_NOACTIVATE);
device->filter_messages = filter_messages;
return WINED3D_OK;
}
void CDECL wined3d_device_restore_fullscreen_window(struct wined3d_device *device, HWND window,

View File

@ -1478,7 +1478,9 @@ HRESULT CDECL wined3d_swapchain_set_fullscreen(struct wined3d_swapchain *swapcha
if (swapchain->desc.windowed)
{
/* Switch from windowed to fullscreen */
wined3d_device_setup_fullscreen_window(device, swapchain->device_window, width, height);
if (FAILED(hr = wined3d_device_setup_fullscreen_window(device,
swapchain->device_window, width, height)))
return hr;
}
else
{

View File

@ -2483,7 +2483,8 @@ HRESULT __cdecl wined3d_device_set_vs_consts_i(struct wined3d_device *device,
void __cdecl wined3d_device_set_vs_resource_view(struct wined3d_device *device,
UINT idx, struct wined3d_shader_resource_view *view);
void __cdecl wined3d_device_set_vs_sampler(struct wined3d_device *device, UINT idx, struct wined3d_sampler *sampler);
void __cdecl wined3d_device_setup_fullscreen_window(struct wined3d_device *device, HWND window, UINT w, UINT h);
HRESULT __cdecl wined3d_device_setup_fullscreen_window(struct wined3d_device *device,
HWND window, unsigned int w, unsigned int h);
BOOL __cdecl wined3d_device_show_cursor(struct wined3d_device *device, BOOL show);
void __cdecl wined3d_device_update_sub_resource(struct wined3d_device *device, struct wined3d_resource *resource,
unsigned int sub_resource_idx, const struct wined3d_box *box, const void *data, unsigned int row_pitch,