Merge pull request #6312 from spycrab/qt_vulkan_resize
Qt: Fix render window resize bug
This commit is contained in:
commit
6a002a4938
|
@ -2,12 +2,15 @@
|
|||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "DolphinQt2/Host.h"
|
||||
|
||||
#include <QAbstractEventDispatcher>
|
||||
#include <QApplication>
|
||||
|
||||
#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)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -23,6 +23,7 @@ signals:
|
|||
void Closed();
|
||||
void HandleChanged(void* handle);
|
||||
void StateChanged(bool fullscreen);
|
||||
void SizeChanged();
|
||||
|
||||
private:
|
||||
void HandleCursorTimer();
|
||||
|
|
Loading…
Reference in New Issue