Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.

Commit 39e4a83

Browse files
committed
Merge branch 'dev/lvengesanam/refactor_swapChain_window_changes' into 'main'
Refactor bridge code with respect to latest DXVK changes See merge request lightspeedrtx/bridge-remix-nv!140
2 parents 5e27290 + 6fcda93 commit 39e4a83

File tree

2 files changed

+5
-22
lines changed

2 files changed

+5
-22
lines changed

src/client/d3d9_swapchain.cpp

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -95,26 +95,6 @@ HRESULT Direct3DSwapChain9_LSS::reset(const D3DPRESENT_PARAMETERS &pPresentParam
9595

9696
m_monitor = nullptr;
9797
}
98-
if (modifyWindow && (
99-
pPresentParams.BackBufferWidth != prevPresentParams.BackBufferWidth ||
100-
pPresentParams.BackBufferHeight != prevPresentParams.BackBufferHeight)) {
101-
102-
// Adjust window position and size
103-
RECT newRect = { 0, 0, 0, 0 };
104-
RECT oldRect = { 0, 0, 0, 0 };
105-
::GetWindowRect(m_window, &oldRect);
106-
::MapWindowPoints(HWND_DESKTOP, ::GetParent(m_window), reinterpret_cast<POINT*>(&oldRect), 1);
107-
::SetRect(&newRect, 0, 0, pPresentParams.BackBufferWidth, pPresentParams.BackBufferHeight);
108-
::AdjustWindowRectEx(&newRect,
109-
::GetWindowLongW(m_window, GWL_STYLE), FALSE,
110-
::GetWindowLongW(m_window, GWL_EXSTYLE));
111-
::SetRect(&newRect, 0, 0, newRect.right - newRect.left, newRect.bottom - newRect.top);
112-
::OffsetRect(&newRect, oldRect.left, oldRect.top);
113-
// Should use SetWindowPos rather than MoveWindow to avoid cross process deadlock
114-
::SetWindowPos(m_window, nullptr, newRect.left, newRect.top,
115-
newRect.right - newRect.left, newRect.bottom - newRect.top, SWP_NOACTIVATE | SWP_NOZORDER | SWP_ASYNCWINDOWPOS);
116-
Logger::info(format_string("Window's position is reset with change in backbuffer metrics. PreviousBackBufferWidth: %d, PreviousBackBufferHeight: %d, CurrentBackBufferWidth: %d, CurrentBackBufferHeight: %d", prevPresentParams.BackBufferWidth, prevPresentParams.BackBufferHeight, pPresentParams.BackBufferWidth, pPresentParams.BackBufferHeight));
117-
}
11898
}
11999
else {
120100
if (modifyWindow) {

src/client/window.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ namespace {
4747

4848
HWND g_hwnd = nullptr;
4949
WNDPROC g_gameWndProc = nullptr;
50+
bool g_bActivateProcessed = false;
5051

5152
// reinterpret_cast wrappers
5253
template<typename T>
@@ -164,15 +165,17 @@ void windowMsg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) {
164165
if (msg == WM_ACTIVATEAPP && !presParams.Windowed && !(msg == WM_NCCALCSIZE && wParam == TRUE)) {
165166
D3DDEVICE_CREATION_PARAMETERS create_parms = data.createParam;
166167
if (!(create_parms.BehaviorFlags & D3DCREATE_NOWINDOWCHANGES)) {
167-
if (wParam) {
168+
if (wParam && !g_bActivateProcessed) {
168169
RECT rect;
169170
GetMonitorRect(GetDefaultMonitor(), &rect);
170171
SetWindowPos(hWnd, HWND_TOP, rect.left, rect.top, presParams.BackBufferWidth, presParams.BackBufferHeight,
171172
SWP_NOACTIVATE | SWP_NOZORDER | SWP_ASYNCWINDOWPOS);
172173
Logger::info(format_string("Window's position is reset. Left: %d, Top: %d, Width: %d, Height: %d", rect.left, rect.top, presParams.BackBufferWidth, presParams.BackBufferHeight));
173-
} else {
174+
g_bActivateProcessed = true;
175+
} else if (!wParam) {
174176
if (IsWindowVisible(hWnd))
175177
ShowWindowAsync(hWnd, SW_MINIMIZE);
178+
g_bActivateProcessed = false;
176179
}
177180
}
178181
} else if (msg == WM_SIZE) {

0 commit comments

Comments
 (0)