Commit b94a6b1e authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Do not acquire/release the focus window in wined3d_swapchain_set_fullscreen().

parent 2b2ea820
......@@ -4685,7 +4685,6 @@ static void test_swapchain_window_messages(void)
hr = IDXGISwapChain_SetFullscreenState(swapchain, FALSE, NULL);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
flush_events();
todo_wine
ok(!expect_messages->message, "Expected message %#x.\n", expect_messages->message);
expect_messages = NULL;
......@@ -4717,7 +4716,6 @@ static void test_swapchain_window_messages(void)
hr = IDXGISwapChain_SetFullscreenState(swapchain, FALSE, NULL);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
flush_events();
todo_wine
ok(!expect_messages->message, "Expected message %#x.\n", expect_messages->message);
expect_messages = NULL;
......
......@@ -5405,7 +5405,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
struct wined3d_rendertarget_view *view;
struct wined3d_swapchain *swapchain;
struct wined3d_view_desc view_desc;
BOOL backbuffer_resized;
BOOL backbuffer_resized, windowed;
HRESULT hr = WINED3D_OK;
unsigned int i;
......@@ -5496,13 +5496,30 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
backbuffer_resized = swapchain_desc->backbuffer_width != swapchain->desc.backbuffer_width
|| swapchain_desc->backbuffer_height != swapchain->desc.backbuffer_height;
windowed = swapchain->desc.windowed;
if (!swapchain_desc->windowed != !swapchain->desc.windowed
|| swapchain->reapply_mode || mode
|| (!swapchain_desc->windowed && backbuffer_resized))
if (!swapchain_desc->windowed != !windowed || swapchain->reapply_mode
|| mode || (!swapchain_desc->windowed && backbuffer_resized))
{
/* Switch from windowed to fullscreen. */
if (windowed && !swapchain_desc->windowed)
{
HWND focus_window = device->create_parms.focus_window;
if (!focus_window)
focus_window = swapchain->device_window;
if (FAILED(hr = wined3d_device_acquire_focus_window(device, focus_window)))
{
ERR("Failed to acquire focus window, hr %#x.\n", hr);
return hr;
}
}
if (FAILED(hr = wined3d_swapchain_set_fullscreen(swapchain, swapchain_desc, mode)))
return hr;
/* Switch from fullscreen to windowed. */
if (!windowed && swapchain_desc->windowed)
wined3d_device_release_focus_window(device);
}
else if (!swapchain_desc->windowed)
{
......
......@@ -1474,15 +1474,6 @@ HRESULT CDECL wined3d_swapchain_set_fullscreen(struct wined3d_swapchain *swapcha
if (swapchain->desc.windowed)
{
/* Switch from windowed to fullscreen */
HWND focus_window = device->create_parms.focus_window;
if (!focus_window)
focus_window = swapchain->device_window;
if (FAILED(hr = wined3d_device_acquire_focus_window(device, focus_window)))
{
ERR("Failed to acquire focus window, hr %#x.\n", hr);
return hr;
}
wined3d_device_setup_fullscreen_window(device, swapchain->device_window, width, height);
}
else
......@@ -1505,7 +1496,6 @@ HRESULT CDECL wined3d_swapchain_set_fullscreen(struct wined3d_swapchain *swapcha
if (swapchain->desc.flags & WINED3D_SWAPCHAIN_RESTORE_WINDOW_RECT)
window_rect = &swapchain->original_window_rect;
wined3d_device_restore_fullscreen_window(device, swapchain->device_window, window_rect);
wined3d_device_release_focus_window(device);
}
swapchain->desc.windowed = swapchain_desc->windowed;
......
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