D3D: Further improve exclusive fullscreen state checking.
This commit is contained in:
parent
b7e056c74d
commit
399b6248d1
|
@ -878,17 +878,32 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, co
|
||||||
D3D::Present();
|
D3D::Present();
|
||||||
|
|
||||||
// Check exclusive fullscreen state
|
// Check exclusive fullscreen state
|
||||||
bool fullscreen_state, fullscreen_changed = false;
|
bool exclusive_mode, fullscreen_changed = false;
|
||||||
if (SUCCEEDED(D3D::GetFullscreenState(&fullscreen_state)))
|
if (SUCCEEDED(D3D::GetFullscreenState(&exclusive_mode)))
|
||||||
{
|
{
|
||||||
if (fullscreen_state != fullscreen)
|
if (fullscreen && !exclusive_mode)
|
||||||
{
|
{
|
||||||
// The current fullscreen state does not match the configuration,
|
// Exclusive fullscreen is enabled in the configuration, but we're
|
||||||
// either we switched fullscreen settings or the render frame
|
// not in exclusive mode. Either exclusive fullscreen was turned on
|
||||||
// lost focus. When the render frame is in focus we can apply
|
// or the render frame lost focus. When the render frame is in focus
|
||||||
// exclusive mode.
|
// we can apply exclusive mode.
|
||||||
fullscreen_changed = Host_RendererHasFocus();
|
fullscreen_changed = Host_RendererHasFocus();
|
||||||
}
|
}
|
||||||
|
else if (!fullscreen)
|
||||||
|
{
|
||||||
|
if (exclusive_mode)
|
||||||
|
{
|
||||||
|
// 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resize the back buffers NOW to avoid flickering
|
// Resize the back buffers NOW to avoid flickering
|
||||||
|
@ -907,16 +922,8 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, co
|
||||||
{
|
{
|
||||||
// Apply fullscreen state
|
// Apply fullscreen state
|
||||||
if (fullscreen_changed)
|
if (fullscreen_changed)
|
||||||
{
|
|
||||||
D3D::SetFullscreenState(fullscreen);
|
D3D::SetFullscreenState(fullscreen);
|
||||||
|
|
||||||
// Notify the host that it is safe to exit fullscreen
|
|
||||||
if (!fullscreen)
|
|
||||||
{
|
|
||||||
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);
|
||||||
|
|
Loading…
Reference in New Issue