wined3d: Restore the window visibility and z-order upon exiting fullscreen, if requested.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Gabriel Ivăncescu 2020-07-07 23:43:15 +04:30 committed by Alexandre Julliard
parent f90d607c67
commit 0f024390ca
4 changed files with 13 additions and 4 deletions

View File

@ -5888,10 +5888,8 @@ static void test_swapchain_window_styles(void)
style = GetWindowLongA(swapchain_desc.OutputWindow, GWL_STYLE); style = GetWindowLongA(swapchain_desc.OutputWindow, GWL_STYLE);
exstyle = GetWindowLongA(swapchain_desc.OutputWindow, GWL_EXSTYLE); exstyle = GetWindowLongA(swapchain_desc.OutputWindow, GWL_EXSTYLE);
todo_wine_if(!(tests[i].expected_style & WS_VISIBLE))
ok(style == tests[i].expected_style, "Test %u: Got style %#x, expected %#x.\n", ok(style == tests[i].expected_style, "Test %u: Got style %#x, expected %#x.\n",
i, style, tests[i].expected_style); i, style, tests[i].expected_style);
todo_wine_if(!(tests[i].expected_exstyle & WS_EX_TOPMOST))
ok(exstyle == tests[i].expected_exstyle, "Test %u: Got exstyle %#x, expected %#x.\n", ok(exstyle == tests[i].expected_exstyle, "Test %u: Got exstyle %#x, expected %#x.\n",
i, exstyle, tests[i].expected_exstyle); i, exstyle, tests[i].expected_exstyle);

View File

@ -513,7 +513,8 @@ unsigned int wined3d_bind_flags_from_dxgi_usage(DXGI_USAGE dxgi_usage)
} }
#define DXGI_WINED3D_SWAPCHAIN_FLAGS \ #define DXGI_WINED3D_SWAPCHAIN_FLAGS \
(WINED3D_SWAPCHAIN_USE_CLOSEST_MATCHING_MODE | WINED3D_SWAPCHAIN_RESTORE_WINDOW_RECT | WINED3D_SWAPCHAIN_HOOK) (WINED3D_SWAPCHAIN_USE_CLOSEST_MATCHING_MODE | WINED3D_SWAPCHAIN_RESTORE_WINDOW_RECT \
| WINED3D_SWAPCHAIN_HOOK | WINED3D_SWAPCHAIN_RESTORE_WINDOW_STATE)
unsigned int dxgi_swapchain_flags_from_wined3d(unsigned int wined3d_flags) unsigned int dxgi_swapchain_flags_from_wined3d(unsigned int wined3d_flags)
{ {

View File

@ -2112,6 +2112,7 @@ void wined3d_swapchain_state_restore_from_fullscreen(struct wined3d_swapchain_st
HWND window, const RECT *window_rect) HWND window, const RECT *window_rect)
{ {
unsigned int window_pos_flags = SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOACTIVATE; unsigned int window_pos_flags = SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOACTIVATE;
HWND window_pos_after = NULL;
LONG style, exstyle; LONG style, exstyle;
RECT rect = {0}; RECT rect = {0};
BOOL filter; BOOL filter;
@ -2119,6 +2120,14 @@ void wined3d_swapchain_state_restore_from_fullscreen(struct wined3d_swapchain_st
if (!state->style && !state->exstyle) if (!state->style && !state->exstyle)
return; return;
if ((state->desc.flags & WINED3D_SWAPCHAIN_RESTORE_WINDOW_STATE)
&& !(state->desc.flags & WINED3D_SWAPCHAIN_NO_WINDOW_CHANGES))
{
window_pos_after = (state->exstyle & WS_EX_TOPMOST) ? HWND_TOPMOST : HWND_NOTOPMOST;
window_pos_flags |= (state->style & WS_VISIBLE) ? SWP_SHOWWINDOW : SWP_HIDEWINDOW;
window_pos_flags &= ~SWP_NOZORDER;
}
style = GetWindowLongW(window, GWL_STYLE); style = GetWindowLongW(window, GWL_STYLE);
exstyle = GetWindowLongW(window, GWL_EXSTYLE); exstyle = GetWindowLongW(window, GWL_EXSTYLE);
@ -2150,7 +2159,7 @@ void wined3d_swapchain_state_restore_from_fullscreen(struct wined3d_swapchain_st
rect = *window_rect; rect = *window_rect;
else else
window_pos_flags |= (SWP_NOMOVE | SWP_NOSIZE); window_pos_flags |= (SWP_NOMOVE | SWP_NOSIZE);
SetWindowPos(window, 0, rect.left, rect.top, SetWindowPos(window, window_pos_after, rect.left, rect.top,
rect.right - rect.left, rect.bottom - rect.top, window_pos_flags); rect.right - rect.left, rect.bottom - rect.top, window_pos_flags);
wined3d_filter_messages(window, filter); wined3d_filter_messages(window, filter);

View File

@ -906,6 +906,7 @@ enum wined3d_shader_type
#define WINED3D_SWAPCHAIN_IMPLICIT 0x00010000u #define WINED3D_SWAPCHAIN_IMPLICIT 0x00010000u
#define WINED3D_SWAPCHAIN_HOOK 0x00020000u #define WINED3D_SWAPCHAIN_HOOK 0x00020000u
#define WINED3D_SWAPCHAIN_NO_WINDOW_CHANGES 0x00040000u #define WINED3D_SWAPCHAIN_NO_WINDOW_CHANGES 0x00040000u
#define WINED3D_SWAPCHAIN_RESTORE_WINDOW_STATE 0x00080000u
#define WINED3DDP_MAXTEXCOORD 8 #define WINED3DDP_MAXTEXCOORD 8