[PATCH 03/11] wined3d: Add WINED3DSWAPCHAIN_RESTORE_WINDOW_RECT flag.
Józef Kucia
jkucia at codeweavers.com
Mon Aug 1 15:28:37 CDT 2016
Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
dlls/ddraw/ddraw.c | 2 +-
dlls/dxgi/utils.c | 4 +++-
dlls/wined3d/device.c | 15 ++++++++++++---
dlls/wined3d/swapchain.c | 6 +++++-
dlls/wined3d/wined3d.spec | 2 +-
dlls/wined3d/wined3d_private.h | 1 +
include/wine/wined3d.h | 4 +++-
7 files changed, 26 insertions(+), 8 deletions(-)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index fadf856..3eaabe3 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -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)
{
diff --git a/dlls/dxgi/utils.c b/dlls/dxgi/utils.c
index 1273832..9a007d1 100644
--- a/dlls/dxgi/utils.c
+++ b/dlls/dxgi/utils.c
@@ -405,6 +405,8 @@ unsigned int dxgi_swapchain_flags_from_wined3d(unsigned int wined3d_flags)
{
unsigned int flags = 0;
+ wined3d_flags &= ~WINED3DSWAPCHAIN_RESTORE_WINDOW_RECT;
+
if (wined3d_flags & WINED3DSWAPCHAIN_ALLOW_MODE_SWITCH)
{
wined3d_flags &= ~WINED3DSWAPCHAIN_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; /* WINED3DSWAPCHAIN_DISCARD_DEPTHSTENCIL? */
+ unsigned int wined3d_flags = WINED3DSWAPCHAIN_RESTORE_WINDOW_RECT; /* WINED3DSWAPCHAIN_DISCARD_DEPTHSTENCIL? */
if (flags & DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH)
{
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index c3697d3..81f3a77 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -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;
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index e7fd25f..1c99bed 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -839,6 +839,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 +1473,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 & WINED3DSWAPCHAIN_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);
}
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index bdf3916..e0cc501 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -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)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index e933909..d9b1b66 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3223,6 +3223,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;
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 0808f65..d135d3b 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -825,6 +825,7 @@ enum wined3d_display_rotation
#define WINED3DSWAPCHAIN_NOAUTOROTATE 0x00000020
#define WINED3DSWAPCHAIN_UNPRUNEDMODE 0x00000040
#define WINED3DSWAPCHAIN_ALLOW_MODE_SWITCH 0x00001000
+#define WINED3DSWAPCHAIN_RESTORE_WINDOW_RECT 0x00002000
#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);
--
2.7.3
More information about the wine-patches
mailing list