mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-13 19:29:14 +01:00
d3d9: Send necessary messages for full-screen windows during WM_ACTIVATEAPP.
This commit is contained in:
parent
dde28a967f
commit
83f6400a07
@ -14,6 +14,7 @@ namespace dxvk {
|
||||
bool unicode;
|
||||
bool filter;
|
||||
WNDPROC proc;
|
||||
D3D9SwapChainEx* swapchain;
|
||||
};
|
||||
|
||||
|
||||
@ -82,7 +83,7 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
void HookWindowProc(HWND window) {
|
||||
void HookWindowProc(HWND window, D3D9SwapChainEx* swapchain) {
|
||||
std::lock_guard lock(g_windowProcMapMutex);
|
||||
|
||||
ResetWindowProc(window);
|
||||
@ -94,6 +95,7 @@ namespace dxvk {
|
||||
CallCharsetFunction(
|
||||
SetWindowLongPtrW, SetWindowLongPtrA, windowData.unicode,
|
||||
window, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(D3D9WindowProc)));
|
||||
windowData.swapchain = swapchain;
|
||||
|
||||
g_windowProcMap[window] = std::move(windowData);
|
||||
}
|
||||
@ -124,6 +126,27 @@ namespace dxvk {
|
||||
|
||||
if (message == WM_DESTROY)
|
||||
ResetWindowProc(window);
|
||||
else if (message == WM_ACTIVATEAPP) {
|
||||
D3DDEVICE_CREATION_PARAMETERS create_parms;
|
||||
windowData.swapchain->GetDevice()->GetCreationParameters(&create_parms);
|
||||
|
||||
if (!(create_parms.BehaviorFlags & D3DCREATE_NOWINDOWCHANGES)) {
|
||||
if (wparam) {
|
||||
// Heroes of Might and Magic V needs this to resume drawing after a focus loss
|
||||
D3DPRESENT_PARAMETERS params;
|
||||
RECT rect;
|
||||
|
||||
GetMonitorRect(GetDefaultMonitor(), &rect);
|
||||
windowData.swapchain->GetPresentParameters(¶ms);
|
||||
SetWindowPos(window, nullptr, rect.left, rect.top, params.BackBufferWidth, params.BackBufferHeight,
|
||||
SWP_NOACTIVATE | SWP_NOZORDER);
|
||||
}
|
||||
else {
|
||||
if (IsWindowVisible(window))
|
||||
ShowWindow(window, SW_MINIMIZE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return CallCharsetFunction(
|
||||
CallWindowProcW, CallWindowProcA, unicode,
|
||||
@ -1398,7 +1421,7 @@ namespace dxvk {
|
||||
// Some games restore window styles after we have changed it, so hooking is
|
||||
// also required. Doing it will allow us to create fullscreen windows
|
||||
// regardless of their style and it also appears to work on Windows.
|
||||
HookWindowProc(m_window);
|
||||
HookWindowProc(m_window, this);
|
||||
|
||||
D3D9WindowMessageFilter filter(m_window);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user