From 60f488f3a168e0967cbfdfd2773715cf5d0a7b25 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Tue, 28 Aug 2018 13:49:32 +0300 Subject: [PATCH] dont draw panel shadows when theme doesnot provide when the plasma theme was not supporting shadows then Latte was double drawing the panel background when the user has chosen that wanted shadows BUG: 397980 FIXED-IN: 0.8.1 (cherry picked from commit 87094a6fe7c23de7cb14be1237ccaf1fba28d25e) --- app/dock/dockview.cpp | 5 +++++ app/dock/dockview.h | 4 ++++ containment/package/contents/ui/PanelBox.qml | 6 ++++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/app/dock/dockview.cpp b/app/dock/dockview.cpp index 6f6cd6137..da3264929 100644 --- a/app/dock/dockview.cpp +++ b/app/dock/dockview.cpp @@ -221,6 +221,7 @@ void DockView::init() connect(this, &DockView::effectsAreaChanged, this, &DockView::updateEffects); connect(&m_theme, &Plasma::Theme::themeChanged, this, &DockView::themeChanged); + connect(&m_theme, &Plasma::Theme::themeChanged, this, &DockView::themeHasShadowChanged); connect(this, &DockView::normalThicknessChanged, this, [&]() { if (m_behaveAsPlasmaPanel) { @@ -1288,6 +1289,10 @@ void DockView::setMaskArea(QRect area) emit maskAreaChanged(); } +bool DockView::themeHasShadow() const +{ + return PanelShadows::self()->enabled(); +} QRect DockView::effectsArea() const { diff --git a/app/dock/dockview.h b/app/dock/dockview.h index 7c4815f58..4d1217f71 100644 --- a/app/dock/dockview.h +++ b/app/dock/dockview.h @@ -71,6 +71,7 @@ class DockView : public PlasmaQuick::ContainmentView //! Because Latte uses animations, changing to edit mode it may be different than //! when the isUserConfiguring changes value Q_PROPERTY(bool inEditMode READ inEditMode WRITE setInEditMode NOTIFY inEditModeChanged) + Q_PROPERTY(bool themeHasShadow READ themeHasShadow NOTIFY themeHasShadowChanged) Q_PROPERTY(bool onPrimary READ onPrimary WRITE setOnPrimary NOTIFY onPrimaryChanged) Q_PROPERTY(int alignment READ alignment WRITE setAlignment NOTIFY alignmentChanged) @@ -148,6 +149,8 @@ public: bool inEditMode() const; void setInEditMode(bool edit); + bool themeHasShadow() const; + float maxLength() const; void setMaxLength(float length); @@ -293,6 +296,7 @@ signals: void screenGeometryChanged(); void shadowChanged(); void themeChanged(); + void themeHasShadowChanged(); void totalDocksCountChanged(); void xChanged(); void yChanged(); diff --git a/containment/package/contents/ui/PanelBox.qml b/containment/package/contents/ui/PanelBox.qml index 0937cbe15..183db2a30 100644 --- a/containment/package/contents/ui/PanelBox.qml +++ b/containment/package/contents/ui/PanelBox.qml @@ -138,9 +138,9 @@ Item{ panelSize + marginsHeight - (solidBackground.topIncreaser + solidBackground.bottomIncreaser) imagePath: root.behaveAsPlasmaPanel || !Latte.WindowSystem.compositingActive - || !root.panelShadowsActive ? "" : "widgets/panel-background" + || !root.panelShadowsActive || !themeHasShadow ? "" : "widgets/panel-background" prefix: root.behaveAsPlasmaPanel || !Latte.WindowSystem.compositingActive - || !root.panelShadowsActive ? "" : "shadow" + || !root.panelShadowsActive || !themeHasShadow ? "" : "shadow" visible: (opacity == 0) ? false : true @@ -153,6 +153,8 @@ Item{ enabledBorders: dock ? dock.enabledBorders : PlasmaCore.FrameSvg.NoBorder + property bool themeHasShadow: dock ? dock.themeHasShadow : false + Behavior on opacity { enabled: Latte.WindowSystem.compositingActive NumberAnimation { duration: barLine.animationTime }