wined3d: Don't change the swapchain window z-order if no window changes were requested.

Based on a patch by Rémi Bernon.

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:12 +04:30 committed by Alexandre Julliard
parent b1fe20d100
commit 7c0e2a0ca6
5 changed files with 17 additions and 5 deletions

View File

@ -886,6 +886,7 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_device_CreateAdditionalSwapChain(ID
D3DPRESENT_PARAMETERS *present_parameters, IDirect3DSwapChain9 **swapchain)
{
struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface);
struct wined3d_device_creation_parameters creation_parameters;
struct wined3d_swapchain_desc desc;
struct d3d9_swapchain *object;
unsigned int swap_interval;
@ -924,6 +925,9 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_device_CreateAdditionalSwapChain(ID
if (!wined3d_swapchain_desc_from_d3d9(&desc, device->d3d_parent->wined3d_outputs[output_idx],
present_parameters, device->d3d_parent->extended))
return D3DERR_INVALIDCALL;
wined3d_device_get_creation_parameters(device->wined3d_device, &creation_parameters);
if (creation_parameters.flags & WINED3DCREATE_NOWINDOWCHANGES)
desc.flags |= WINED3D_SWAPCHAIN_NO_WINDOW_CHANGES;
swap_interval = wined3dswapinterval_from_d3d(present_parameters->PresentationInterval);
if (SUCCEEDED(hr = d3d9_swapchain_create(device, &desc, swap_interval, &object)))
*swapchain = (IDirect3DSwapChain9 *)&object->IDirect3DSwapChain9Ex_iface;
@ -4780,6 +4784,8 @@ HRESULT device_init(struct d3d9_device *device, struct d3d9 *parent, struct wine
return D3DERR_INVALIDCALL;
}
swapchain_desc[i].flags |= WINED3D_SWAPCHAIN_IMPLICIT;
if (flags & D3DCREATE_NOWINDOWCHANGES)
swapchain_desc[i].flags |= WINED3D_SWAPCHAIN_NO_WINDOW_CHANGES;
}
if (FAILED(hr = d3d9_swapchain_create(device, swapchain_desc,

View File

@ -3574,7 +3574,8 @@ static void test_window_style(void)
expected_style, style, i);
style = GetWindowLongA(device_window, GWL_EXSTYLE);
expected_style = device_exstyle;
todo_wine ok(style == expected_style, "Expected device window extended style %#x, got %#x, i=%u.\n",
todo_wine_if (!(tests[i].device_flags & CREATE_DEVICE_NOWINDOWCHANGES))
ok(style == expected_style, "Expected device window extended style %#x, got %#x, i=%u.\n",
expected_style, style, i);
style = GetWindowLongA(focus_window, GWL_STYLE);
@ -3594,7 +3595,8 @@ static void test_window_style(void)
expected_style, style, i);
style = GetWindowLongA(device_window, GWL_EXSTYLE);
expected_style = device_exstyle;
todo_wine ok(style == expected_style, "Expected device window extended style %#x, got %#x, i=%u.\n",
todo_wine_if (!(tests[i].device_flags & CREATE_DEVICE_NOWINDOWCHANGES))
ok(style == expected_style, "Expected device window extended style %#x, got %#x, i=%u.\n",
expected_style, style, i);
style = GetWindowLongA(focus_window, GWL_STYLE);

View File

@ -5025,7 +5025,7 @@ static void test_window_style(void)
expected_style, style, i);
style = GetWindowLongA(device_window, GWL_EXSTYLE);
expected_style = device_exstyle | tests[i].exstyle;
todo_wine_if ((tests[i].device_flags & CREATE_DEVICE_NOWINDOWCHANGES) || (tests[i].create_style & WS_VISIBLE))
todo_wine_if (!(tests[i].device_flags & CREATE_DEVICE_NOWINDOWCHANGES) && (tests[i].create_style & WS_VISIBLE))
ok(style == expected_style, "Expected device window extended style %#x, got %#x, i=%u.\n",
expected_style, style, i);

View File

@ -2065,6 +2065,7 @@ static LONG fullscreen_exstyle(LONG exstyle)
HRESULT wined3d_swapchain_state_setup_fullscreen(struct wined3d_swapchain_state *state,
HWND window, int x, int y, int width, int height)
{
unsigned int window_pos_flags = SWP_FRAMECHANGED | SWP_SHOWWINDOW | SWP_NOACTIVATE;
LONG style, exstyle;
BOOL filter;
@ -2082,6 +2083,9 @@ HRESULT wined3d_swapchain_state_setup_fullscreen(struct wined3d_swapchain_state
window, state->style, state->exstyle);
}
if (state->desc.flags & WINED3D_SWAPCHAIN_NO_WINDOW_CHANGES)
window_pos_flags |= SWP_NOZORDER;
state->style = GetWindowLongW(window, GWL_STYLE);
state->exstyle = GetWindowLongW(window, GWL_EXSTYLE);
@ -2095,8 +2099,7 @@ HRESULT wined3d_swapchain_state_setup_fullscreen(struct wined3d_swapchain_state
SetWindowLongW(window, GWL_STYLE, style);
SetWindowLongW(window, GWL_EXSTYLE, exstyle);
SetWindowPos(window, HWND_TOPMOST, x, y, width, height,
SWP_FRAMECHANGED | SWP_SHOWWINDOW | SWP_NOACTIVATE);
SetWindowPos(window, HWND_TOPMOST, x, y, width, height, window_pos_flags);
wined3d_filter_messages(window, filter);

View File

@ -905,6 +905,7 @@ enum wined3d_shader_type
#define WINED3D_SWAPCHAIN_GDI_COMPATIBLE 0x00008000u
#define WINED3D_SWAPCHAIN_IMPLICIT 0x00010000u
#define WINED3D_SWAPCHAIN_HOOK 0x00020000u
#define WINED3D_SWAPCHAIN_NO_WINDOW_CHANGES 0x00040000u
#define WINED3DDP_MAXTEXCOORD 8