summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorLéo Lam <leolino.lam@gmail.com>2018-03-26 19:04:53 +0200
committerGitHub <noreply@github.com>2018-03-26 19:04:53 +0200
commitb4e9bef25c87489e3865a7f5d4f505027fdfa908 (patch)
tree04b35eed366d0060517049506d29fab97cf37631 /Source/Core
parent2e1edb49b0cb2f3dd1f73ae117a8e49f15afddb9 (diff)
parent3f1430587ce09f82241825840097b6c60497af0a (diff)
Merge pull request #6519 from spycrab/qt_rw_bg
Qt/RenderWidget: Draw background on pause
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/DolphinQt2/MainWindow.cpp1
-rw-r--r--Source/Core/DolphinQt2/RenderWidget.cpp20
-rw-r--r--Source/Core/DolphinQt2/RenderWidget.h1
3 files changed, 20 insertions, 2 deletions
diff --git a/Source/Core/DolphinQt2/MainWindow.cpp b/Source/Core/DolphinQt2/MainWindow.cpp
index f77e23a663..30e3ec2242 100644
--- a/Source/Core/DolphinQt2/MainWindow.cpp
+++ b/Source/Core/DolphinQt2/MainWindow.cpp
@@ -655,6 +655,7 @@ void MainWindow::ShowRenderWidget()
m_rendering_to_main = true;
m_stack->setCurrentIndex(m_stack->addWidget(m_render_widget));
connect(Host::GetInstance(), &Host::RequestTitle, this, &MainWindow::setWindowTitle);
+ m_stack->repaint();
}
else
{
diff --git a/Source/Core/DolphinQt2/RenderWidget.cpp b/Source/Core/DolphinQt2/RenderWidget.cpp
index ea2611fa15..3537366b4a 100644
--- a/Source/Core/DolphinQt2/RenderWidget.cpp
+++ b/Source/Core/DolphinQt2/RenderWidget.cpp
@@ -3,17 +3,20 @@
// Refer to the license.txt file included.
#include <QKeyEvent>
+#include <QPalette>
#include <QTimer>
#include "Core/ConfigManager.h"
+#include "Core/Core.h"
#include "DolphinQt2/Host.h"
#include "DolphinQt2/RenderWidget.h"
#include "DolphinQt2/Settings.h"
RenderWidget::RenderWidget(QWidget* parent) : QWidget(parent)
{
- setAttribute(Qt::WA_OpaquePaintEvent, true);
- setAttribute(Qt::WA_NoSystemBackground, true);
+ QPalette p;
+ p.setColor(QPalette::Background, Qt::black);
+ setPalette(p);
connect(Host::GetInstance(), &Host::RequestTitle, this, &RenderWidget::setWindowTitle);
connect(Host::GetInstance(), &Host::RequestRenderSize, this, [this](int w, int h) {
@@ -23,6 +26,10 @@ RenderWidget::RenderWidget(QWidget* parent) : QWidget(parent)
resize(w, h);
});
+ connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, [this](Core::State state) {
+ SetFillBackground(SConfig::GetInstance().bRenderToMain && state == Core::State::Uninitialized);
+ });
+
// We have to use Qt::DirectConnection here because we don't want those signals to get queued
// (which results in them not getting called)
connect(this, &RenderWidget::StateChanged, Host::GetInstance(), &Host::SetRenderFullscreen,
@@ -43,6 +50,15 @@ RenderWidget::RenderWidget(QWidget* parent) : QWidget(parent)
&RenderWidget::OnHideCursorChanged);
OnHideCursorChanged();
m_mouse_timer->start(MOUSE_HIDE_DELAY);
+
+ SetFillBackground(true);
+}
+
+void RenderWidget::SetFillBackground(bool fill)
+{
+ setAttribute(Qt::WA_OpaquePaintEvent, !fill);
+ setAttribute(Qt::WA_NoSystemBackground, !fill);
+ setAutoFillBackground(fill);
}
void RenderWidget::OnHideCursorChanged()
diff --git a/Source/Core/DolphinQt2/RenderWidget.h b/Source/Core/DolphinQt2/RenderWidget.h
index 565fdb9243..be276d10fc 100644
--- a/Source/Core/DolphinQt2/RenderWidget.h
+++ b/Source/Core/DolphinQt2/RenderWidget.h
@@ -29,6 +29,7 @@ signals:
private:
void HandleCursorTimer();
void OnHideCursorChanged();
+ void SetFillBackground(bool fill);
static constexpr int MOUSE_HIDE_DELAY = 3000;
QTimer* m_mouse_timer;