From c6d2eee3c1aa1c877d5e8071556e91c7059d05c7 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Thu, 4 Feb 2021 11:06:20 +0200 Subject: [PATCH] Introduce signals to notify about Shadow changes These signal can be useful if you need to know when the shadow must be repainted or its geometry has changed. --- src/shadow.cpp | 5 +++++ src/shadow.h | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/src/shadow.cpp b/src/shadow.cpp index 15988c8c02..85d5167994 100644 --- a/src/shadow.cpp +++ b/src/shadow.cpp @@ -195,6 +195,7 @@ bool Shadow::init(const QVector< uint32_t > &data) return false; } buildQuads(); + emit textureChanged(); return true; } @@ -225,6 +226,7 @@ bool Shadow::init(KDecoration2::Decoration *decoration) return false; } buildQuads(); + emit textureChanged(); return true; } @@ -253,6 +255,7 @@ bool Shadow::init(const QPointer< KWaylandServer::ShadowInterface > &shadow) return false; } buildQuads(); + emit textureChanged(); return true; } @@ -295,6 +298,7 @@ bool Shadow::init(const QWindow *window) } buildQuads(); + emit textureChanged(); return true; } @@ -306,6 +310,7 @@ void Shadow::updateShadowRegion() const QRect bottom(0, m_topLevel->height(), m_topLevel->width(), m_bottomOffset); const QRect left(- m_leftOffset, - m_topOffset, m_leftOffset, m_topLevel->height() + m_topOffset + m_bottomOffset); m_shadowRegion = QRegion(top).united(right).united(bottom).united(left); + emit regionChanged(); } void Shadow::buildQuads() diff --git a/src/shadow.h b/src/shadow.h index 60c6307df3..24ca42dc18 100644 --- a/src/shadow.h +++ b/src/shadow.h @@ -105,6 +105,10 @@ public: return m_decorationShadow.toWeakRef(); } +Q_SIGNALS: + void regionChanged(); + void textureChanged(); + public Q_SLOTS: void geometryChanged();