Merge pull request #2224 from gerikkub/AutoFocus

Pause the emulator based on mouse focus
This commit is contained in:
skidau
2015-03-19 12:48:03 +11:00
7 changed files with 52 additions and 7 deletions

View File

@ -1176,6 +1176,33 @@ void CFrame::OnMouse(wxMouseEvent& event)
event.Skip();
}
void CFrame::OnFocusChange(wxFocusEvent& event)
{
if (SConfig::GetInstance().m_PauseOnFocusLost)
{
if (RendererHasFocus())
{
if (Core::GetState() == Core::CORE_PAUSE)
{
Core::SetState(Core::CORE_RUN);
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor)
m_RenderParent->SetCursor(wxCURSOR_BLANK);
}
}
else
{
if (Core::GetState() == Core::CORE_RUN)
{
Core::SetState(Core::CORE_PAUSE);
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor)
m_RenderParent->SetCursor(wxNullCursor);
Core::UpdateTitle();
}
}
UpdateGUI();
}
}
void CFrame::DoFullscreen(bool enable_fullscreen)
{
if (g_Config.bExclusiveMode && Core::GetState() == Core::CORE_PAUSE)