From: Rémi Bernon rbernon@codeweavers.com
And unset it when exiting fullscreen.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=58844 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=58443 --- dlls/wined3d/device.c | 16 ++++++++++++++++ dlls/wined3d/swapchain.c | 20 ++++++++++++++++++++ 2 files changed, 36 insertions(+)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 443bf10ab76..fb515e8c3be 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -4979,6 +4979,19 @@ static void update_swapchain_flags(struct wined3d_texture *texture) texture->flags &= ~WINED3D_TEXTURE_GET_DC; }
+static BOOL set_window_present_rect(HWND hwnd, UINT x, UINT y, UINT width, UINT height) +{ + RECT rect = {x, y, x + width, y + height}; + D3DKMT_ESCAPE escape = {0}; + + escape.Type = D3DKMT_ESCAPE_SET_PRESENT_RECT_WINE; + escape.hContext = HandleToULong(hwnd); + escape.pPrivateDriverData = ▭ + escape.PrivateDriverDataSize = sizeof(rect); + + return !D3DKMTEscape(&escape); +} + 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) @@ -5135,6 +5148,9 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
swapchain_state->style = 0; swapchain_state->exstyle = 0; + set_window_present_rect(swapchain_state->device_window, output_desc.desktop_rect.left, + output_desc.desktop_rect.top, swapchain_desc->backbuffer_width, + swapchain_desc->backbuffer_height); wined3d_swapchain_state_setup_fullscreen(swapchain_state, swapchain_state->device_window, output_desc.desktop_rect.left, output_desc.desktop_rect.top, swapchain_desc->backbuffer_width, swapchain_desc->backbuffer_height); diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index a1000ec2393..d1f835fa809 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -27,6 +27,19 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d); WINE_DECLARE_DEBUG_CHANNEL(d3d_perf);
+static BOOL set_window_present_rect(HWND hwnd, UINT x, UINT y, UINT width, UINT height) +{ + RECT rect = {x, y, x + width, y + height}; + D3DKMT_ESCAPE escape = {0}; + + escape.Type = D3DKMT_ESCAPE_SET_PRESENT_RECT_WINE; + escape.hContext = HandleToULong(hwnd); + escape.pPrivateDriverData = ▭ + escape.PrivateDriverDataSize = sizeof(rect); + + return !D3DKMTEscape(&escape); +} + void wined3d_swapchain_cleanup(struct wined3d_swapchain *swapchain) { HRESULT hr; @@ -78,12 +91,14 @@ void wined3d_swapchain_cleanup(struct wined3d_swapchain *swapchain) { wined3d_swapchain_state_restore_from_fullscreen(&swapchain->state, swapchain->state.device_window, &swapchain->state.original_window_rect); + set_window_present_rect(swapchain->state.device_window, 0, 0, 0, 0); wined3d_device_release_focus_window(swapchain->device); } } else { wined3d_swapchain_state_restore_from_fullscreen(&swapchain->state, swapchain->state.device_window, NULL); + set_window_present_rect(swapchain->state.device_window, 0, 0, 0, 0); } } } @@ -1559,6 +1574,8 @@ static HRESULT wined3d_swapchain_init(struct wined3d_swapchain *swapchain, struc goto err; }
+ set_window_present_rect(window, output_desc.desktop_rect.left, output_desc.desktop_rect.top, + desc->backbuffer_width, desc->backbuffer_height); wined3d_swapchain_state_setup_fullscreen(&swapchain->state, window, output_desc.desktop_rect.left, output_desc.desktop_rect.top, desc->backbuffer_width, desc->backbuffer_height); @@ -2432,6 +2449,8 @@ HRESULT CDECL wined3d_swapchain_state_set_fullscreen(struct wined3d_swapchain_st return hr; }
+ set_window_present_rect(state->device_window, output_desc.desktop_rect.left, + output_desc.desktop_rect.top, width, height); if (state->desc.windowed) { /* Switch from windowed to fullscreen */ @@ -2460,6 +2479,7 @@ HRESULT CDECL wined3d_swapchain_state_set_fullscreen(struct wined3d_swapchain_st if (state->desc.flags & WINED3D_SWAPCHAIN_RESTORE_WINDOW_RECT) window_rect = &state->original_window_rect; wined3d_swapchain_state_restore_from_fullscreen(state, state->device_window, window_rect); + set_window_present_rect(state->device_window, 0, 0, 0, 0); }
state->desc.output = swapchain_desc->output;