1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-05 01:24:14 +01:00

[d3d9] Do not set window size and position when restoring from fullscreen state

Closes #2920.
This commit is contained in:
Paul Gofman 2022-09-14 17:18:16 -05:00 committed by Joshie
parent 19b76825d0
commit 10d6e15646
5 changed files with 15 additions and 9 deletions

View File

@ -1055,7 +1055,7 @@ namespace dxvk {
ResetWindowProc(m_window);
if (!wsi::leaveFullscreenMode(m_window, &m_windowState)) {
if (!wsi::leaveFullscreenMode(m_window, &m_windowState, false)) {
Logger::err("D3D9: LeaveFullscreenMode: Failed to exit fullscreen mode");
return D3DERR_NOTAVAILABLE;
}

View File

@ -616,7 +616,7 @@ namespace dxvk {
if (!wsi::isWindow(m_window))
return S_OK;
if (!wsi::leaveFullscreenMode(m_window, &m_windowState)) {
if (!wsi::leaveFullscreenMode(m_window, &m_windowState, true)) {
Logger::err("DXGI: LeaveFullscreenMode: Failed to exit fullscreen mode");
return DXGI_ERROR_NOT_CURRENTLY_AVAILABLE;
}

View File

@ -101,7 +101,8 @@ namespace dxvk::wsi {
bool leaveFullscreenMode(
HWND hWindow,
DxvkWindowState* pState) {
DxvkWindowState* pState,
bool restoreCoordinates) {
SDL_Window* window = fromHwnd(hWindow);
if (SDL_SetWindowFullscreen(window, 0) != 0) {
@ -152,4 +153,4 @@ namespace dxvk::wsi {
: VK_ERROR_OUT_OF_HOST_MEMORY;
}
}
}

View File

@ -198,7 +198,8 @@ namespace dxvk::wsi {
bool leaveFullscreenMode(
HWND hWindow,
DxvkWindowState* pState) {
DxvkWindowState* pState,
bool restoreCoordinates) {
// Only restore the window style if the application hasn't
// changed them. This is in line with what native DXGI does.
LONG curStyle = ::GetWindowLongW(hWindow, GWL_STYLE) & ~WS_VISIBLE;
@ -211,11 +212,14 @@ namespace dxvk::wsi {
}
// Restore window position and apply the style
UINT flags = SWP_FRAMECHANGED | SWP_NOACTIVATE;
const RECT rect = pState->rect;
if (!restoreCoordinates)
flags |= SWP_NOSIZE | SWP_NOMOVE;
::SetWindowPos(hWindow, (pState->exstyle & WS_EX_TOPMOST) ? HWND_TOPMOST : HWND_NOTOPMOST,
rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top,
SWP_FRAMECHANGED | SWP_NOACTIVATE);
rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, flags);
return true;
}
@ -285,4 +289,4 @@ namespace dxvk::wsi {
vki->instance(), &info, nullptr, pSurface);
}
}
}

View File

@ -73,7 +73,8 @@ namespace dxvk::wsi {
*/
bool leaveFullscreenMode(
HWND hWindow,
DxvkWindowState* pState);
DxvkWindowState* pState,
bool restoreCoordinates);
/**
* \brief Restores the display mode if necessary