wined3d: Do not acquire/release the focus window in wined3d_swapchain_set_fullscreen().
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
2b2ea820a4
commit
b94a6b1efd
|
@ -4685,7 +4685,6 @@ static void test_swapchain_window_messages(void)
|
||||||
hr = IDXGISwapChain_SetFullscreenState(swapchain, FALSE, NULL);
|
hr = IDXGISwapChain_SetFullscreenState(swapchain, FALSE, NULL);
|
||||||
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
flush_events();
|
flush_events();
|
||||||
todo_wine
|
|
||||||
ok(!expect_messages->message, "Expected message %#x.\n", expect_messages->message);
|
ok(!expect_messages->message, "Expected message %#x.\n", expect_messages->message);
|
||||||
expect_messages = NULL;
|
expect_messages = NULL;
|
||||||
|
|
||||||
|
@ -4717,7 +4716,6 @@ static void test_swapchain_window_messages(void)
|
||||||
hr = IDXGISwapChain_SetFullscreenState(swapchain, FALSE, NULL);
|
hr = IDXGISwapChain_SetFullscreenState(swapchain, FALSE, NULL);
|
||||||
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
flush_events();
|
flush_events();
|
||||||
todo_wine
|
|
||||||
ok(!expect_messages->message, "Expected message %#x.\n", expect_messages->message);
|
ok(!expect_messages->message, "Expected message %#x.\n", expect_messages->message);
|
||||||
expect_messages = NULL;
|
expect_messages = NULL;
|
||||||
|
|
||||||
|
|
|
@ -5405,7 +5405,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
|
||||||
struct wined3d_rendertarget_view *view;
|
struct wined3d_rendertarget_view *view;
|
||||||
struct wined3d_swapchain *swapchain;
|
struct wined3d_swapchain *swapchain;
|
||||||
struct wined3d_view_desc view_desc;
|
struct wined3d_view_desc view_desc;
|
||||||
BOOL backbuffer_resized;
|
BOOL backbuffer_resized, windowed;
|
||||||
HRESULT hr = WINED3D_OK;
|
HRESULT hr = WINED3D_OK;
|
||||||
unsigned int i;
|
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
|
backbuffer_resized = swapchain_desc->backbuffer_width != swapchain->desc.backbuffer_width
|
||||||
|| swapchain_desc->backbuffer_height != swapchain->desc.backbuffer_height;
|
|| swapchain_desc->backbuffer_height != swapchain->desc.backbuffer_height;
|
||||||
|
windowed = swapchain->desc.windowed;
|
||||||
|
|
||||||
if (!swapchain_desc->windowed != !swapchain->desc.windowed
|
if (!swapchain_desc->windowed != !windowed || swapchain->reapply_mode
|
||||||
|| swapchain->reapply_mode || mode
|
|| mode || (!swapchain_desc->windowed && backbuffer_resized))
|
||||||
|| (!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)))
|
if (FAILED(hr = wined3d_swapchain_set_fullscreen(swapchain, swapchain_desc, mode)))
|
||||||
return hr;
|
return hr;
|
||||||
|
|
||||||
|
/* Switch from fullscreen to windowed. */
|
||||||
|
if (!windowed && swapchain_desc->windowed)
|
||||||
|
wined3d_device_release_focus_window(device);
|
||||||
}
|
}
|
||||||
else if (!swapchain_desc->windowed)
|
else if (!swapchain_desc->windowed)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1474,15 +1474,6 @@ HRESULT CDECL wined3d_swapchain_set_fullscreen(struct wined3d_swapchain *swapcha
|
||||||
if (swapchain->desc.windowed)
|
if (swapchain->desc.windowed)
|
||||||
{
|
{
|
||||||
/* Switch from windowed to fullscreen */
|
/* 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);
|
wined3d_device_setup_fullscreen_window(device, swapchain->device_window, width, height);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1505,7 +1496,6 @@ HRESULT CDECL wined3d_swapchain_set_fullscreen(struct wined3d_swapchain *swapcha
|
||||||
if (swapchain->desc.flags & WINED3D_SWAPCHAIN_RESTORE_WINDOW_RECT)
|
if (swapchain->desc.flags & WINED3D_SWAPCHAIN_RESTORE_WINDOW_RECT)
|
||||||
window_rect = &swapchain->original_window_rect;
|
window_rect = &swapchain->original_window_rect;
|
||||||
wined3d_device_restore_fullscreen_window(device, swapchain->device_window, 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;
|
swapchain->desc.windowed = swapchain_desc->windowed;
|
||||||
|
|
Loading…
Reference in New Issue