support Outline option for compositing mode

--works much better than I was expecting and at the
same time it simplifies the PanelBox code a lot
pull/5/head
Michail Vourlakos 6 years ago
parent 3666ab42db
commit f3f6dccf65

@ -75,7 +75,7 @@
<entry name="panelTransparency" type="Int">
<default>100</default>
</entry>
<entry name="solidPanel" type="Bool">
<entry name="panelOutline" type="Bool">
<default>false</default>
</entry>
<entry name="blurEnabled" type="Bool">

@ -135,10 +135,8 @@ Item{
PlasmaCore.FrameSvgItem{
id: shadowsSvgItem
width: root.isVertical ? panelSize + marginsWidth - (solidBackground.leftIncreaser + solidBackground.rightIncreaser) :
Math.min(parent.width + marginsWidth, root.width - marginsWidth)
height: root.isVertical ? Math.min(parent.height + marginsHeight, root.height - marginsHeight) :
panelSize + marginsHeight - (solidBackground.topIncreaser + solidBackground.bottomIncreaser)
width: root.isVertical ? panelSize + marginsWidth : Math.min(parent.width + marginsWidth, root.width - marginsWidth)
height: root.isVertical ? Math.min(parent.height + marginsHeight, root.height - marginsHeight) : panelSize + marginsHeight
imagePath: hideShadow ? "" : "widgets/panel-background"
prefix: hideShadow ? "" : "shadow"
@ -313,6 +311,7 @@ Item{
opacity: solidBackground.opacity
backgroundColor: colorizerManager.backgroundColor
roundness: overlayedBackground.roundness
visible: Latte.WindowSystem.compositingActive
Behavior on opacity{
enabled: Latte.WindowSystem.compositingActive
@ -327,10 +326,10 @@ Item{
PlasmaCore.FrameSvgItem{
id: solidBackground
anchors.leftMargin: Latte.WindowSystem.compositingActive ? shadowsSvgItem.margins.left - leftIncreaser : 0
anchors.rightMargin: Latte.WindowSystem.compositingActive ? shadowsSvgItem.margins.right - rightIncreaser : 0
anchors.topMargin: Latte.WindowSystem.compositingActive ? shadowsSvgItem.margins.top - topIncreaser : 0
anchors.bottomMargin: Latte.WindowSystem.compositingActive ? shadowsSvgItem.margins.bottom - bottomIncreaser : 0
anchors.leftMargin: Latte.WindowSystem.compositingActive ? shadowsSvgItem.margins.left : 0
anchors.rightMargin: Latte.WindowSystem.compositingActive ? shadowsSvgItem.margins.right : 0
anchors.topMargin: Latte.WindowSystem.compositingActive ? shadowsSvgItem.margins.top : 0
anchors.bottomMargin: Latte.WindowSystem.compositingActive ? shadowsSvgItem.margins.bottom : 0
anchors.fill:parent
opacity: {
@ -347,7 +346,7 @@ Item{
property rect efGeometry: Qt.rect(-1,-1,0,0)
imagePath: root.solidStylePanel ? "opaque/dialogs/background" : "widgets/panel-background"
imagePath: Latte.WindowSystem.compositingActive ? "widgets/panel-background" : "opaque/dialogs/background"
onWidthChanged: updateEffectsArea();
onHeightChanged: updateEffectsArea();
@ -361,6 +360,8 @@ Item{
root.updateEffectsArea.disconnect(updateEffectsArea);
}
onImagePathChanged: solidBackground.adjustPrefix();
Binding{
target: root
property: "currentPanelTransparency"
@ -375,10 +376,6 @@ Item{
solidBackground.updateEffectsArea();
}
}
onSolidStylePanelChanged: {
solidBackground.adjustPrefix();
}
}
//! Fix for FrameSvgItem QML version not updating its margins after a theme change
@ -417,41 +414,6 @@ Item{
}
}
//! the increases used when the user forces a solid background and the background
//! must be increased in order to look ok in the corners
property int rightIncreaser: {
if (!(root.solidStylePanel && root.isVertical && plasmoid.location === PlasmaCore.Types.LeftEdge)
|| !Latte.WindowSystem.compositingActive)
return 0;
else
return hiddenPanelBackground.margins.right;
}
property int leftIncreaser: {
if (!(root.solidStylePanel && root.isVertical && plasmoid.location === PlasmaCore.Types.RightEdge)
|| !Latte.WindowSystem.compositingActive)
return 0;
else
return hiddenPanelBackground.margins.left;
}
property int topIncreaser: {
if (!(root.solidStylePanel && root.isVertical && plasmoid.location === PlasmaCore.Types.BottomEdge)
|| !Latte.WindowSystem.compositingActive)
return 0;
else
return hiddenPanelBackground.margins.top;
}
property int bottomIncreaser: {
if (!(root.solidStylePanel && root.isVertical && plasmoid.location === PlasmaCore.Types.TopEdge)
|| !Latte.WindowSystem.compositingActive)
return 0;
else
return hiddenPanelBackground.margins.bottom;
}
Binding {
target: root
property: "panelThickMarginHigh"
@ -564,6 +526,18 @@ Item{
}
}
//! Outline drawing
Loader{
anchors.fill: solidBackground
active: root.panelOutline && Latte.WindowSystem.compositingActive
sourceComponent: Colorizer.CustomBackground{
backgroundColor: "transparent"
borderColor: colorizerManager.outlineColor
borderWidth: 1
roundness: overlayedBackground.roundness
}
}
//! CustomBackground debugger
/*Colorizer.CustomBackground {
anchors.fill: solidBackground
@ -572,12 +546,6 @@ Item{
borderColor: "red"
roundness: overlayedBackground.roundness
}*/
PlasmaCore.FrameSvgItem{
id: hiddenPanelBackground
imagePath: "widgets/panel-background"
visible: false
}
}
transitions: Transition {

@ -103,16 +103,18 @@ Item{
width: {
if (plasmoid.formFactor === PlasmaCore.Types.Horizontal) {
if (drawWithoutRoundness || noOfBorders === 3) {
return parent.width;
if (drawWithoutRoundness) {
return parent.width + 2*borderWidth;
} else if (noOfBorders === 2) {
return parent.width + roundness;
return parent.width + Math.max(roundness,borderWidth);
} else if (noOfBorders === 3) {
return parent.width;
}
} else if (plasmoid.formFactor === PlasmaCore.Types.Vertical) {
if (drawWithoutRoundness) {
return parent.width + borderWidth;
} else if (noOfBorders === 2 || noOfBorders === 3) {
return parent.width + roundness;
return parent.width + Math.max(roundness,borderWidth);
}
}
}
@ -123,13 +125,15 @@ Item{
if (drawWithoutRoundness) {
return parent.height + borderWidth;
} else if (noOfBorders === 2 || noOfBorders === 3) {
return parent.height + roundness;
return parent.height + Math.max(roundness,borderWidth);
}
} else if (plasmoid.formFactor === PlasmaCore.Types.Vertical) {
if (drawWithoutRoundness || noOfBorders === 3) {
return parent.height;
if (drawWithoutRoundness) {
return parent.height + 2*borderWidth;
} else if (noOfBorders === 2) {
return parent.height + roundness;
return parent.height + Math.max(roundness,borderWidth);
} else if (noOfBorders === 3) {
return parent.height;
}
}
}
@ -139,7 +143,7 @@ Item{
border.width: main.borderWidth
border.color: main.borderColor
readonly property int centerStep: Math.max( (drawWithoutRoundness ? 0 : roundness), 2*borderWidth) / 2
readonly property int centerStep: Math.max(Math.ceil((drawWithoutRoundness ? 0 : roundness) / 2) , borderWidth)
states: [
State {

@ -34,8 +34,10 @@ Loader{
readonly property bool backgroundIsBusy: item ? item.isBusy : false
readonly property real themeTextColorBrightness: ColorizerTools.colorBrightness(theme.textColor)
readonly property color minimizedDotColor: themeTextColorBrightness > 127.5 ? Qt.darker(theme.textColor, 1.7) : Qt.lighter(theme.textColor, 7)
readonly property real themeTextColorBrightness: ColorizerTools.colorBrightness(textColor)
readonly property real backgroundColorBrightness: ColorizerTools.colorBrightness(backgroundColor)
readonly property color minimizedDotColor: themeTextColorBrightness > 127.5 ? Qt.darker(textColor, 1.7) : Qt.lighter(textColor, 7)
readonly property color outlineColor: backgroundColorBrightness > 127.5 ? Qt.darker(backgroundColor, 1.3) : Qt.lighter(backgroundColor, 2)
readonly property bool mustBeShown: (applyTheme && applyTheme !== theme)

@ -78,7 +78,7 @@ DragDrop.DropArea {
return (visibilityManager.panelIsBiggerFromIconSize && (maxZoomFactor === 1.0)
&& (latteView.visibility.mode === Latte.Types.AlwaysVisible || latteView.visibility.mode === Latte.Types.WindowsGoBelow)
&& (plasmoid.configuration.panelPosition === Latte.Types.Justify) && !(root.solidStylePanel && panelShadowsActive));
&& (plasmoid.configuration.panelPosition === Latte.Types.Justify));
}
property int viewType: {
@ -166,7 +166,6 @@ DragDrop.DropArea {
property bool showAppletShortcutBadges: false
property bool showMetaBadge: false
property int applicationLauncherId: -1
property bool solidStylePanel: Latte.WindowSystem.compositingActive ? plasmoid.configuration.solidPanel : true
//FIXME: possibly this is going to be the default behavior, this user choice
//has been dropped from the Dock Configuration Window
@ -220,6 +219,7 @@ DragDrop.DropArea {
property int modifierClickAction: plasmoid.configuration.modifierClickAction
property int modifierClick: plasmoid.configuration.modifierClick
property bool panelOutline: plasmoid.configuration.panelOutline
property int panelEdgeSpacing: Math.max(panelBoxBackground.lengthMargins, 1.5*appShadowSize)
property int panelTransparency: plasmoid.configuration.panelTransparency //user set
property int currentPanelTransparency: 0 //application override

@ -870,14 +870,14 @@ PlasmaComponents.Page {
PlasmaComponents.Button {
id: solidBackground
Layout.fillWidth: true
text: i18n("Solid Style")
checked: plasmoid.configuration.solidPanel
text: i18n("Outline")
checked: plasmoid.configuration.panelOutline
checkable: true
enabled: showBackground.checked
tooltip: i18n("Background uses a solid style image provided from plasma theme")
enabled: showBackground.checked && Latte.WindowSystem.compositingActive
tooltip: i18n("Background draws a line for its borders. You can set the line size from Latte Preferences")
onClicked: {
plasmoid.configuration.solidPanel = checked
plasmoid.configuration.panelOutline = !plasmoid.configuration.panelOutline;
}
}
}

Loading…
Cancel
Save