diff --git a/shell/panelview.h b/shell/panelview.h --- a/shell/panelview.h +++ b/shell/panelview.h @@ -48,6 +48,11 @@ Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment NOTIFY alignmentChanged) /** + * Effects for the panel: Enable/Disable blur and background effects + */ + Q_PROPERTY(bool effects READ effects WRITE setEffects NOTIFY effectsChanged) + + /** * how much the panel is moved from the left/right/center anchor point */ Q_PROPERTY(int offset READ offset WRITE setOffset NOTIFY offsetChanged) @@ -112,6 +117,9 @@ Qt::Alignment alignment() const; void setAlignment(Qt::Alignment alignment); + + bool effects() const; + void setEffects(bool effects); int offset() const; void setOffset(int offset); @@ -169,6 +177,7 @@ void minimumLengthChanged(); void distanceChanged(); void enabledBordersChanged(); + void effectsChanged(); //QWindow does not have a property for screen. Adding this property requires re-implementing the signal void screenToFollowChanged(QScreen *screen); @@ -209,6 +218,7 @@ int m_contentLength; int m_distance; int m_thickness; + bool m_effects; bool m_initCompleted; Qt::Alignment m_alignment; QPointer m_panelConfigView; diff --git a/shell/panelview.cpp b/shell/panelview.cpp --- a/shell/panelview.cpp +++ b/shell/panelview.cpp @@ -63,6 +63,7 @@ m_visibilityMode(NormalPanel), m_background(0), m_shellSurface(nullptr), + m_effects(true), m_initCompleted(false) { if (targetScreen) { @@ -76,6 +77,7 @@ setFlags(Qt::FramelessWindowHint|Qt::WindowDoesNotAcceptFocus); connect(&m_theme, &Plasma::Theme::themeChanged, this, &PanelView::themeChanged); + connect(this, SIGNAL(effectsChanged()), this, SLOT(themeChanged())); m_positionPaneltimer.setSingleShot(true); m_positionPaneltimer.setInterval(150); @@ -211,6 +213,21 @@ resizePanel(); } +bool PanelView::effects() const +{ + return m_effects; +} + +void PanelView::setEffects(bool value) +{ + if (value == effects()) { + return; + } + + m_effects = value; + emit effectsChanged(); +} + int PanelView::length() const { return qMax(1, m_contentLength); @@ -1056,11 +1073,20 @@ void PanelView::themeChanged() { - KWindowEffects::enableBlurBehind(winId(), true); - KWindowEffects::enableBackgroundContrast(winId(), m_theme.backgroundContrastEnabled(), - m_theme.backgroundContrast(), - m_theme.backgroundIntensity(), - m_theme.backgroundSaturation()); + if (m_effects) { + KWindowEffects::enableBlurBehind(winId(), true); + KWindowEffects::enableBackgroundContrast(winId(), m_theme.backgroundContrastEnabled(), + m_theme.backgroundContrast(), + m_theme.backgroundIntensity(), + m_theme.backgroundSaturation()); + } else { + KWindowEffects::enableBlurBehind(winId(), false); + KWindowEffects::enableBackgroundContrast(winId(), false, + m_theme.backgroundContrast(), + m_theme.backgroundIntensity(), + m_theme.backgroundSaturation()); + } + updateMask(); }