D3D: Move exclusive mode switching to UI thread.

This prevents deadlocks when switching to exclusive mode.
And it also allows the CPU thread to block until we've completed the switch.
This commit is contained in:
Jules Blok
2016-11-09 01:07:56 +01:00
parent f0ce3275af
commit c21efa0cad
6 changed files with 28 additions and 68 deletions

View File

@ -1131,28 +1131,12 @@ void CFrame::OnMouse(wxMouseEvent& event)
void CFrame::DoFullscreen(bool enable_fullscreen)
{
if (g_Config.bExclusiveMode && Core::GetState() == Core::CORE_PAUSE)
{
// A responsive renderer is required for exclusive fullscreen, but the
// renderer can only respond in the running state. Therefore we ignore
// fullscreen switches if we are in exclusive fullscreen, but the
// renderer is not running.
// TODO: Allow the renderer to switch fullscreen modes while paused.
return;
}
ToggleDisplayMode(enable_fullscreen);
if (enable_fullscreen)
{
m_RenderFrame->ShowFullScreen(true, wxFULLSCREEN_ALL);
}
else if (!g_Config.bExclusiveMode)
{
// Exiting exclusive fullscreen should be done from a Renderer callback.
// Therefore we don't exit fullscreen from here if we are in exclusive mode.
m_RenderFrame->ShowFullScreen(false, wxFULLSCREEN_ALL);
}
if (!enable_fullscreen && g_renderer)
g_renderer->SetFullscreen(false);
m_RenderFrame->ShowFullScreen(enable_fullscreen, wxFULLSCREEN_ALL);
if (SConfig::GetInstance().bRenderToMain)
{
@ -1200,9 +1184,10 @@ void CFrame::DoFullscreen(bool enable_fullscreen)
else
{
m_RenderFrame->Raise();
}
g_Config.bFullscreen = enable_fullscreen;
if (enable_fullscreen && g_renderer)
g_renderer->SetFullscreen(true);
}
}
const CGameListCtrl* CFrame::GetGameListCtrl() const

View File

@ -787,12 +787,6 @@ void CFrame::DoStop()
// waiting on inputs
bool should_pause = !NetPlayDialog::GetNetPlayClient();
// If exclusive fullscreen is not enabled then we can pause the emulation
// before we've exited fullscreen. If not then we need to exit fullscreen first.
should_pause =
should_pause && (!RendererIsFullscreen() || !g_Config.ExclusiveFullscreenEnabled() ||
SConfig::GetInstance().bRenderToMain);
if (should_pause)
{
Core::SetState(Core::CORE_PAUSE);

View File

@ -292,7 +292,6 @@ enum
IDM_WINDOW_SIZE_REQUEST,
IDM_STOPPED,
IDM_HOST_MESSAGE,
IDM_FULLSCREEN_REQUEST,
// Used for Host_ConnectWiimote()
IDM_FORCE_CONNECT_WIIMOTE1,