diff --git a/Source/Core/DolphinQt2/Host.cpp b/Source/Core/DolphinQt2/Host.cpp index c39207b252..e053cd91fa 100644 --- a/Source/Core/DolphinQt2/Host.cpp +++ b/Source/Core/DolphinQt2/Host.cpp @@ -2,12 +2,15 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include "DolphinQt2/Host.h" + #include #include #include "Common/Common.h" +#include "Core/ConfigManager.h" #include "Core/Host.h" -#include "DolphinQt2/Host.h" +#include "VideoCommon/RenderBase.h" Host::Host() = default; @@ -47,6 +50,12 @@ void Host::SetRenderFullscreen(bool fullscreen) m_render_fullscreen = fullscreen; } +void Host::UpdateSurface() +{ + if (g_renderer) + g_renderer->ChangeSurface(GetRenderHandle()); +} + void Host_Message(int id) { if (id == WM_USER_STOP) diff --git a/Source/Core/DolphinQt2/Host.h b/Source/Core/DolphinQt2/Host.h index 203c81e022..0b998722d2 100644 --- a/Source/Core/DolphinQt2/Host.h +++ b/Source/Core/DolphinQt2/Host.h @@ -26,6 +26,7 @@ public: void SetRenderHandle(void* handle); void SetRenderFocus(bool focus); void SetRenderFullscreen(bool fullscreen); + void UpdateSurface(); signals: void RequestTitle(const QString& title); diff --git a/Source/Core/DolphinQt2/RenderWidget.cpp b/Source/Core/DolphinQt2/RenderWidget.cpp index f8b744b3d4..bbeace4e2a 100644 --- a/Source/Core/DolphinQt2/RenderWidget.cpp +++ b/Source/Core/DolphinQt2/RenderWidget.cpp @@ -22,6 +22,8 @@ RenderWidget::RenderWidget(QWidget* parent) : QWidget(parent) Qt::DirectConnection); connect(this, &RenderWidget::HandleChanged, Host::GetInstance(), &Host::SetRenderHandle, Qt::DirectConnection); + connect(this, &RenderWidget::SizeChanged, Host::GetInstance(), &Host::UpdateSurface, + Qt::DirectConnection); emit HandleChanged((void*)winId()); @@ -75,6 +77,9 @@ bool RenderWidget::event(QEvent* event) case QEvent::WindowDeactivate: Host::GetInstance()->SetRenderFocus(false); break; + case QEvent::Resize: + emit SizeChanged(); + break; case QEvent::WindowStateChange: emit StateChanged(isFullScreen()); break; diff --git a/Source/Core/DolphinQt2/RenderWidget.h b/Source/Core/DolphinQt2/RenderWidget.h index dd5c17b95d..478ac8cda3 100644 --- a/Source/Core/DolphinQt2/RenderWidget.h +++ b/Source/Core/DolphinQt2/RenderWidget.h @@ -23,6 +23,7 @@ signals: void Closed(); void HandleChanged(void* handle); void StateChanged(bool fullscreen); + void SizeChanged(); private: void HandleCursorTimer();