From 98549449d695eb3b46eb8713731b69ea07f89d3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Mon, 7 Oct 2013 14:40:12 +0200 Subject: [PATCH] [aurorae] Implement new render method in Aurorae Improves the situation a little bit: schedules updates without rendering to the QWidget, but still fbo -> QImage in each frame. --- clients/aurorae/src/aurorae.cpp | 16 +++++++++------- clients/aurorae/src/aurorae.h | 2 ++ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/clients/aurorae/src/aurorae.cpp b/clients/aurorae/src/aurorae.cpp index 6cf8ce2c3d..5f5000cfb5 100644 --- a/clients/aurorae/src/aurorae.cpp +++ b/clients/aurorae/src/aurorae.cpp @@ -276,8 +276,8 @@ void AuroraeClient::init() connect(m_view, &QQuickWindow::afterRendering, [this]{ m_buffer = m_fbo->toImage(); }); - connect(m_view, &QQuickWindow::afterRendering, widget(), - static_cast(&QWidget::update), Qt::QueuedConnection); + connect(m_view, &QQuickWindow::afterRendering, this, + static_cast(&KDecoration::update), Qt::QueuedConnection); } m_view->setColor(Qt::transparent); m_container = QWidget::createWindowContainer(m_view, widget(), Qt::X11BypassWindowManagerHint); @@ -295,11 +295,6 @@ void AuroraeClient::init() bool AuroraeClient::eventFilter(QObject *object, QEvent *event) { - if (compositingActive() && !m_fbo.isNull() && object == widget() && QEvent::Paint) { - QPainter painter(widget()); - painter.drawImage(QPoint(0, 0), m_buffer); - return false; - } // we need to filter the wheel events on the decoration // QML does not yet provide a way to accept wheel events, this will change with Qt 5 // TODO: remove in KDE5 @@ -597,6 +592,13 @@ bool AuroraeClient::animationsSupported() const return compositingActive(); } +void AuroraeClient::render(QPaintDevice *device, const QRegion &sourceRegion) +{ + QPainter painter(device); + painter.setClipRegion(sourceRegion); + painter.drawImage(QPoint(0, 0), m_buffer); +} + } // namespace Aurorae extern "C" diff --git a/clients/aurorae/src/aurorae.h b/clients/aurorae/src/aurorae.h index bb5ffed47c..a9081b8892 100644 --- a/clients/aurorae/src/aurorae.h +++ b/clients/aurorae/src/aurorae.h @@ -121,6 +121,8 @@ public: Q_INVOKABLE QVariant readConfig(const QString &key, const QVariant &defaultValue = QVariant()); + virtual void render(QPaintDevice *device, const QRegion &sourceRegion); + Q_SIGNALS: void buttonsChanged(); /**