Merge pull request #1894 from Armada651/exclusive-fix
D3D: Fix Dolphin immediately exiting exclusive fullscreen.
This commit is contained in:
commit
0d0f7ec662
|
@ -211,6 +211,11 @@ bool CRenderFrame::ShowFullScreen(bool show, long style)
|
||||||
{
|
{
|
||||||
// OpenGL requires the pop-up style to activate exclusive mode.
|
// OpenGL requires the pop-up style to activate exclusive mode.
|
||||||
SetWindowStyle((GetWindowStyle() & ~wxDEFAULT_FRAME_STYLE) | wxPOPUP_WINDOW);
|
SetWindowStyle((GetWindowStyle() & ~wxDEFAULT_FRAME_STYLE) | wxPOPUP_WINDOW);
|
||||||
|
|
||||||
|
// Some backends don't support exclusive fullscreen, so we
|
||||||
|
// can't tell exactly when exclusive mode is activated.
|
||||||
|
if (!g_Config.backend_info.bSupportsExclusiveFullscreen)
|
||||||
|
OSD::AddMessage("Enabled exclusive fullscreen.");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1314,13 +1319,11 @@ void CFrame::OnMouse(wxMouseEvent& event)
|
||||||
|
|
||||||
void CFrame::DoFullscreen(bool enable_fullscreen)
|
void CFrame::DoFullscreen(bool enable_fullscreen)
|
||||||
{
|
{
|
||||||
if (g_Config.ExclusiveFullscreenEnabled() &&
|
if (g_Config.bExclusiveMode && Core::GetState() == Core::CORE_PAUSE)
|
||||||
!SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain &&
|
|
||||||
Core::GetState() == Core::CORE_PAUSE)
|
|
||||||
{
|
{
|
||||||
// A responsive renderer is required for exclusive fullscreen, but the
|
// A responsive renderer is required for exclusive fullscreen, but the
|
||||||
// renderer can only respond in the running state. Therefore we ignore
|
// 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.
|
// renderer is not running.
|
||||||
// TODO: Allow the renderer to switch fullscreen modes while paused.
|
// TODO: Allow the renderer to switch fullscreen modes while paused.
|
||||||
return;
|
return;
|
||||||
|
@ -1341,11 +1344,10 @@ void CFrame::DoFullscreen(bool enable_fullscreen)
|
||||||
{
|
{
|
||||||
m_RenderFrame->ShowFullScreen(true, wxFULLSCREEN_ALL);
|
m_RenderFrame->ShowFullScreen(true, wxFULLSCREEN_ALL);
|
||||||
}
|
}
|
||||||
else if (!g_Config.ExclusiveFullscreenEnabled() ||
|
else if (!g_Config.bExclusiveMode)
|
||||||
SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain)
|
|
||||||
{
|
{
|
||||||
// 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 are in exclusive mode.
|
||||||
m_RenderFrame->ShowFullScreen(false, wxFULLSCREEN_ALL);
|
m_RenderFrame->ShowFullScreen(false, wxFULLSCREEN_ALL);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1398,8 +1400,7 @@ void CFrame::DoFullscreen(bool enable_fullscreen)
|
||||||
m_RenderFrame->Raise();
|
m_RenderFrame->Raise();
|
||||||
}
|
}
|
||||||
|
|
||||||
g_Config.bFullscreen = (!g_Config.ExclusiveFullscreenEnabled() ||
|
g_Config.bFullscreen = enable_fullscreen;
|
||||||
SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain) ? false : enable_fullscreen;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const CGameListCtrl *CFrame::GetGameListCtrl() const
|
const CGameListCtrl *CFrame::GetGameListCtrl() const
|
||||||
|
|
|
@ -862,7 +862,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, co
|
||||||
SetWindowSize(fbStride, fbHeight);
|
SetWindowSize(fbStride, fbHeight);
|
||||||
|
|
||||||
const bool windowResized = CheckForResize();
|
const bool windowResized = CheckForResize();
|
||||||
const bool fullscreen = g_ActiveConfig.bFullscreen &&
|
const bool fullscreen = g_ActiveConfig.bFullscreen && !g_ActiveConfig.bBorderlessFullscreen &&
|
||||||
!SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain;
|
!SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain;
|
||||||
|
|
||||||
bool xfbchanged = s_last_xfb_mode != g_ActiveConfig.bUseRealXFB;
|
bool xfbchanged = s_last_xfb_mode != g_ActiveConfig.bUseRealXFB;
|
||||||
|
@ -885,26 +885,21 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, co
|
||||||
{
|
{
|
||||||
if (fullscreen && !exclusive_mode)
|
if (fullscreen && !exclusive_mode)
|
||||||
{
|
{
|
||||||
|
if (g_Config.bExclusiveMode)
|
||||||
|
OSD::AddMessage("Lost exclusive fullscreen.");
|
||||||
|
|
||||||
// Exclusive fullscreen is enabled in the configuration, but we're
|
// Exclusive fullscreen is enabled in the configuration, but we're
|
||||||
// not in exclusive mode. Either exclusive fullscreen was turned on
|
// not in exclusive mode. Either exclusive fullscreen was turned on
|
||||||
// or the render frame lost focus. When the render frame is in focus
|
// or the render frame lost focus. When the render frame is in focus
|
||||||
// we can apply exclusive mode.
|
// we can apply exclusive mode.
|
||||||
fullscreen_changed = Host_RendererHasFocus();
|
fullscreen_changed = Host_RendererHasFocus();
|
||||||
|
|
||||||
|
g_Config.bExclusiveMode = false;
|
||||||
}
|
}
|
||||||
else if (!fullscreen)
|
else if (!fullscreen && exclusive_mode)
|
||||||
{
|
{
|
||||||
if (exclusive_mode)
|
// Exclusive fullscreen is disabled, but we're still in exclusive mode.
|
||||||
{
|
fullscreen_changed = true;
|
||||||
// Exclusive fullscreen is disabled, but we're still in exclusive mode.
|
|
||||||
fullscreen_changed = true;
|
|
||||||
}
|
|
||||||
else if (!g_ActiveConfig.bBorderlessFullscreen && Host_RendererIsFullscreen())
|
|
||||||
{
|
|
||||||
// Exclusive fullscreen is disabled and we are no longer in exclusive
|
|
||||||
// mode. Thus we can now safely notify the UI to exit fullscreen. But
|
|
||||||
// we should only do so if borderless fullscreen mode is disabled.
|
|
||||||
Host_RequestFullscreen(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -924,8 +919,19 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, co
|
||||||
{
|
{
|
||||||
// Apply fullscreen state
|
// Apply fullscreen state
|
||||||
if (fullscreen_changed)
|
if (fullscreen_changed)
|
||||||
|
{
|
||||||
|
g_Config.bExclusiveMode = fullscreen;
|
||||||
|
|
||||||
|
if (fullscreen)
|
||||||
|
OSD::AddMessage("Entered exclusive fullscreen.");
|
||||||
|
|
||||||
D3D::SetFullscreenState(fullscreen);
|
D3D::SetFullscreenState(fullscreen);
|
||||||
|
|
||||||
|
// If fullscreen is disabled we can safely notify the UI to exit fullscreen.
|
||||||
|
if (!g_ActiveConfig.bFullscreen)
|
||||||
|
Host_RequestFullscreen(false);
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: Aren't we still holding a reference to the back buffer right now?
|
// TODO: Aren't we still holding a reference to the back buffer right now?
|
||||||
D3D::Reset();
|
D3D::Reset();
|
||||||
SAFE_RELEASE(s_screenshot_texture);
|
SAFE_RELEASE(s_screenshot_texture);
|
||||||
|
|
|
@ -28,7 +28,10 @@ void UpdateActiveConfig()
|
||||||
VideoConfig::VideoConfig()
|
VideoConfig::VideoConfig()
|
||||||
{
|
{
|
||||||
bRunning = false;
|
bRunning = false;
|
||||||
|
|
||||||
|
// Exclusive fullscreen flags
|
||||||
bFullscreen = false;
|
bFullscreen = false;
|
||||||
|
bExclusiveMode = false;
|
||||||
|
|
||||||
// Needed for the first frame, I think
|
// Needed for the first frame, I think
|
||||||
fAspectRatioHackW = 1;
|
fAspectRatioHackW = 1;
|
||||||
|
|
|
@ -67,6 +67,7 @@ struct VideoConfig final
|
||||||
// General
|
// General
|
||||||
bool bVSync;
|
bool bVSync;
|
||||||
bool bFullscreen;
|
bool bFullscreen;
|
||||||
|
bool bExclusiveMode;
|
||||||
bool bRunning;
|
bool bRunning;
|
||||||
bool bWidescreenHack;
|
bool bWidescreenHack;
|
||||||
int iAspectRatio;
|
int iAspectRatio;
|
||||||
|
|
Loading…
Reference in New Issue