diff --git a/shell/panelview.h b/shell/panelview.h --- a/shell/panelview.h +++ b/shell/panelview.h @@ -76,6 +76,13 @@ * how much the panel is distant for the screen edge: used by the panel controller to drag it around */ Q_PROPERTY(int distance READ distance WRITE setDistance NOTIFY distanceChanged) + + /** + * support NoBackground in order to disable blur/contrast effects and remove + * the panel shadows + * @since 5.9 + */ + Q_PROPERTY(Plasma::Types::BackgroundHints backgroundHints WRITE setBackgroundHints READ backgroundHints NOTIFY backgroundHintsChanged) /** * The borders that should have a shadow @@ -130,6 +137,9 @@ int distance() const; void setDistance(int dist); + + Plasma::Types::BackgroundHints backgroundHints() const; + void setBackgroundHints(Plasma::Types::BackgroundHints hint); Plasma::FrameSvg::EnabledBorders enabledBorders() const; @@ -168,6 +178,7 @@ void maximumLengthChanged(); void minimumLengthChanged(); void distanceChanged(); + void backgroundHintsChanged(); void enabledBordersChanged(); //QWindow does not have a property for screen. Adding this property requires re-implementing the signal @@ -220,6 +231,7 @@ QTimer m_unhideTimer; //only for the mask, not to actually paint Plasma::FrameSvg *m_background; + Plasma::Types::BackgroundHints m_backgroundHints; Plasma::FrameSvg::EnabledBorders m_enabledBorders = Plasma::FrameSvg::AllBorders; KWayland::Client::PlasmaShellSurface *m_shellSurface; QPointer m_lastScreen; diff --git a/shell/panelview.cpp b/shell/panelview.cpp --- a/shell/panelview.cpp +++ b/shell/panelview.cpp @@ -62,6 +62,7 @@ m_corona(corona), m_visibilityMode(NormalPanel), m_background(0), + m_backgroundHints(Plasma::Types::StandardBackground), m_shellSurface(nullptr), m_initCompleted(false) { @@ -76,6 +77,7 @@ setFlags(Qt::FramelessWindowHint|Qt::WindowDoesNotAcceptFocus); connect(&m_theme, &Plasma::Theme::themeChanged, this, &PanelView::themeChanged); + connect(this, SIGNAL(backgroundHintsChanged()), this, SLOT(themeChanged())); m_positionPaneltimer.setSingleShot(true); m_positionPaneltimer.setInterval(150); @@ -290,6 +292,22 @@ positionPanel(); } +Plasma::Types::BackgroundHints PanelView::backgroundHints() const +{ + return m_backgroundHints; +} + +void PanelView::setBackgroundHints(Plasma::Types::BackgroundHints hint) +{ + if (m_backgroundHints == hint) { + return; + } + + m_backgroundHints = hint; + + emit backgroundHintsChanged(); +} + Plasma::FrameSvg::EnabledBorders PanelView::enabledBorders() const { return m_enabledBorders; @@ -1056,11 +1074,16 @@ void PanelView::themeChanged() { - KWindowEffects::enableBlurBehind(winId(), true); - KWindowEffects::enableBackgroundContrast(winId(), m_theme.backgroundContrastEnabled(), - m_theme.backgroundContrast(), - m_theme.backgroundIntensity(), - m_theme.backgroundSaturation()); + if (m_backgroundHints == Plasma::Types::NoBackground) { + KWindowEffects::enableBlurBehind(winId(), false); + KWindowEffects::enableBackgroundContrast(winId(), false); + } else { + KWindowEffects::enableBlurBehind(winId(), true); + KWindowEffects::enableBackgroundContrast(winId(), m_theme.backgroundContrastEnabled(), + m_theme.backgroundContrast(), + m_theme.backgroundIntensity(), + m_theme.backgroundSaturation()); + } updateMask(); } @@ -1146,41 +1169,48 @@ void PanelView::updateEnabledBorders() { Plasma::FrameSvg::EnabledBorders borders = Plasma::FrameSvg::AllBorders; + + if (m_backgroundHints == Plasma::Types::NoBackground) { + borders = Plasma::FrameSvg::NoBorder; + } else { + switch (location()) { + case Plasma::Types::TopEdge: + borders &= ~Plasma::FrameSvg::TopBorder; + break; + case Plasma::Types::LeftEdge: + borders &= ~Plasma::FrameSvg::LeftBorder; + break; + case Plasma::Types::RightEdge: + borders &= ~Plasma::FrameSvg::RightBorder; + break; + case Plasma::Types::BottomEdge: + borders &= ~Plasma::FrameSvg::BottomBorder; + break; + default: + break; + } - switch (location()) { - case Plasma::Types::TopEdge: - borders &= ~Plasma::FrameSvg::TopBorder; - break; - case Plasma::Types::LeftEdge: - borders &= ~Plasma::FrameSvg::LeftBorder; - break; - case Plasma::Types::RightEdge: - borders &= ~Plasma::FrameSvg::RightBorder; - break; - case Plasma::Types::BottomEdge: - borders &= ~Plasma::FrameSvg::BottomBorder; - break; - default: - break; - } - - if (x() <= m_screenToFollow->geometry().x()) { - borders &= ~Plasma::FrameSvg::LeftBorder; - } - if (x() + width() >= m_screenToFollow->geometry().x() + m_screenToFollow->geometry().width()) { - borders &= ~Plasma::FrameSvg::RightBorder; - } - if (y() <= m_screenToFollow->geometry().y()) { - borders &= ~Plasma::FrameSvg::TopBorder; - } - if (y() + height() >= m_screenToFollow->geometry().y() + m_screenToFollow->geometry().height()) { - borders &= ~Plasma::FrameSvg::BottomBorder; + if (x() <= m_screenToFollow->geometry().x()) { + borders &= ~Plasma::FrameSvg::LeftBorder; + } + if (x() + width() >= m_screenToFollow->geometry().x() + m_screenToFollow->geometry().width()) { + borders &= ~Plasma::FrameSvg::RightBorder; + } + if (y() <= m_screenToFollow->geometry().y()) { + borders &= ~Plasma::FrameSvg::TopBorder; + } + if (y() + height() >= m_screenToFollow->geometry().y() + m_screenToFollow->geometry().height()) { + borders &= ~Plasma::FrameSvg::BottomBorder; + } } - + if (m_enabledBorders != borders) { - - PanelShadows::self()->setEnabledBorders(this, borders); - + if (m_backgroundHints == Plasma::Types::NoBackground) { + PanelShadows::self()->removeWindow(this); + } else { + PanelShadows::self()->setEnabledBorders(this, borders); + } + m_enabledBorders = borders; emit enabledBordersChanged(); }