Added the ability to pause the emulator by moving the mouse outside the window.

This commit is contained in:
Gerik Kubiak
2015-03-16 20:28:17 -07:00
parent 7cda374910
commit 341e7e9d8f
4 changed files with 40 additions and 7 deletions

View File

@ -1121,6 +1121,33 @@ void CFrame::OnKeyUp(wxKeyEvent& event)
void CFrame::OnMouse(wxMouseEvent& event)
{
if (SConfig::GetInstance().m_PauseOnFocusLost &&
event.GetEventObject() == (wxObject*)m_RenderParent)
{
if (event.Leaving())
{
if (Core::GetState() == Core::CORE_RUN)
{
Core::SetState(Core::CORE_PAUSE);
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor)
m_RenderParent->SetCursor(wxNullCursor);
Core::UpdateTitle();
}
UpdateGUI();
}
else if (event.Entering())
{
if (Core::GetState() == Core::CORE_PAUSE)
{
Core::SetState(Core::CORE_RUN);
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor)
m_RenderParent->SetCursor(wxCURSOR_BLANK);
}
UpdateGUI();
}
}
// next handlers are all for FreeLook, so we don't need to check them if disabled
if (!g_Config.bFreeLook)
{