1
0
mirror of https://github.com/KDE/latte-dock.git synced 2024-12-23 13:33:50 +03:00

change applets margins/paddings approach

This commit is contained in:
Michail Vourlakos 2020-12-25 13:17:12 +02:00
parent 96fd421e9f
commit 74d9065f1f
4 changed files with 63 additions and 16 deletions

View File

@ -1439,6 +1439,8 @@ bool View::event(QEvent *e)
positionAdjustedForContainment(me->windowPos()) + position(), positionAdjustedForContainment(me->windowPos()) + position(),
me->button(), me->buttons(), me->modifiers()); me->button(), me->buttons(), me->modifiers());
qDebug() << me->windowPos() << " => " << me2->windowPos() << " | " << m_padding->margins();
adjustedevent = me2; adjustedevent = me2;
} }
} }

View File

@ -51,12 +51,17 @@ Item{
property int animationSpeed: LatteCore.WindowSystem.compositingActive ? property int animationSpeed: LatteCore.WindowSystem.compositingActive ?
(root.editMode ? 400 : animations.speedFactor.normal * 1.62 * animations.duration.large) : 0 (root.editMode ? 400 : animations.speedFactor.normal * 1.62 * animations.duration.large) : 0
property bool inLocationAnimation: latteView && latteView.positioner && latteView.positioner.inLocationAnimation property bool inLocationAnimation: latteView && latteView.positioner && latteView.positioner.inLocationAnimation
property bool inSlidingIn: false //necessary because of its init structure property bool inSlidingIn: false //necessary because of its init structure
property alias inSlidingOut: slidingAnimationAutoHiddenOut.running property alias inSlidingOut: slidingAnimationAutoHiddenOut.running
property bool inRelocationHiding: false property bool inRelocationHiding: false
property bool inScreenEdgeInternalWindowSliding: root.behaveAsDockWithMask && hideThickScreenGap property bool inScreenEdgeInternalWindowSliding: root.behaveAsDockWithMask && hideThickScreenGap
readonly property bool inSliding: inSlidingIn || inSlidingOut || inRelocationHiding || inScreenEdgeInternalWindowSliding || inLocationAnimation
readonly property bool isSinkedEventEnabled: !(parabolic.isEnabled && animations.needBothAxis.count>0) && !inSlidingIn
property int length: root.isVertical ? Screen.height : Screen.width //screenGeometry.height : screenGeometry.width property int length: root.isVertical ? Screen.height : Screen.width //screenGeometry.height : screenGeometry.width
property int slidingOutToPos: { property int slidingOutToPos: {
@ -220,32 +225,68 @@ Item{
target: latteView.padding target: latteView.padding
property: "top" property: "top"
when: latteView when: latteView
value: plasmoid.formFactor === PlasmaCore.Types.Vertical && !parabolic.isEnabled ? value: {
background.paddings.top + Math.abs(metrics.padding.length) : 0 if (!isSinkedEventEnabled) {
return 0;
}
if (plasmoid.formFactor === PlasmaCore.Types.Vertical) {
return background.paddings.top + Math.abs(metrics.padding.length);
}
return metrics.margin.thickness;
}
} }
Binding{ Binding{
target: latteView.padding target: latteView.padding
property: "bottom" property: "bottom"
when: latteView when: latteView
value: plasmoid.formFactor === PlasmaCore.Types.Vertical && !parabolic.isEnabled ? value:{
background.paddings.bottom + Math.abs(metrics.padding.length) : 0 if (!isSinkedEventEnabled) {
return 0;
}
if (plasmoid.formFactor === PlasmaCore.Types.Vertical) {
return background.paddings.bottom + Math.abs(metrics.padding.length);
}
return metrics.margin.thickness;
}
} }
Binding{ Binding{
target: latteView.padding target: latteView.padding
property: "left" property: "left"
when: latteView when: latteView
value: plasmoid.formFactor === PlasmaCore.Types.Horizontal && !parabolic.isEnabled ? value: {
background.paddings.left + Math.abs(metrics.padding.length) : 0 if (!isSinkedEventEnabled) {
return 0;
}
if (plasmoid.formFactor === PlasmaCore.Types.Horizontal) {
return background.paddings.left + Math.abs(metrics.padding.length);
}
return metrics.margin.thickness;
}
} }
Binding{ Binding{
target: latteView.padding target: latteView.padding
property: "right" property: "right"
when: latteView when: latteView
value: plasmoid.formFactor === PlasmaCore.Types.Horizontal && !parabolic.isEnabled ? value: {
background.paddings.right + Math.abs(metrics.padding.length) : 0 if (!isSinkedEventEnabled) {
return 0;
}
if (plasmoid.formFactor === PlasmaCore.Types.Horizontal) {
return background.paddings.right + Math.abs(metrics.padding.length);
}
return metrics.margin.thickness;
}
} }
//! View::Effects bindings //! View::Effects bindings

View File

@ -658,7 +658,7 @@ Item {
appletItem.mousePressed(local.x, local.y, button); appletItem.mousePressed(local.x, local.y, button);
if (button === Qt.LeftButton && parabolic.isEnabled) { if (button === Qt.LeftButton && parabolic.isEnabled && animations.needBothAxis.count>0) {
/*Hack, until the sinked events plasma approach works propertly with parabolic effect*/ /*Hack, until the sinked events plasma approach works propertly with parabolic effect*/
appletItem.activateAppletForNeutralAreas(local); appletItem.activateAppletForNeutralAreas(local);
} }

View File

@ -221,7 +221,8 @@ Item{
return !root.inConfigureAppletsMode ? 0 : appletItem.metrics.iconSize; return !root.inConfigureAppletsMode ? 0 : appletItem.metrics.iconSize;
} }
if (communicator.parabolicEffectIsSupported && !communicator.inStartup/*avoid binding loops on startup*/) { // avoid binding loops on startup
if (communicator.parabolicEffectIsSupported && !communicator.inStartup) {
return appletPreferredThickness; return appletPreferredThickness;
} }
@ -325,6 +326,8 @@ Item{
return appletItem.screenEdgeMarginSupported ? 0 : appletItem.metrics.margin.screenEdge; return appletItem.screenEdgeMarginSupported ? 0 : appletItem.metrics.margin.screenEdge;
} }
readonly property int tailThicknessMargin: appliedEdgeMargin + (wrapper.zoomScaleThickness * metrics.margin.thickness)
Binding { Binding {
target: _wrapperContainer target: _wrapperContainer
property: "_thickness" property: "_thickness"
@ -334,7 +337,7 @@ Item{
return wrapper.layoutThickness; return wrapper.layoutThickness;
} }
var wrapperContainerThickness = wrapper.zoomScaleThickness * (appletItem.metrics.totals.thickness); var wrapperContainerThickness = wrapper.zoomScaleThickness * (metrics.iconSize/* appletItem.metrics.totals.thickness*/);
return appletItem.screenEdgeMarginSupported ? wrapperContainerThickness + appletItem.metrics.margin.screenEdge : wrapperContainerThickness; return appletItem.screenEdgeMarginSupported ? wrapperContainerThickness + appletItem.metrics.margin.screenEdge : wrapperContainerThickness;
} }
} }
@ -348,9 +351,10 @@ Item{
return wrapper.length; return wrapper.length;
} }
/*
if (appletItem.isInternalViewSplitter) { if (appletItem.isInternalViewSplitter) {
return wrapper.layoutLength; return wrapper.layoutLength;
} }*/
return wrapper.zoomScaleLength * wrapper.layoutLength; return wrapper.zoomScaleLength * wrapper.layoutLength;
} }
@ -436,7 +440,7 @@ Item{
} }
PropertyChanges{ PropertyChanges{
target: _wrapperContainer; target: _wrapperContainer;
anchors.leftMargin: 0; anchors.rightMargin: 0; anchors.topMargin:0; anchors.bottomMargin: _wrapperContainer.appliedEdgeMargin; anchors.leftMargin: 0; anchors.rightMargin: 0; anchors.topMargin:0; anchors.bottomMargin: _wrapperContainer.tailThicknessMargin
anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: 0; anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: 0;
} }
}, },
@ -451,7 +455,7 @@ Item{
} }
PropertyChanges{ PropertyChanges{
target: _wrapperContainer; target: _wrapperContainer;
anchors.leftMargin: 0; anchors.rightMargin: 0; anchors.topMargin: _wrapperContainer.appliedEdgeMargin; anchors.bottomMargin: 0; anchors.leftMargin: 0; anchors.rightMargin: 0; anchors.topMargin: _wrapperContainer.tailThicknessMargin; anchors.bottomMargin: 0;
anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: 0; anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: 0;
} }
}, },
@ -466,7 +470,7 @@ Item{
} }
PropertyChanges{ PropertyChanges{
target: _wrapperContainer; target: _wrapperContainer;
anchors.leftMargin: _wrapperContainer.appliedEdgeMargin; anchors.rightMargin: 0; anchors.topMargin:0; anchors.bottomMargin: 0; anchors.leftMargin: _wrapperContainer.tailThicknessMargin; anchors.rightMargin: 0; anchors.topMargin:0; anchors.bottomMargin: 0;
anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: 0; anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: 0;
} }
}, },
@ -481,7 +485,7 @@ Item{
} }
PropertyChanges{ PropertyChanges{
target: _wrapperContainer; target: _wrapperContainer;
anchors.leftMargin: 0; anchors.rightMargin: _wrapperContainer.appliedEdgeMargin; anchors.topMargin:0; anchors.bottomMargin: 0; anchors.leftMargin: 0; anchors.rightMargin: _wrapperContainer.tailThicknessMargin; anchors.topMargin:0; anchors.bottomMargin: 0;
anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: 0; anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: 0;
} }
} }