1
0
mirror of https://github.com/KDE/latte-dock.git synced 2024-12-25 09:33:51 +03:00

fix popup positioning for plasma-style popups

--consider the panel background roundness and position
positions only related to that roundness. This way the
plasma style popups that feel part of the panel background
are positioned properly always and they do not touch
in empty areas.
This commit is contained in:
Michail Vourlakos 2021-10-04 23:08:05 +03:00
parent c24cd92c98
commit 4ca17600c6
2 changed files with 26 additions and 2 deletions

View File

@ -232,8 +232,8 @@ Item {
if (root.behaveAsPlasmaPanel
|| !LatteCore.WindowSystem.compositingActive
|| (!parabolic.isEnabled && root.userShowPanelBackground && plasmoid.configuration.panelSize===100)) {
var paddingtail = (root.isHorizontal ? background.paddings.left : background.paddings.top) + background.tailRoundnessMargin;
var paddinghead = (root.isHorizontal ? background.paddings.right : background.paddings.bottom) + background.headRoundnessMargin;
var paddingtail = background.tailRoundness + background.tailRoundnessMargin;
var paddinghead = background.headRoundness + background.headRoundnessMargin;
if (root.isHorizontal) {
return Qt.rect(latteView.localGeometry.x + paddingtail,

View File

@ -190,6 +190,30 @@ BackgroundProperties{
return Math.max(background.length + totals.shadowsLength, totals.paddingsLength + totals.shadowsLength)
}
readonly property int tailRoundness: {
if ((root.isHorizontal && hasLeftBorder) || (!root.isHorizontal && hasTopBorder)) {
var customAppliedRadius = customRadiusIsEnabled ? customRadius : 0;
var themePadding = themeExtendedBackground ? (root.isHorizontal ? themeExtendedBackground.paddingLeft : themeExtendedBackground.paddingTop) : 0;
var solidBackgroundPadding = root.isHorizontal ? solidBackground.margins.left : solidBackground.margins.top;
var expected = customRadiusIsEnabled ? customAppliedRadius : Math.max(themePadding, solidBackgroundPadding);
return Math.max(0, expected - metrics.margin.length);
}
return 0;
}
readonly property int headRoundness: {
if ((root.isHorizontal && hasRightBorder) || (!root.isHorizontal && hasBottomBorder)) {
var customAppliedRadius = customRadiusIsEnabled ? customRadius : 0;
var themePadding = themeExtendedBackground ? (root.isHorizontal ? themeExtendedBackground.paddingRight : themeExtendedBackground.paddingBottom) : 0;
var solidBackgroundPadding = root.isHorizontal ? solidBackground.margins.right : solidBackground.margins.bottom;
var expected = customRadiusIsEnabled ? customAppliedRadius : Math.max(themePadding, solidBackgroundPadding);
return Math.max(0, expected - metrics.margin.length);
}
return 0;
}
readonly property int tailRoundnessMargin: {
//! used from contents geometry in order to remove any roundness sectors, e.g. for popups placement
if (root.isHorizontal) {