diff --git a/app/view/effects.cpp b/app/view/effects.cpp index 94d91c5c0..34bc21ccb 100644 --- a/app/view/effects.cpp +++ b/app/view/effects.cpp @@ -333,6 +333,23 @@ void Effects::setInputMask(QRect area) emit inputMaskChanged(); } +QRect Effects::appletsLayoutGeometry() const +{ + return m_appletsLayoutGeometry; +} + +void Effects::setAppletsLayoutGeometry(const QRect &geom) +{ + if (m_appletsLayoutGeometry == geom) { + return; + } + + m_appletsLayoutGeometry = geom; + m_view->setProperty("_applets_layout_geometry", QVariant(m_appletsLayoutGeometry)); + + emit appletsLayoutGeometryChanged(); +} + void Effects::forceMaskRedraw() { if (m_background) { diff --git a/app/view/effects.h b/app/view/effects.h index 028f9c0b1..569d6d83a 100644 --- a/app/view/effects.h +++ b/app/view/effects.h @@ -60,6 +60,7 @@ class Effects: public QObject Q_PROPERTY(QRect mask READ mask WRITE setMask NOTIFY maskChanged) Q_PROPERTY(QRect rect READ rect WRITE setRect NOTIFY rectChanged) Q_PROPERTY(QRect inputMask READ inputMask WRITE setInputMask NOTIFY inputMaskChanged) + Q_PROPERTY(QRect appletsLayoutGeometry READ appletsLayoutGeometry WRITE setAppletsLayoutGeometry NOTIFY appletsLayoutGeometryChanged) Q_PROPERTY(Plasma::FrameSvg::EnabledBorders enabledBorders READ enabledBorders NOTIFY enabledBordersChanged) @@ -106,6 +107,9 @@ public: QRect rect() const; void setRect(QRect area); + QRect appletsLayoutGeometry() const; + void setAppletsLayoutGeometry(const QRect &geom); + Plasma::FrameSvg::EnabledBorders enabledBorders() const; public slots: @@ -123,6 +127,7 @@ public slots: signals: void animationsBlockedChanged(); + void appletsLayoutGeometryChanged(); void backgroundAllCornersChanged(); void backgroundCornersMaskChanged(); void backgroundOpacityChanged(); @@ -179,6 +184,7 @@ private: QRect m_rect; QRect m_mask; QRect m_inputMask; + QRect m_appletsLayoutGeometry; QPointer m_view; QPointer m_corona; diff --git a/containment/package/contents/ui/VisibilityManager.qml b/containment/package/contents/ui/VisibilityManager.qml index 648524646..5c74f18d0 100644 --- a/containment/package/contents/ui/VisibilityManager.qml +++ b/containment/package/contents/ui/VisibilityManager.qml @@ -284,6 +284,37 @@ Item{ value: background.shadows.headThickness } + Binding{ + target: latteView && latteView.effects ? latteView.effects : null + property:"appletsLayoutGeometry" + when: latteView && latteView.effects && manager.inNormalState + value: { + if (root.behaveAsPlasmaPanel + || (!parabolic.isEnabled && root.userShowPanelBackground && plasmoid.configuration.panelSize===100)) { + if (myView.alignment === LatteCore.Types.Justify) { + if (root.isHorizontal) { + return Qt.rect(layoutsContainer.x + layoutsContainer.backgroundTailLength, + layoutsContainer.y, + layoutsContainer.width - layoutsContainer.backgroundShadowHeadLength - layoutsContainer.backgroundTailLength, + layoutsContainer.height); + } else { + return Qt.rect(layoutsContainer.x, + layoutsContainer.y + layoutsContainer.backgroundTailLength, + layoutsContainer.width, + layoutsContainer.height - layoutsContainer.backgroundShadowHeadLength - layoutsContainer.backgroundTailLength); + } + } else { + return Qt.rect(layoutsContainer.mainLayout.x, + layoutsContainer.mainLayout.y, + layoutsContainer.mainLayout.width, + layoutsContainer.mainLayout.height) + } + } + + return Qt.rect(-1, -1, 0, 0); + } + } + //! View::Positioner bindings Binding{ target: latteView && latteView.positioner ? latteView.positioner : null diff --git a/containment/package/contents/ui/abilities/MyView.qml b/containment/package/contents/ui/abilities/MyView.qml index 5b1977156..7eaf3099a 100644 --- a/containment/package/contents/ui/abilities/MyView.qml +++ b/containment/package/contents/ui/abilities/MyView.qml @@ -54,6 +54,7 @@ Ability.MyViewPrivate { lastUsedActivity: view && view.layout ? view.layout.lastUsedActivity : "" + appletsLayoutGeometry: view && view.effects ? view.effects.appletsLayoutGeometry : Qt.rect(0, 0, -1, -1) screenGeometry: view ? view.screenGeometry : plasmoid.screenGeometry containmentActions: isReady ? view.containmentActions : [] diff --git a/declarativeimports/abilities/definition/MyView.qml b/declarativeimports/abilities/definition/MyView.qml index f964c742a..3aac51961 100644 --- a/declarativeimports/abilities/definition/MyView.qml +++ b/declarativeimports/abilities/definition/MyView.qml @@ -53,6 +53,7 @@ Item { property string lastUsedActivity: "" + property rect appletsLayoutGeometry: Qt.rect(-1, -1, 0, 0) property rect screenGeometry: Qt.rect(0, 0, 1600, 1080) property var containmentActions: [] diff --git a/declarativeimports/abilities/host/MyView.qml b/declarativeimports/abilities/host/MyView.qml index 7252875a2..01148692f 100644 --- a/declarativeimports/abilities/host/MyView.qml +++ b/declarativeimports/abilities/host/MyView.qml @@ -61,6 +61,7 @@ AbilityDefinition.MyView { readonly property alias lastUsedActivity: apis.lastUsedActivity + readonly property alias appletsLayoutGeometry: apis.appletsLayoutGeometry readonly property alias screenGeometry: apis.screenGeometry readonly property alias containmentActions: apis.containmentActions diff --git a/declarativeimports/core/dialog.cpp b/declarativeimports/core/dialog.cpp index eaefc7a9f..1e23beade 100644 --- a/declarativeimports/core/dialog.cpp +++ b/declarativeimports/core/dialog.cpp @@ -62,6 +62,17 @@ void Dialog::setEdge(const Plasma::Types::Location &edge) emit edgeChanged(); } +bool Dialog::isRespectingAppletsLayoutGeometry() const +{ + //! As it appears plasma applets popups are defining their popups to Normal window. + return (type() == Dialog::Normal || type() == Dialog::PopupMenu); +} + +QRect Dialog::appletsLayoutGeometryFromContainment() const +{ + QVariant geom = visualParent() && visualParent()->window() ? visualParent()->window()->property("_applets_layout_geometry") : QVariant(); + return geom.isValid() ? geom.toRect() : QRect(); +} void Dialog::adjustGeometry(const QRect &geom) { @@ -100,6 +111,28 @@ void Dialog::adjustGeometry(const QRect &geom) x = qBound(screengeometry.x(), x, screengeometry.right()-1); y = qBound(screengeometry.y(), y, screengeometry.bottom()-1); + QRect appletslayoutgeometry = appletsLayoutGeometryFromContainment(); + + if (isRespectingAppletsLayoutGeometry() && !appletslayoutgeometry.isEmpty()) { + QPoint appletsglobaltopleft = visualparent->window()->mapToGlobal(appletslayoutgeometry.topLeft()); + + QRect appletsglobalgeometry(appletsglobaltopleft.x(), appletsglobaltopleft.y(), appletslayoutgeometry.width(), appletslayoutgeometry.height()); + + if (m_edge == Plasma::Types::LeftEdge || m_edge == Plasma::Types::RightEdge) { + int bottomy = appletsglobalgeometry.bottom()-geom.height(); + + if (appletsglobalgeometry.height() >= geom.height()) { + y = qBound(appletsglobalgeometry.y(), y, bottomy + 1); + } + } else { + int rightx = appletsglobalgeometry.right()-geom.width(); + + if (appletsglobalgeometry.width() >= geom.width()) { + x = qBound(appletsglobalgeometry.x(), x, rightx + 1); + } + } + } + QRect repositionedrect(x, y, geom.width(), geom.height()); setGeometry(repositionedrect); return; diff --git a/declarativeimports/core/dialog.h b/declarativeimports/core/dialog.h index a7848b1a3..1ca1db2c9 100644 --- a/declarativeimports/core/dialog.h +++ b/declarativeimports/core/dialog.h @@ -35,9 +35,7 @@ class Dialog : public PlasmaQuick::Dialog { Q_OBJECT Q_PROPERTY (bool containsMouse READ containsMouse NOTIFY containsMouseChanged) - /** - * Plasma Location of the dialog window. Useful if this dialog is a popup for a panel - */ + //! it is used instead of location property in order to not break borders drawing Q_PROPERTY(Plasma::Types::Location edge READ edge WRITE setEdge NOTIFY edgeChanged) public: @@ -60,6 +58,10 @@ protected: private slots: void setContainsMouse(bool contains); +private: + bool isRespectingAppletsLayoutGeometry() const; + QRect appletsLayoutGeometryFromContainment() const; + private: bool m_containsMouse{false}; diff --git a/plasmoid/package/contents/ui/main.qml b/plasmoid/package/contents/ui/main.qml index 93ab58a35..6d06a399d 100644 --- a/plasmoid/package/contents/ui/main.qml +++ b/plasmoid/package/contents/ui/main.qml @@ -890,7 +890,9 @@ Item { target: icList - property int maxThickness: (appletAbilities.parabolic.isHovered || windowPreviewIsShown || appletAbilities.animations.hasThicknessAnimation) ? + property int maxThickness: ((appletAbilities.parabolic.isEnabled && appletAbilities.parabolic.isHovered) + || (appletAbilities.parabolic.isEnabled && windowPreviewIsShown) + || appletAbilities.animations.hasThicknessAnimation) ? appletAbilities.metrics.mask.thickness.maxZoomedForItems : // dont clip bouncing tasks when zoom=1 appletAbilities.metrics.mask.thickness.normalForItems