From cad13372d642ea7bdaa7207b15fa058173439e73 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Thu, 1 Aug 2019 18:18:40 +0300 Subject: [PATCH] support touching horizontal view and isbusy --trying to increase smartness for horizontal and vertical views. In multiple layouts environment a view can exist in cases that one or more of the sided views that is touching it is NOT transparent, it would be nice for those cases the top or bottom view to LOSE also its transparency in order to not look inconsistent. --- app/view/view.cpp | 31 +++++++++++++++++++ app/view/view.h | 15 +++++++++ .../package/contents/ui/VisibilityManager.qml | 29 +++++++++++++++++ 3 files changed, 75 insertions(+) diff --git a/app/view/view.cpp b/app/view/view.cpp index 4e31f5b7f..e70c66176 100644 --- a/app/view/view.cpp +++ b/app/view/view.cpp @@ -655,6 +655,37 @@ void View::setLatteTasksArePresent(bool present) emit latteTasksArePresentChanged(); } +bool View::touchingBottomViewAndIsBusy() const +{ + return m_touchingBottomViewAndIsBusy; +} + +void View::setTouchingBottomViewAndIsBusy(bool touchAndBusy) +{ + if (m_touchingBottomViewAndIsBusy == touchAndBusy) { + return; + } + + m_touchingBottomViewAndIsBusy = touchAndBusy; + + emit touchingBottomViewAndIsBusyChanged(); +} + +bool View::touchingTopViewAndIsBusy() const +{ + return m_touchingTopViewAndIsBusy; +} + +void View::setTouchingTopViewAndIsBusy(bool touchAndBusy) +{ + if (m_touchingTopViewAndIsBusy == touchAndBusy) { + return; + } + + m_touchingTopViewAndIsBusy = touchAndBusy; + emit touchingTopViewAndIsBusyChanged(); +} + void View::preferredViewForShortcutsChangedSlot(Latte::View *view) { if (view != this) { diff --git a/app/view/view.h b/app/view/view.h index 1ab23b301..0983f0e37 100644 --- a/app/view/view.h +++ b/app/view/view.h @@ -86,6 +86,10 @@ class View : public PlasmaQuick::ContainmentView Q_PROPERTY(bool latteTasksArePresent READ latteTasksArePresent WRITE setLatteTasksArePresent NOTIFY latteTasksArePresentChanged) Q_PROPERTY(bool onPrimary READ onPrimary WRITE setOnPrimary NOTIFY onPrimaryChanged) + //! values to be used from Smart surrounding Views + Q_PROPERTY(bool touchingBottomViewAndIsBusy READ touchingBottomViewAndIsBusy WRITE setTouchingBottomViewAndIsBusy NOTIFY touchingBottomViewAndIsBusyChanged) + Q_PROPERTY(bool touchingTopViewAndIsBusy READ touchingTopViewAndIsBusy WRITE setTouchingTopViewAndIsBusy NOTIFY touchingTopViewAndIsBusyChanged) + Q_PROPERTY(int alignment READ alignment WRITE setAlignment NOTIFY alignmentChanged) Q_PROPERTY(int fontPixelSize READ fontPixelSize WRITE setFontPixelSize NOTIFY fontPixelSizeChanged) Q_PROPERTY(int x READ x NOTIFY xChanged) @@ -149,6 +153,12 @@ public: bool latteTasksArePresent() const; void setLatteTasksArePresent(bool present); + bool touchingBottomViewAndIsBusy() const; + void setTouchingBottomViewAndIsBusy(bool touchAndBusy); + + bool touchingTopViewAndIsBusy() const; + void setTouchingTopViewAndIsBusy(bool touchAndBusy); + float maxLength() const; void setMaxLength(float length); @@ -264,6 +274,8 @@ signals: void onPrimaryChanged(); void positionerChanged(); void screenGeometryChanged(); + void touchingBottomViewAndIsBusyChanged(); + void touchingTopViewAndIsBusyChanged(); void typeChanged(); void visibilityChanged(); void windowsTrackerChanged(); @@ -309,6 +321,9 @@ private: bool m_latteTasksArePresent{false}; bool m_onPrimary{true}; + bool m_touchingBottomViewAndIsBusy{false}; + bool m_touchingTopViewAndIsBusy{false}; + int m_fontPixelSize{ -1}; int m_editThickness{24}; int m_maxThickness{24}; diff --git a/containment/package/contents/ui/VisibilityManager.qml b/containment/package/contents/ui/VisibilityManager.qml index 3e5d72164..7edf09863 100644 --- a/containment/package/contents/ui/VisibilityManager.qml +++ b/containment/package/contents/ui/VisibilityManager.qml @@ -180,6 +180,34 @@ Item{ value: root.panelAlignment } + Binding{ + target: latteView + property: "touchingTopViewAndIsBusy" + when: latteView + value: { + var isTouchingTopScreenEdge = (latteView.y === latteView.screenGeometry.y); + var hasTopBorder = ((latteView.effects && (latteView.effects.enabledBorders & PlasmaCore.FrameSvg.TopBorder)) > 0); + + return root.isVertical && !isTouchingTopScreenEdge && !hasTopBorder && root.forcePanelForBusyBackground; + } + } + + Binding{ + target: latteView + property: "touchingBottomViewAndIsBusy" + when: latteView + value: { + var latteBottom = latteView.y + latteView.height; + var screenBottom = latteView.screenGeometry.y + latteView.screenGeometry.height; + var isTouchingBottomScreenEdge = (latteBottom === screenBottom); + + var hasBottomBorder = ((latteView.effects && (latteView.effects.enabledBorders & PlasmaCore.FrameSvg.BottomBorder)) > 0); + + return root.isVertical && !isTouchingBottomScreenEdge && !hasBottomBorder && root.forcePanelForBusyBackground; + } + } + + //! View::Effects bindings Binding{ target: latteView && latteView.effects ? latteView.effects : null property: "backgroundOpacity" @@ -240,6 +268,7 @@ Item{ } } + //! View::WindowsTracker bindings Binding{ target: latteView && latteView.windowsTracker ? latteView.windowsTracker : null property: "enabled"