diff --git a/src/wsi/win32/wsi_platform_win32.h b/src/wsi/win32/wsi_platform_win32.h index 2a47e4f2f..3fdbba019 100644 --- a/src/wsi/win32/wsi_platform_win32.h +++ b/src/wsi/win32/wsi_platform_win32.h @@ -7,6 +7,9 @@ namespace dxvk::wsi { class Win32WsiDriver : public WsiDriver { + private: + uint64_t m_lastForegroundTimestamp = 0; + public: // Platform virtual std::vector getInstanceExtensions(); diff --git a/src/wsi/win32/wsi_window_win32.cpp b/src/wsi/win32/wsi_window_win32.cpp index 4deb039ef..b30608a2d 100644 --- a/src/wsi/win32/wsi_window_win32.cpp +++ b/src/wsi/win32/wsi_window_win32.cpp @@ -193,6 +193,7 @@ namespace dxvk::wsi { rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_FRAMECHANGED | SWP_SHOWWINDOW | SWP_NOACTIVATE); + m_lastForegroundTimestamp = 0; return true; } @@ -260,7 +261,12 @@ namespace dxvk::wsi { bool Win32WsiDriver::isOccluded(HWND hWindow) { - return ::GetForegroundWindow() != hWindow; + if (::GetForegroundWindow() == hWindow) + { + m_lastForegroundTimestamp = GetTickCount64(); + return false; + } + return m_lastForegroundTimestamp && GetTickCount64() - m_lastForegroundTimestamp > 100; }