Frame: Move exclusive mode switching to helper function.

This commit is contained in:
Jules Blok 2016-11-11 21:24:08 +01:00
parent aab6b70868
commit aa0e4472c0
2 changed files with 16 additions and 21 deletions

View File

@ -521,15 +521,7 @@ void CFrame::OnActive(wxActivateEvent& event)
if (SConfig::GetInstance().bRenderToMain)
m_RenderParent->SetFocus();
else if (RendererIsFullscreen() && g_ActiveConfig.ExclusiveFullscreenEnabled())
{
// Regain exclusive mode if it was lost due to a focus change.
if (g_renderer && !g_renderer->IsFullscreen())
{
bool was_unpaused = Core::PauseAndLock(true);
g_renderer->SetFullscreen(true);
Core::PauseAndLock(false, was_unpaused);
}
}
DoExclusiveFullscreen(true); // Regain exclusive mode
if (SConfig::GetInstance().m_PauseOnFocusLost && Core::GetState() == Core::CORE_PAUSE)
DoPause();
@ -1170,22 +1162,14 @@ void CFrame::DoFullscreen(bool enable_fullscreen)
}
else if (g_ActiveConfig.ExclusiveFullscreenEnabled())
{
if (g_renderer && !enable_fullscreen)
{
bool was_unpaused = Core::PauseAndLock(true);
g_renderer->SetFullscreen(false);
Core::PauseAndLock(false, was_unpaused);
}
if (!enable_fullscreen)
DoExclusiveFullscreen(false);
m_RenderFrame->ShowFullScreen(enable_fullscreen, wxFULLSCREEN_ALL);
m_RenderFrame->Raise();
if (g_renderer && enable_fullscreen)
{
bool was_unpaused = Core::PauseAndLock(true);
g_renderer->SetFullscreen(true);
Core::PauseAndLock(false, was_unpaused);
}
if (enable_fullscreen)
DoExclusiveFullscreen(true);
}
else
{
@ -1194,6 +1178,16 @@ void CFrame::DoFullscreen(bool enable_fullscreen)
}
}
void CFrame::DoExclusiveFullscreen(bool enable_fullscreen)
{
if (g_renderer && g_renderer->IsFullscreen() != enable_fullscreen)
{
bool was_unpaused = Core::PauseAndLock(true);
g_renderer->SetFullscreen(enable_fullscreen);
Core::PauseAndLock(false, was_unpaused);
}
}
const CGameListCtrl* CFrame::GetGameListCtrl() const
{
return m_GameListCtrl;

View File

@ -106,6 +106,7 @@ public:
bool RendererHasFocus();
bool RendererIsFullscreen();
void DoFullscreen(bool bF);
void DoExclusiveFullscreen(bool bF);
void ToggleDisplayMode(bool bFullscreen);
static void ConnectWiimote(int wm_idx, bool connect);
void UpdateTitle(const std::string& str);