Exit exclusive fullscreen when the stop confirmation is shown.
Also have the renderer remember its own fullscreen state. This is done to prevent a case where we exit exclusive fullscreen through the configuration and a focus shift at the same time. In this case the renderer would fail to detect that the fullscreen state was changed.
This commit is contained in:
parent
36ea1890c8
commit
009b4dd376
|
@ -316,7 +316,7 @@ CFrame::CFrame(wxFrame* parent,
|
||||||
, m_LogWindow(nullptr), m_LogConfigWindow(nullptr)
|
, m_LogWindow(nullptr), m_LogConfigWindow(nullptr)
|
||||||
, m_FifoPlayerDlg(nullptr), UseDebugger(_UseDebugger)
|
, m_FifoPlayerDlg(nullptr), UseDebugger(_UseDebugger)
|
||||||
, m_bBatchMode(_BatchMode), m_bEdit(false), m_bTabSplit(false), m_bNoDocking(false)
|
, m_bBatchMode(_BatchMode), m_bEdit(false), m_bTabSplit(false), m_bNoDocking(false)
|
||||||
, m_bGameLoading(false), m_bClosing(false)
|
, m_bGameLoading(false), m_bClosing(false), m_confirmStop(false)
|
||||||
{
|
{
|
||||||
for (int i = 0; i <= IDM_CODEWINDOW - IDM_LOGWINDOW; i++)
|
for (int i = 0; i <= IDM_CODEWINDOW - IDM_LOGWINDOW; i++)
|
||||||
bFloatWindow[i] = false;
|
bFloatWindow[i] = false;
|
||||||
|
@ -643,6 +643,8 @@ void CFrame::OnHostMessage(wxCommandEvent& event)
|
||||||
case IDM_FULLSCREENREQUEST:
|
case IDM_FULLSCREENREQUEST:
|
||||||
if (m_RenderFrame != nullptr)
|
if (m_RenderFrame != nullptr)
|
||||||
m_RenderFrame->ShowFullScreen(event.GetInt() == 0 ? false : true);
|
m_RenderFrame->ShowFullScreen(event.GetInt() == 0 ? false : true);
|
||||||
|
if (m_confirmStop)
|
||||||
|
Core::SetState(Core::CORE_PAUSE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_USER_CREATE:
|
case WM_USER_CREATE:
|
||||||
|
@ -1194,9 +1196,8 @@ void CFrame::DoFullscreen(bool bF)
|
||||||
{
|
{
|
||||||
m_RenderFrame->ShowFullScreen(true, wxFULLSCREEN_ALL);
|
m_RenderFrame->ShowFullScreen(true, wxFULLSCREEN_ALL);
|
||||||
}
|
}
|
||||||
else if (!g_ActiveConfig.backend_info.bSupportsExclusiveFullscreen ||
|
else if (!g_Config.ExclusiveFullscreenEnabled() ||
|
||||||
SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain ||
|
SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain)
|
||||||
g_ActiveConfig.bForceBorderlessFullscreen)
|
|
||||||
{
|
{
|
||||||
// Exiting exclusive fullscreen should be done from a Renderer callback.
|
// Exiting exclusive fullscreen should be done from a Renderer callback.
|
||||||
// Therefore we don't exit fullscreen from here if we support exclusive mode.
|
// Therefore we don't exit fullscreen from here if we support exclusive mode.
|
||||||
|
|
|
@ -170,6 +170,7 @@ private:
|
||||||
bool m_bNoDocking;
|
bool m_bNoDocking;
|
||||||
bool m_bGameLoading;
|
bool m_bGameLoading;
|
||||||
bool m_bClosing;
|
bool m_bClosing;
|
||||||
|
bool m_confirmStop;
|
||||||
|
|
||||||
std::vector<std::string> drives;
|
std::vector<std::string> drives;
|
||||||
|
|
||||||
|
|
|
@ -95,6 +95,7 @@ Core::GetWindowHandle().
|
||||||
#include "InputCommon/ControllerInterface/ControllerInterface.h"
|
#include "InputCommon/ControllerInterface/ControllerInterface.h"
|
||||||
|
|
||||||
#include "VideoCommon/VideoBackendBase.h"
|
#include "VideoCommon/VideoBackendBase.h"
|
||||||
|
#include "VideoCommon/VideoConfig.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#ifndef SM_XVIRTUALSCREEN
|
#ifndef SM_XVIRTUALSCREEN
|
||||||
|
@ -119,8 +120,6 @@ extern "C" {
|
||||||
class InputPlugin;
|
class InputPlugin;
|
||||||
class wxFrame;
|
class wxFrame;
|
||||||
|
|
||||||
static bool confirmStop = false;
|
|
||||||
|
|
||||||
// Create menu items
|
// Create menu items
|
||||||
// ---------------------
|
// ---------------------
|
||||||
void CFrame::CreateMenu()
|
void CFrame::CreateMenu()
|
||||||
|
@ -1082,11 +1081,11 @@ void CFrame::DoStop()
|
||||||
{
|
{
|
||||||
if (!Core::IsRunningAndStarted())
|
if (!Core::IsRunningAndStarted())
|
||||||
return;
|
return;
|
||||||
if (confirmStop)
|
if (m_confirmStop)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// don't let this function run again until it finishes, or is aborted.
|
// don't let this function run again until it finishes, or is aborted.
|
||||||
confirmStop = true;
|
m_confirmStop = true;
|
||||||
|
|
||||||
m_bGameLoading = false;
|
m_bGameLoading = false;
|
||||||
if (Core::GetState() != Core::CORE_UNINITIALIZED ||
|
if (Core::GetState() != Core::CORE_UNINITIALIZED ||
|
||||||
|
@ -1100,8 +1099,21 @@ void CFrame::DoStop()
|
||||||
// Ask for confirmation in case the user accidentally clicked Stop / Escape
|
// Ask for confirmation in case the user accidentally clicked Stop / Escape
|
||||||
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bConfirmStop)
|
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bConfirmStop)
|
||||||
{
|
{
|
||||||
|
// Pause the state during confirmation and restore it afterwards
|
||||||
Core::EState state = Core::GetState();
|
Core::EState state = Core::GetState();
|
||||||
|
|
||||||
|
// 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.
|
||||||
|
if (!RendererIsFullscreen() || !g_Config.ExclusiveFullscreenEnabled() ||
|
||||||
|
SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain)
|
||||||
|
{
|
||||||
Core::SetState(Core::CORE_PAUSE);
|
Core::SetState(Core::CORE_PAUSE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DoFullscreen(false);
|
||||||
|
}
|
||||||
|
|
||||||
wxMessageDialog m_StopDlg(
|
wxMessageDialog m_StopDlg(
|
||||||
this,
|
this,
|
||||||
_("Do you want to stop the current emulation?"),
|
_("Do you want to stop the current emulation?"),
|
||||||
|
@ -1113,7 +1125,7 @@ void CFrame::DoStop()
|
||||||
if (Ret != wxID_YES)
|
if (Ret != wxID_YES)
|
||||||
{
|
{
|
||||||
Core::SetState(state);
|
Core::SetState(state);
|
||||||
confirmStop = false;
|
m_confirmStop = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1135,7 +1147,7 @@ void CFrame::OnStopped()
|
||||||
{
|
{
|
||||||
wxEndBusyCursor();
|
wxEndBusyCursor();
|
||||||
|
|
||||||
confirmStop = false;
|
m_confirmStop = false;
|
||||||
|
|
||||||
#if defined(HAVE_X11) && HAVE_X11
|
#if defined(HAVE_X11) && HAVE_X11
|
||||||
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bDisableScreenSaver)
|
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bDisableScreenSaver)
|
||||||
|
|
|
@ -946,10 +946,10 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbHeight,const EFBRectangl
|
||||||
BOOL fullscreen_state;
|
BOOL fullscreen_state;
|
||||||
if (SUCCEEDED(D3D::swapchain->GetFullscreenState(&fullscreen_state, nullptr)))
|
if (SUCCEEDED(D3D::swapchain->GetFullscreenState(&fullscreen_state, nullptr)))
|
||||||
{
|
{
|
||||||
if (!!fullscreen_state != fullscreen)
|
if (!!fullscreen_state != fullscreen && Host_RendererHasFocus())
|
||||||
{
|
{
|
||||||
// We should be in fullscreen, but we're not. Restore it when we regain focus.
|
// We should be in fullscreen, but we're not. Restore it when we regain focus.
|
||||||
fullscreen_changed = Host_RendererHasFocus();
|
fullscreen_changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -154,6 +154,7 @@ struct VideoConfig final
|
||||||
bool VirtualXFBEnabled() const { return bUseXFB && !bUseRealXFB; }
|
bool VirtualXFBEnabled() const { return bUseXFB && !bUseRealXFB; }
|
||||||
bool EFBCopiesToTextureEnabled() const { return bEFBCopyEnable && bCopyEFBToTexture; }
|
bool EFBCopiesToTextureEnabled() const { return bEFBCopyEnable && bCopyEFBToTexture; }
|
||||||
bool EFBCopiesToRamEnabled() const { return bEFBCopyEnable && !bCopyEFBToTexture; }
|
bool EFBCopiesToRamEnabled() const { return bEFBCopyEnable && !bCopyEFBToTexture; }
|
||||||
|
bool ExclusiveFullscreenEnabled() const { return backend_info.bSupportsExclusiveFullscreen && !bForceBorderlessFullscreen; }
|
||||||
};
|
};
|
||||||
|
|
||||||
extern VideoConfig g_Config;
|
extern VideoConfig g_Config;
|
||||||
|
|
Loading…
Reference in New Issue