Qt: Pause on focus loss

This commit is contained in:
spycrab 2018-04-20 21:46:42 +02:00
parent c131b7c3b4
commit b059b3a646
1 changed files with 4 additions and 0 deletions

View File

@ -116,9 +116,13 @@ bool RenderWidget::event(QEvent* event)
break;
case QEvent::WindowActivate:
Host::GetInstance()->SetRenderFocus(true);
if (SConfig::GetInstance().m_PauseOnFocusLost && Core::GetState() == Core::State::Paused)
Core::SetState(Core::State::Running);
break;
case QEvent::WindowDeactivate:
Host::GetInstance()->SetRenderFocus(false);
if (SConfig::GetInstance().m_PauseOnFocusLost && Core::GetState() == Core::State::Running)
Core::SetState(Core::State::Paused);
break;
case QEvent::Resize:
{