From 5288aa6e38b9d85b77e834701f705bd94b72beb3 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Fri, 17 Jan 2020 17:43:35 +0200 Subject: [PATCH] protect floating views appearance --floating views is a strange situation for which plasma theme do not have any way to be protected for their drawing (there is a chance that shadows and content overlap). Latte in order to protect from that situation now uses the auto-discovered plasma theme roundness to be used in order to calculate the minimum thicknes for panel background. --- containment/package/contents/ui/PanelBox.qml | 48 ++++++++++++++++---- containment/package/contents/ui/main.qml | 2 +- 2 files changed, 41 insertions(+), 9 deletions(-) diff --git a/containment/package/contents/ui/PanelBox.qml b/containment/package/contents/ui/PanelBox.qml index 30620aa7a..31ff2e47c 100644 --- a/containment/package/contents/ui/PanelBox.qml +++ b/containment/package/contents/ui/PanelBox.qml @@ -458,22 +458,54 @@ Item{ } } + Binding { + target: root + property: "panelThickMarginBase" + value: { + var minimum = root.screenEdgeMarginEnabled && themeExtended ? themeExtended.topEdgeRoundness : 0; + + if (root.useThemePanel){ + if (root.isVertical){ + if (plasmoid.location === PlasmaCore.Types.LeftEdge) { + return Math.max(minimum, solidBackground.margins.left); + } else if (plasmoid.location === PlasmaCore.Types.RightEdge) { + return Math.max(minimum, solidBackground.margins.right); + } + } else { + if (plasmoid.location === PlasmaCore.Types.BottomEdge) { + return Math.max(minimum, solidBackground.margins.bottom); + } else if (plasmoid.location === PlasmaCore.Types.TopEdge) { + return Math.max(minimum, solidBackground.margins.top); + } + } + } else { + return 0; + } + } + } + Binding { target: root property: "panelThickMarginHigh" value: { + var minimum = root.screenEdgeMarginEnabled && themeExtended ? themeExtended.topEdgeRoundness : 0; + if (root.useThemePanel){ if (root.isVertical){ - if (plasmoid.location === PlasmaCore.Types.LeftEdge) - return solidBackground.margins.right; - else if (plasmoid.location === PlasmaCore.Types.RightEdge) - return solidBackground.margins.left; + if (plasmoid.location === PlasmaCore.Types.LeftEdge) { + return Math.max(minimum, solidBackground.margins.right); + } else if (plasmoid.location === PlasmaCore.Types.RightEdge) { + return Math.max(minimum, solidBackground.margins.left); + } } else { - if (plasmoid.location === PlasmaCore.Types.BottomEdge) - return solidBackground.margins.top; - else if (plasmoid.location === PlasmaCore.Types.TopEdge) - return solidBackground.margins.bottom; + if (plasmoid.location === PlasmaCore.Types.BottomEdge) { + return Math.max(minimum, solidBackground.margins.top); + } else if (plasmoid.location === PlasmaCore.Types.TopEdge) { + return Math.max(minimum, solidBackground.margins.bottom); + } } + } else { + return 0; } } } diff --git a/containment/package/contents/ui/main.qml b/containment/package/contents/ui/main.qml index f379381c4..4a8c43b62 100644 --- a/containment/package/contents/ui/main.qml +++ b/containment/package/contents/ui/main.qml @@ -384,7 +384,7 @@ Item { } property int themePanelThickness: { - var panelBase = root.panelThickMarginHigh; + var panelBase = root.panelThickMarginHigh + root.panelThickMarginBase; var margin = shrinkThickMargins ? 0 : thickMargins + localScreenEdgeMargin; var maxPanelSize = (iconSize + margin) - panelBase; var percentage = Latte.WindowSystem.compositingActive ? plasmoid.configuration.panelSize/100 : 1;