[aurorae] Do not update shadow from ::paint
Paint is in the middle of the compositor rendering loop. Updating the shadow at that point breaks KWin. Thus we delay the update to the next event cycle. Obviously it would be even better to only update the shadow if it changed, but that might be too expensive.
This commit is contained in:
parent
97de9856ea
commit
060b310082
2 changed files with 11 additions and 2 deletions
|
@ -511,13 +511,19 @@ void Decoration::paint(QPainter *painter, const QRect &repaintRegion)
|
||||||
m_padding->top(),
|
m_padding->top(),
|
||||||
m_buffer.width() - m_padding->left() - m_padding->right(),
|
m_buffer.width() - m_padding->left() - m_padding->right(),
|
||||||
m_buffer.height() - m_padding->top() - m_padding->bottom()));
|
m_buffer.height() - m_padding->top() - m_padding->bottom()));
|
||||||
setShadow(s);
|
m_scheduledShadow = s;
|
||||||
} else {
|
} else {
|
||||||
setShadow(QSharedPointer<KDecoration2::DecorationShadow>());
|
m_scheduledShadow = QSharedPointer<KDecoration2::DecorationShadow>();
|
||||||
}
|
}
|
||||||
|
QMetaObject::invokeMethod(this, "updateShadow", Qt::QueuedConnection);
|
||||||
painter->drawImage(rect(), m_buffer, r);
|
painter->drawImage(rect(), m_buffer, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Decoration::updateShadow()
|
||||||
|
{
|
||||||
|
setShadow(m_scheduledShadow);
|
||||||
|
}
|
||||||
|
|
||||||
QMouseEvent Decoration::translatedMouseEvent(QMouseEvent *orig)
|
QMouseEvent Decoration::translatedMouseEvent(QMouseEvent *orig)
|
||||||
{
|
{
|
||||||
if (!m_padding || client().data()->isMaximized()) {
|
if (!m_padding || client().data()->isMaximized()) {
|
||||||
|
|
|
@ -61,6 +61,8 @@ public Q_SLOTS:
|
||||||
void init() override;
|
void init() override;
|
||||||
void installTitleItem(QQuickItem *item);
|
void installTitleItem(QQuickItem *item);
|
||||||
|
|
||||||
|
void updateShadow();
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void configChanged();
|
void configChanged();
|
||||||
|
|
||||||
|
@ -92,6 +94,7 @@ private:
|
||||||
QScopedPointer<QTimer> m_updateTimer;
|
QScopedPointer<QTimer> m_updateTimer;
|
||||||
QScopedPointer<QOpenGLContext> m_context;
|
QScopedPointer<QOpenGLContext> m_context;
|
||||||
QScopedPointer<QOffscreenSurface> m_offscreenSurface;
|
QScopedPointer<QOffscreenSurface> m_offscreenSurface;
|
||||||
|
QSharedPointer<KDecoration2::DecorationShadow> m_scheduledShadow;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ThemeFinder : public QObject
|
class ThemeFinder : public QObject
|
||||||
|
|
Loading…
Reference in a new issue