mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-26 15:49:50 -06:00
Added the ability to pause the emulator by moving the mouse outside the window.
This commit is contained in:
@ -242,6 +242,7 @@ void SConfig::SaveInterfaceSettings(IniFile& ini)
|
|||||||
interface->Set("ShowLogConfigWindow", m_InterfaceLogConfigWindow);
|
interface->Set("ShowLogConfigWindow", m_InterfaceLogConfigWindow);
|
||||||
interface->Set("ExtendedFPSInfo", m_InterfaceExtendedFPSInfo);
|
interface->Set("ExtendedFPSInfo", m_InterfaceExtendedFPSInfo);
|
||||||
interface->Set("ThemeName40", m_LocalCoreStartupParameter.theme_name);
|
interface->Set("ThemeName40", m_LocalCoreStartupParameter.theme_name);
|
||||||
|
interface->Set("PauseOnFocusLost", m_PauseOnFocusLost);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SConfig::SaveHotkeySettings(IniFile& ini)
|
void SConfig::SaveHotkeySettings(IniFile& ini)
|
||||||
@ -464,6 +465,7 @@ void SConfig::LoadInterfaceSettings(IniFile& ini)
|
|||||||
interface->Get("ShowLogConfigWindow", &m_InterfaceLogConfigWindow, false);
|
interface->Get("ShowLogConfigWindow", &m_InterfaceLogConfigWindow, false);
|
||||||
interface->Get("ExtendedFPSInfo", &m_InterfaceExtendedFPSInfo, false);
|
interface->Get("ExtendedFPSInfo", &m_InterfaceExtendedFPSInfo, false);
|
||||||
interface->Get("ThemeName40", &m_LocalCoreStartupParameter.theme_name, "Clean");
|
interface->Get("ThemeName40", &m_LocalCoreStartupParameter.theme_name, "Clean");
|
||||||
|
interface->Get("PauseOnFocusLost", &m_PauseOnFocusLost, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SConfig::LoadHotkeySettings(IniFile& ini)
|
void SConfig::LoadHotkeySettings(IniFile& ini)
|
||||||
|
@ -103,6 +103,8 @@ struct SConfig : NonCopyable
|
|||||||
bool m_DumpFramesSilent;
|
bool m_DumpFramesSilent;
|
||||||
bool m_ShowInputDisplay;
|
bool m_ShowInputDisplay;
|
||||||
|
|
||||||
|
bool m_PauseOnFocusLost;
|
||||||
|
|
||||||
// DSP settings
|
// DSP settings
|
||||||
bool m_DSPEnableJIT;
|
bool m_DSPEnableJIT;
|
||||||
bool m_DSPCaptureLog;
|
bool m_DSPCaptureLog;
|
||||||
|
@ -1121,6 +1121,33 @@ void CFrame::OnKeyUp(wxKeyEvent& event)
|
|||||||
|
|
||||||
void CFrame::OnMouse(wxMouseEvent& 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
|
// next handlers are all for FreeLook, so we don't need to check them if disabled
|
||||||
if (!g_Config.bFreeLook)
|
if (!g_Config.bFreeLook)
|
||||||
{
|
{
|
||||||
|
@ -1073,13 +1073,15 @@ void CFrame::StartGame(const std::string& filename)
|
|||||||
|
|
||||||
m_RenderParent->SetFocus();
|
m_RenderParent->SetFocus();
|
||||||
|
|
||||||
wxTheApp->Bind(wxEVT_KEY_DOWN, &CFrame::OnKeyDown, this);
|
wxTheApp->Bind(wxEVT_KEY_DOWN, &CFrame::OnKeyDown, this);
|
||||||
wxTheApp->Bind(wxEVT_KEY_UP, &CFrame::OnKeyUp, this);
|
wxTheApp->Bind(wxEVT_KEY_UP, &CFrame::OnKeyUp, this);
|
||||||
wxTheApp->Bind(wxEVT_RIGHT_DOWN, &CFrame::OnMouse, this);
|
wxTheApp->Bind(wxEVT_RIGHT_DOWN, &CFrame::OnMouse, this);
|
||||||
wxTheApp->Bind(wxEVT_RIGHT_UP, &CFrame::OnMouse, this);
|
wxTheApp->Bind(wxEVT_RIGHT_UP, &CFrame::OnMouse, this);
|
||||||
wxTheApp->Bind(wxEVT_MIDDLE_DOWN, &CFrame::OnMouse, this);
|
wxTheApp->Bind(wxEVT_MIDDLE_DOWN, &CFrame::OnMouse, this);
|
||||||
wxTheApp->Bind(wxEVT_MIDDLE_UP, &CFrame::OnMouse, this);
|
wxTheApp->Bind(wxEVT_MIDDLE_UP, &CFrame::OnMouse, this);
|
||||||
wxTheApp->Bind(wxEVT_MOTION, &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);
|
m_RenderParent->Bind(wxEVT_SIZE, &CFrame::OnRenderParentResize, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user