1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-01-14 09:18:06 +03:00

fix dock view geometry calculations

--when background custom radius and shadow
are applied the dock window geometry shouldnot
change if these values are not altered. This
is especially true when a dock is hiding
its screen edge margin when there is a maximized
window and the same time is hiding also its
background shadows. In such case in the past because
shadows were temporarily disabled the dock was constantly
changing its geometry
This commit is contained in:
Michail Vourlakos 2020-08-22 20:59:52 +03:00
parent dae99ea8a2
commit 8298bf0e2c
4 changed files with 27 additions and 15 deletions
containment/package/contents/ui

@ -82,6 +82,8 @@ Item{
return plasmoid.configuration.screenEdgeMargin;
}
property int maxScreenEdgeMargin: root.behaveAsDockWithMask ? Math.max(0, plasmoid.configuration.screenEdgeMargin) : 0
property int thicknessAutoHidden: LatteCore.WindowSystem.compositingActive ? 2 : 1
property int thicknessMid: finalScreenEdgeMargin + (1 + (0.65 * (parabolic.factor.maxZoom-1)))*(metrics.totals.thickness+extraZoomThickMask) //needed in some animations
property int thicknessNormal: finalScreenEdgeMargin + Math.max(metrics.totals.thickness + extraNormalThickMask, background.thickness + background.shadows.headThickness)
@ -94,7 +96,7 @@ Item{
thicknessNormalOriginalValue : background.thickness + background.shadows.headThickness*/
property int thicknessNormalOriginalValue: finalScreenEdgeMargin + metrics.maxIconSize + (metrics.margin.maxThickness * 2) + extraNormalThickMask
property int thicknessZoomOriginal: finalScreenEdgeMargin + Math.max( ((metrics.maxIconSize+(metrics.margin.maxThickness * 2)) * parabolic.factor.maxZoom) + extraZoomThickMask,
property int thicknessZoomOriginal: maxScreenEdgeMargin + Math.max( ((metrics.maxIconSize+(metrics.margin.maxThickness * 2)) * parabolic.factor.maxZoom) + extraZoomThickMask,
background.thickness + background.shadows.headThickness)
//! when Latte behaves as Plasma panel

@ -57,10 +57,10 @@ BackgroundProperties{
shadows.top: hasTopBorder ? (customShadowIsEnabled ? customShadow : shadowsSvgItem.margins.top) : 0
shadows.bottom: hasBottomBorder ? (customShadowIsEnabled ? customShadow : shadowsSvgItem.margins.bottom) : 0
shadows.fixedLeft: customShadowIsEnabled ? customShadow : shadowsSvgItem.fixedMargins.left
shadows.fixedRight: customShadowIsEnabled ? customShadow : shadowsSvgItem.fixedMargins.right
shadows.fixedTop: customShadowIsEnabled ? customShadow : shadowsSvgItem.fixedMargins.top
shadows.fixedBottom: customShadowIsEnabled ? customShadow : shadowsSvgItem.fixedMargins.bottom
shadows.fixedLeft: (customDefShadowIsEnabled || customUserShadowIsEnabled) ? customShadow : shadowsSvgItem.fixedMargins.left
shadows.fixedRight: (customDefShadowIsEnabled || customUserShadowIsEnabled) ? customShadow : shadowsSvgItem.fixedMargins.right
shadows.fixedTop: (customDefShadowIsEnabled || customUserShadowIsEnabled) ? customShadow : shadowsSvgItem.fixedMargins.top
shadows.fixedBottom: (customDefShadowIsEnabled || customUserShadowIsEnabled) ? customShadow : shadowsSvgItem.fixedMargins.bottom
//! it can accept negative values in DockMode
screenEdgeMargin: root.screenEdgeMarginEnabled ? metrics.margin.screenEdge - shadows.tailThickness : -shadows.tailThickness
@ -165,12 +165,14 @@ BackgroundProperties{
property int animationTime: 6*animations.speedFactor.current*animations.duration.small
//! CustomShadowedRectangle properties
readonly property bool customShadowedRectangleIsEnabled: customRadiusIsEnabled || customShadowIsEnabled
readonly property bool customShadowedRectangleIsEnabled: customRadiusIsEnabled || (customDefShadowIsEnabled || customUserShadowIsEnabled)
readonly property bool customShadowIsSupported: LatteCore.WindowSystem.compositingActive
&& kirigamiLibraryIsFound
&& panelShadowsActive
readonly property bool customShadowIsEnabled: customDefShadowIsEnabled || customUserShadowIsEnabled
//!current shadow state but do not change other values of normal mode, for example if a Dock hides its screen edge thickness
//!shouldnt change the fact that customShadowedRectangle is still used
readonly property bool customShadowIsEnabled: (customDefShadowIsEnabled || customUserShadowIsEnabled) && panelShadowsActive
readonly property bool customDefShadowIsEnabled: customShadowIsSupported && !customUserShadowIsEnabled && customRadiusIsEnabled
readonly property bool customUserShadowIsEnabled: customShadowIsSupported && plasmoid.configuration.backgroundShadowSize >= 0

@ -46,14 +46,18 @@ QtObject{
}
readonly property int headThickness: {
if (plasmoid.location === PlasmaCore.Types.LeftEdge) {
return right;
} else if (plasmoid.location === PlasmaCore.Types.RightEdge) {
return left;
} else if (plasmoid.location === PlasmaCore.Types.TopEdge) {
return bottom;
if (!backgroundShadowsInRegularStateEnabled) {
return 0;
}
return top;
if (plasmoid.location === PlasmaCore.Types.LeftEdge) {
return fixedRight;
} else if (plasmoid.location === PlasmaCore.Types.RightEdge) {
return fixedLeft;
} else if (plasmoid.location === PlasmaCore.Types.TopEdge) {
return fixedBottom;
}
return fixedTop;
}
}

@ -303,6 +303,10 @@ Item {
property int panelEdgeSpacing: Math.max(background.lengthMargins, 1.5*appShadowSize)
property int panelTransparency: plasmoid.configuration.panelTransparency //user set
property bool backgroundShadowsInRegularStateEnabled: LatteCore.WindowSystem.compositingActive
&& userShowPanelBackground
&& plasmoid.configuration.panelShadows
property bool panelShadowsActive: {
if (!userShowPanelBackground) {
return false;