From 68e2b46ba1371222cf5965f92a15bd4e01131db8 Mon Sep 17 00:00:00 2001 From: spycrab Date: Thu, 3 May 2018 14:16:21 +0200 Subject: [PATCH] Qt: Call Render::SetFullscreen --- Source/Core/DolphinQt2/Host.cpp | 7 +++++++ Source/Core/DolphinQt2/Host.h | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Source/Core/DolphinQt2/Host.cpp b/Source/Core/DolphinQt2/Host.cpp index 27af4c7a91..10773f0b12 100644 --- a/Source/Core/DolphinQt2/Host.cpp +++ b/Source/Core/DolphinQt2/Host.cpp @@ -16,6 +16,7 @@ #include "Core/PowerPC/PowerPC.h" #include "DolphinQt2/Settings.h" #include "VideoCommon/RenderBase.h" +#include "VideoCommon/VideoConfig.h" Host::Host() = default; @@ -43,6 +44,8 @@ bool Host::GetRenderFocus() void Host::SetRenderFocus(bool focus) { m_render_focus = focus; + if (g_renderer && m_render_fullscreen && g_ActiveConfig.ExclusiveFullscreenEnabled()) + Core::RunAsCPUThread([focus] { g_renderer->SetFullscreen(focus); }); } bool Host::GetRenderFullscreen() @@ -53,6 +56,10 @@ bool Host::GetRenderFullscreen() void Host::SetRenderFullscreen(bool fullscreen) { m_render_fullscreen = fullscreen; + + if (g_renderer && g_renderer->IsFullscreen() != fullscreen && + g_ActiveConfig.ExclusiveFullscreenEnabled()) + Core::RunAsCPUThread([fullscreen] { g_renderer->SetFullscreen(fullscreen); }); } void Host::ResizeSurface(int new_width, int new_height) diff --git a/Source/Core/DolphinQt2/Host.h b/Source/Core/DolphinQt2/Host.h index c5f0f071fb..486217bcf2 100644 --- a/Source/Core/DolphinQt2/Host.h +++ b/Source/Core/DolphinQt2/Host.h @@ -37,7 +37,7 @@ signals: private: Host(); - std::atomic m_render_handle; - std::atomic m_render_focus; - std::atomic m_render_fullscreen; + std::atomic m_render_handle{nullptr}; + std::atomic m_render_focus{false}; + std::atomic m_render_fullscreen{false}; };