mirror of
https://github.com/reactos/wine.git
synced 2024-11-24 20:30:01 +00:00
wined3d: Add WINED3D_SWAPCHAIN_RESTORE_WINDOW_RECT flag.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
8d032351f2
commit
2f5850c56a
@ -890,7 +890,7 @@ static HRESULT ddraw_set_cooperative_level(struct ddraw *ddraw, HWND window,
|
||||
if ((cooplevel & DDSCL_FULLSCREEN) != (ddraw->cooperative_level & DDSCL_FULLSCREEN) || window != ddraw->dest_window)
|
||||
{
|
||||
if (ddraw->cooperative_level & DDSCL_FULLSCREEN)
|
||||
wined3d_device_restore_fullscreen_window(ddraw->wined3d_device, ddraw->dest_window);
|
||||
wined3d_device_restore_fullscreen_window(ddraw->wined3d_device, ddraw->dest_window, NULL);
|
||||
|
||||
if (cooplevel & DDSCL_FULLSCREEN)
|
||||
{
|
||||
|
@ -405,6 +405,8 @@ unsigned int dxgi_swapchain_flags_from_wined3d(unsigned int wined3d_flags)
|
||||
{
|
||||
unsigned int flags = 0;
|
||||
|
||||
wined3d_flags &= ~WINED3D_SWAPCHAIN_RESTORE_WINDOW_RECT;
|
||||
|
||||
if (wined3d_flags & WINED3D_SWAPCHAIN_ALLOW_MODE_SWITCH)
|
||||
{
|
||||
wined3d_flags &= ~WINED3D_SWAPCHAIN_ALLOW_MODE_SWITCH;
|
||||
@ -419,7 +421,7 @@ unsigned int dxgi_swapchain_flags_from_wined3d(unsigned int wined3d_flags)
|
||||
|
||||
unsigned int wined3d_swapchain_flags_from_dxgi(unsigned int flags)
|
||||
{
|
||||
unsigned int wined3d_flags = 0; /* WINED3D_SWAPCHAIN_DISCARD_DEPTHSTENCIL? */
|
||||
unsigned int wined3d_flags = WINED3D_SWAPCHAIN_RESTORE_WINDOW_RECT; /* WINED3D_SWAPCHAIN_DISCARD_DEPTHSTENCIL? */
|
||||
|
||||
if (flags & DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH)
|
||||
{
|
||||
|
@ -911,12 +911,16 @@ void CDECL wined3d_device_setup_fullscreen_window(struct wined3d_device *device,
|
||||
device->filter_messages = filter_messages;
|
||||
}
|
||||
|
||||
void CDECL wined3d_device_restore_fullscreen_window(struct wined3d_device *device, HWND window)
|
||||
void CDECL wined3d_device_restore_fullscreen_window(struct wined3d_device *device, HWND window,
|
||||
const RECT *window_rect)
|
||||
{
|
||||
unsigned int window_pos_flags = SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOACTIVATE;
|
||||
BOOL filter_messages;
|
||||
LONG style, exstyle;
|
||||
RECT rect = {0};
|
||||
|
||||
if (!device->style && !device->exStyle) return;
|
||||
if (!device->style && !device->exStyle)
|
||||
return;
|
||||
|
||||
style = GetWindowLongW(window, GWL_STYLE);
|
||||
exstyle = GetWindowLongW(window, GWL_EXSTYLE);
|
||||
@ -945,7 +949,12 @@ void CDECL wined3d_device_restore_fullscreen_window(struct wined3d_device *devic
|
||||
SetWindowLongW(window, GWL_STYLE, device->style);
|
||||
SetWindowLongW(window, GWL_EXSTYLE, device->exStyle);
|
||||
}
|
||||
SetWindowPos(window, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
|
||||
|
||||
if (window_rect)
|
||||
rect = *window_rect;
|
||||
else
|
||||
window_pos_flags |= (SWP_NOMOVE | SWP_NOSIZE);
|
||||
SetWindowPos(window, 0, rect.left, rect.top, rect.right, rect.bottom, window_pos_flags);
|
||||
|
||||
device->filter_messages = filter_messages;
|
||||
|
||||
|
@ -77,6 +77,13 @@ static void swapchain_cleanup(struct wined3d_swapchain *swapchain)
|
||||
if (FAILED(hr = wined3d_set_adapter_display_mode(swapchain->device->wined3d,
|
||||
swapchain->device->adapter->ordinal, &swapchain->original_mode)))
|
||||
ERR("Failed to restore display mode, hr %#x.\n", hr);
|
||||
|
||||
if (swapchain->desc.flags & WINED3D_SWAPCHAIN_RESTORE_WINDOW_RECT)
|
||||
{
|
||||
wined3d_device_restore_fullscreen_window(swapchain->device, swapchain->device_window,
|
||||
&swapchain->original_window_rect);
|
||||
wined3d_device_release_focus_window(swapchain->device);
|
||||
}
|
||||
}
|
||||
|
||||
if (swapchain->backup_dc)
|
||||
@ -839,6 +846,7 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3
|
||||
ERR("Failed to get current display mode, hr %#x.\n", hr);
|
||||
goto err;
|
||||
}
|
||||
GetWindowRect(window, &swapchain->original_window_rect);
|
||||
|
||||
GetClientRect(window, &client_rect);
|
||||
if (desc->windowed)
|
||||
@ -1472,8 +1480,11 @@ HRESULT CDECL wined3d_swapchain_set_fullscreen(struct wined3d_swapchain *swapcha
|
||||
}
|
||||
else if (!swapchain->desc.windowed)
|
||||
{
|
||||
RECT *window_rect = NULL;
|
||||
/* Fullscreen -> windowed switch */
|
||||
wined3d_device_restore_fullscreen_window(device, swapchain->device_window);
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@
|
||||
@ cdecl wined3d_device_process_vertices(ptr long long long ptr ptr long long)
|
||||
@ cdecl wined3d_device_release_focus_window(ptr)
|
||||
@ cdecl wined3d_device_reset(ptr ptr ptr ptr long)
|
||||
@ cdecl wined3d_device_restore_fullscreen_window(ptr ptr)
|
||||
@ cdecl wined3d_device_restore_fullscreen_window(ptr ptr ptr)
|
||||
@ cdecl wined3d_device_set_base_vertex_index(ptr long)
|
||||
@ cdecl wined3d_device_set_clip_plane(ptr long ptr)
|
||||
@ cdecl wined3d_device_set_clip_status(ptr ptr)
|
||||
|
@ -3228,6 +3228,7 @@ struct wined3d_swapchain
|
||||
struct wined3d_texture *front_buffer;
|
||||
struct wined3d_swapchain_desc desc;
|
||||
struct wined3d_display_mode original_mode, d3d_mode;
|
||||
RECT original_window_rect;
|
||||
struct wined3d_gamma_ramp orig_gamma;
|
||||
BOOL render_to_fbo, reapply_mode;
|
||||
const struct wined3d_format *ds_format;
|
||||
|
@ -825,6 +825,7 @@ enum wined3d_display_rotation
|
||||
#define WINED3D_SWAPCHAIN_NOAUTOROTATE 0x00000020u
|
||||
#define WINED3D_SWAPCHAIN_UNPRUNEDMODE 0x00000040u
|
||||
#define WINED3D_SWAPCHAIN_ALLOW_MODE_SWITCH 0x00001000u
|
||||
#define WINED3D_SWAPCHAIN_RESTORE_WINDOW_RECT 0x00002000u
|
||||
|
||||
#define WINED3DDP_MAXTEXCOORD 8
|
||||
|
||||
@ -2252,7 +2253,8 @@ void __cdecl wined3d_device_release_focus_window(struct wined3d_device *device);
|
||||
HRESULT __cdecl wined3d_device_reset(struct wined3d_device *device,
|
||||
const struct wined3d_swapchain_desc *swapchain_desc, const struct wined3d_display_mode *mode,
|
||||
wined3d_device_reset_cb callback, BOOL reset_state);
|
||||
void __cdecl wined3d_device_restore_fullscreen_window(struct wined3d_device *device, HWND window);
|
||||
void __cdecl wined3d_device_restore_fullscreen_window(struct wined3d_device *device, HWND window,
|
||||
const RECT *window_rect);
|
||||
void __cdecl wined3d_device_set_base_vertex_index(struct wined3d_device *device, INT base_index);
|
||||
HRESULT __cdecl wined3d_device_set_clip_plane(struct wined3d_device *device,
|
||||
UINT plane_idx, const struct wined3d_vec4 *plane);
|
||||
|
Loading…
Reference in New Issue
Block a user