[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.
This commit is contained in:
Martin Gräßlin 2013-10-07 14:40:12 +02:00
parent 51ee2e86d1
commit 98549449d6
2 changed files with 11 additions and 7 deletions

View file

@ -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<void (QWidget::*)(void)>(&QWidget::update), Qt::QueuedConnection);
connect(m_view, &QQuickWindow::afterRendering, this,
static_cast<void (KDecoration::*)(void)>(&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"

View file

@ -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();
/**