diff --git a/shell/panelshadows.cpp b/shell/panelshadows.cpp --- a/shell/panelshadows.cpp +++ b/shell/panelshadows.cpp @@ -77,6 +77,7 @@ void updateShadows(); void windowDestroyed(QObject *deletedObject); void setupData(Plasma::FrameSvg::EnabledBorders enabledBorders); + bool hasShadows() const; void setupWaylandIntegration(); @@ -191,10 +192,19 @@ void PanelShadows::Private::updateShadows() { - setupPixmaps(); - QHash::const_iterator i; - for (i = m_windows.constBegin(); i != m_windows.constEnd(); ++i) { - updateShadow(i.key(), i.value()); + // has shadows now? + if (hasShadows()) { + for (auto i = m_windows.constBegin(); i != m_windows.constEnd(); ++i) { + updateShadow(i.key(), i.value()); + } + } else { + const bool hadShadowsBefore = !m_shadowPixmaps.isEmpty(); + if (hadShadowsBefore) { + for (auto i = m_windows.constBegin(); i != m_windows.constEnd(); ++i) { + clearShadow(i.key()); + } + clearPixmaps(); + } } } @@ -508,6 +518,10 @@ void PanelShadows::Private::updateShadow(const QWindow *window, Plasma::FrameSvg::EnabledBorders enabledBorders) { + if (!hasShadows()) { + return; + } + #if HAVE_X11 if (m_isX11) { updateShadowX11(window, enabledBorders); @@ -675,9 +689,9 @@ surface->commit(KWayland::Client::Surface::CommitFlag::None); } -bool PanelShadows::enabled() const +bool PanelShadows::Private::hasShadows() const { - return hasElement(QStringLiteral("shadow-left")); + return q->hasElement(QStringLiteral("shadow-left")); } void PanelShadows::Private::setupWaylandIntegration() diff --git a/shell/panelshadows_p.h b/shell/panelshadows_p.h --- a/shell/panelshadows_p.h +++ b/shell/panelshadows_p.h @@ -40,8 +40,6 @@ void setEnabledBorders(const QWindow *window, Plasma::FrameSvg::EnabledBorders enabledBorders = Plasma::FrameSvg::AllBorders); - bool enabled() const; - private: class Private; Private * const d;