mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-19 14:52:10 +01:00
[dxgi] Delay qualifying foreground loss as occlusion
This commit is contained in:
parent
4ed50ec6be
commit
a172cab34f
@ -7,6 +7,9 @@
|
|||||||
namespace dxvk::wsi {
|
namespace dxvk::wsi {
|
||||||
|
|
||||||
class Win32WsiDriver : public WsiDriver {
|
class Win32WsiDriver : public WsiDriver {
|
||||||
|
private:
|
||||||
|
uint64_t m_lastForegroundTimestamp = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Platform
|
// Platform
|
||||||
virtual std::vector<const char *> getInstanceExtensions();
|
virtual std::vector<const char *> getInstanceExtensions();
|
||||||
|
@ -193,6 +193,7 @@ namespace dxvk::wsi {
|
|||||||
rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top,
|
rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top,
|
||||||
SWP_FRAMECHANGED | SWP_SHOWWINDOW | SWP_NOACTIVATE);
|
SWP_FRAMECHANGED | SWP_SHOWWINDOW | SWP_NOACTIVATE);
|
||||||
|
|
||||||
|
m_lastForegroundTimestamp = 0;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,7 +261,12 @@ namespace dxvk::wsi {
|
|||||||
|
|
||||||
|
|
||||||
bool Win32WsiDriver::isOccluded(HWND hWindow) {
|
bool Win32WsiDriver::isOccluded(HWND hWindow) {
|
||||||
return ::GetForegroundWindow() != hWindow;
|
if (::GetForegroundWindow() == hWindow)
|
||||||
|
{
|
||||||
|
m_lastForegroundTimestamp = GetTickCount64();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return m_lastForegroundTimestamp && GetTickCount64() - m_lastForegroundTimestamp > 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user