VideoConfig: Add exclusive mode flag.

Allows the UI to easily check the current exclusive mode state.
This simplifies a few checks and prevents the user from ever getting stuck in fullscreen.
This commit is contained in:
Jules Blok 2015-01-18 04:35:08 +01:00
parent 8d69658a9d
commit 332d5888eb
4 changed files with 12 additions and 13 deletions

View File

@ -1319,13 +1319,11 @@ void CFrame::OnMouse(wxMouseEvent& event)
void CFrame::DoFullscreen(bool enable_fullscreen)
{
if (g_Config.ExclusiveFullscreenEnabled() &&
!SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain &&
Core::GetState() == Core::CORE_PAUSE)
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 support exclusive fullscreen, but the
// 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;
@ -1346,11 +1344,10 @@ void CFrame::DoFullscreen(bool enable_fullscreen)
{
m_RenderFrame->ShowFullScreen(true, wxFULLSCREEN_ALL);
}
else if (!g_Config.ExclusiveFullscreenEnabled() ||
SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain)
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 support exclusive mode.
// Therefore we don't exit fullscreen from here if we are in exclusive mode.
m_RenderFrame->ShowFullScreen(false, wxFULLSCREEN_ALL);
}
#endif

View File

@ -43,7 +43,6 @@ namespace DX11
static u32 s_last_multisample_mode = 0;
static bool s_last_stereo_mode = false;
static bool s_last_xfb_mode = false;
static bool s_last_fullscreen = false;
static Television s_television;
@ -231,7 +230,6 @@ Renderer::Renderer(void *&window_handle)
s_last_efb_scale = g_ActiveConfig.iEFBScale;
s_last_stereo_mode = g_ActiveConfig.iStereoMode > 0;
s_last_xfb_mode = g_ActiveConfig.bUseRealXFB;
s_last_fullscreen = g_ActiveConfig.bFullscreen;
CalculateTargetSize(s_backbuffer_width, s_backbuffer_height);
SetupDeviceObjects();
@ -887,16 +885,16 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, co
{
if (fullscreen && !exclusive_mode)
{
if (s_last_fullscreen)
if (g_Config.bExclusiveMode)
OSD::AddMessage("Lost exclusive fullscreen.");
s_last_fullscreen = false;
// Exclusive fullscreen is enabled in the configuration, but we're
// not in exclusive mode. Either exclusive fullscreen was turned on
// or the render frame lost focus. When the render frame is in focus
// we can apply exclusive mode.
fullscreen_changed = Host_RendererHasFocus();
g_Config.bExclusiveMode = false;
}
else if (!fullscreen && exclusive_mode)
{
@ -922,7 +920,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, co
// Apply fullscreen state
if (fullscreen_changed)
{
s_last_fullscreen = fullscreen;
g_Config.bExclusiveMode = fullscreen;
if (fullscreen)
OSD::AddMessage("Entered exclusive fullscreen.");

View File

@ -28,7 +28,10 @@ void UpdateActiveConfig()
VideoConfig::VideoConfig()
{
bRunning = false;
// Exclusive fullscreen flags
bFullscreen = false;
bExclusiveMode = false;
// Needed for the first frame, I think
fAspectRatioHackW = 1;

View File

@ -67,6 +67,7 @@ struct VideoConfig final
// General
bool bVSync;
bool bFullscreen;
bool bExclusiveMode;
bool bRunning;
bool bWidescreenHack;
int iAspectRatio;