mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 05:47:56 -07:00
Added the ability to pause the emulator by moving the mouse outside the window.
This commit is contained in:
parent
7cda374910
commit
341e7e9d8f
@ -242,6 +242,7 @@ void SConfig::SaveInterfaceSettings(IniFile& ini)
|
||||
interface->Set("ShowLogConfigWindow", m_InterfaceLogConfigWindow);
|
||||
interface->Set("ExtendedFPSInfo", m_InterfaceExtendedFPSInfo);
|
||||
interface->Set("ThemeName40", m_LocalCoreStartupParameter.theme_name);
|
||||
interface->Set("PauseOnFocusLost", m_PauseOnFocusLost);
|
||||
}
|
||||
|
||||
void SConfig::SaveHotkeySettings(IniFile& ini)
|
||||
@ -464,6 +465,7 @@ void SConfig::LoadInterfaceSettings(IniFile& ini)
|
||||
interface->Get("ShowLogConfigWindow", &m_InterfaceLogConfigWindow, false);
|
||||
interface->Get("ExtendedFPSInfo", &m_InterfaceExtendedFPSInfo, false);
|
||||
interface->Get("ThemeName40", &m_LocalCoreStartupParameter.theme_name, "Clean");
|
||||
interface->Get("PauseOnFocusLost", &m_PauseOnFocusLost, false);
|
||||
}
|
||||
|
||||
void SConfig::LoadHotkeySettings(IniFile& ini)
|
||||
|
@ -103,6 +103,8 @@ struct SConfig : NonCopyable
|
||||
bool m_DumpFramesSilent;
|
||||
bool m_ShowInputDisplay;
|
||||
|
||||
bool m_PauseOnFocusLost;
|
||||
|
||||
// DSP settings
|
||||
bool m_DSPEnableJIT;
|
||||
bool m_DSPCaptureLog;
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -1073,13 +1073,15 @@ void CFrame::StartGame(const std::string& filename)
|
||||
|
||||
m_RenderParent->SetFocus();
|
||||
|
||||
wxTheApp->Bind(wxEVT_KEY_DOWN, &CFrame::OnKeyDown, this);
|
||||
wxTheApp->Bind(wxEVT_KEY_UP, &CFrame::OnKeyUp, this);
|
||||
wxTheApp->Bind(wxEVT_RIGHT_DOWN, &CFrame::OnMouse, this);
|
||||
wxTheApp->Bind(wxEVT_RIGHT_UP, &CFrame::OnMouse, this);
|
||||
wxTheApp->Bind(wxEVT_MIDDLE_DOWN, &CFrame::OnMouse, this);
|
||||
wxTheApp->Bind(wxEVT_MIDDLE_UP, &CFrame::OnMouse, this);
|
||||
wxTheApp->Bind(wxEVT_MOTION, &CFrame::OnMouse, this);
|
||||
wxTheApp->Bind(wxEVT_KEY_DOWN, &CFrame::OnKeyDown, this);
|
||||
wxTheApp->Bind(wxEVT_KEY_UP, &CFrame::OnKeyUp, this);
|
||||
wxTheApp->Bind(wxEVT_RIGHT_DOWN, &CFrame::OnMouse, this);
|
||||
wxTheApp->Bind(wxEVT_RIGHT_UP, &CFrame::OnMouse, this);
|
||||
wxTheApp->Bind(wxEVT_MIDDLE_DOWN, &CFrame::OnMouse, this);
|
||||
wxTheApp->Bind(wxEVT_MIDDLE_UP, &CFrame::OnMouse, this);
|
||||
wxTheApp->Bind(wxEVT_MOTION, &CFrame::OnMouse, this);
|
||||
wxTheApp->Bind(wxEVT_ENTER_WINDOW, &CFrame::OnMouse, this);
|
||||
wxTheApp->Bind(wxEVT_LEAVE_WINDOW, &CFrame::OnMouse, this);
|
||||
m_RenderParent->Bind(wxEVT_SIZE, &CFrame::OnRenderParentResize, this);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user