From 54ea58c215d4bf75ccd529693fc52c49b34d5f6b Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Sat, 16 May 2020 18:58:29 +0300 Subject: [PATCH] remove deprecated Effects subtracted implementatio --- app/view/effects.cpp | 96 +------------------ app/view/effects.h | 9 -- .../package/contents/ui/VisibilityManager.qml | 16 ---- 3 files changed, 1 insertion(+), 120 deletions(-) diff --git a/app/view/effects.cpp b/app/view/effects.cpp index a1401edbb..875ac3350 100644 --- a/app/view/effects.cpp +++ b/app/view/effects.cpp @@ -24,7 +24,6 @@ #include #include "panelshadows_p.h" #include "view.h" -#include "settings/primaryconfigview.h" // Qt #include @@ -54,7 +53,6 @@ void Effects::init() connect(this, &Effects::drawEffectsChanged, this, &Effects::updateEffects); connect(this, &Effects::enabledBordersChanged, this, &Effects::updateEffects); connect(this, &Effects::rectChanged, this, &Effects::updateEffects); - connect(this, &Effects::settingsMaskSubtractedChanged, this, &Effects::updateMask); connect(this, &Effects::drawShadowsChanged, this, [&]() { if (m_view->behaveAsPlasmaPanel()) { @@ -201,98 +199,6 @@ void Effects::setInnerShadow(int shadow) emit innerShadowChanged(); } -bool Effects::settingsMaskSubtracted() const -{ - return m_settingsMaskSubtracted; -} - -void Effects::setSettingsMaskSubtracted(bool enabled) -{ - if (m_settingsMaskSubtracted == enabled) { - return; - } - - m_settingsMaskSubtracted = enabled; - - emit settingsMaskSubtractedChanged(); -} - -QRegion Effects::subtrackedMaskFromWindow(QRegion initialRegion, QQuickView *window) -{ - QRegion subtractedMask = initialRegion; - - int start; - int length; - - if (m_view->formFactor() == Plasma::Types::Horizontal) { - if (KWindowSystem::isPlatformX11()) { - start = window->x(); - length = window->width(); - } else { - start = m_view->x(); - length = m_view->width(); - } - } else { - if (KWindowSystem::isPlatformX11()) { - start = window->y(); - length = window->height(); - } else { - start = m_view->y(); - length = m_view->height(); - } - } - - if (m_settingsMaskSubtracted && window) { - QRect windowMask; - //! we need to subtrack the mask areas that overlap with underlying window - switch (m_view->location()) { - case Plasma::Types::TopEdge: - windowMask.setTopLeft(QPoint(start - m_view->x(), m_mask.y() + m_mask.height() - m_editShadow)); - windowMask.setSize(QSize(length, m_editShadow)); - break; - - case Plasma::Types::LeftEdge: - windowMask.setTopLeft(QPoint(m_mask.right() + 1 - m_editShadow, start - m_view->y())); - windowMask.setSize(QSize(m_editShadow, length)); - break; - - case Plasma::Types::RightEdge: - windowMask.setTopLeft(QPoint(m_mask.x(), start - m_view->y())); - windowMask.setSize(QSize(m_editShadow, length)); - break; - - case Plasma::Types::BottomEdge: - windowMask.setTopLeft(QPoint(start - m_view->x(), m_mask.y())); - windowMask.setSize(QSize(length, m_editShadow)); - break; - - default: - break; - } - - subtractedMask = subtractedMask.subtracted(windowMask); - } - - return subtractedMask; -} - -QRegion Effects::subtractedMask() -{ - QRegion subMask = m_mask; - - if (m_settingsMaskSubtracted && m_view->configView()) { - subMask = subtrackedMaskFromWindow(subMask, m_view->configView()); - - ViewPart::PrimaryConfigView *primaryConfig = qobject_cast(m_view->configView()); - - if (primaryConfig && m_view->formFactor() == Plasma::Types::Horizontal && primaryConfig->secondaryWindow()) { - subMask = subtrackedMaskFromWindow(subMask, primaryConfig->secondaryWindow()); - } - } - - return subMask; -} - QRect Effects::rect() const { return m_rect; @@ -345,7 +251,7 @@ void Effects::updateMask() if (m_view->behaveAsPlasmaPanel()) { m_view->setMask(QRect()); } else { - m_view->setMask(subtractedMask()); + m_view->setMask(m_mask); } } else { //! this is used when compositing is disabled and provides diff --git a/app/view/effects.h b/app/view/effects.h index f68599ba3..da2cccb8e 100644 --- a/app/view/effects.h +++ b/app/view/effects.h @@ -43,7 +43,6 @@ class Effects: public QObject Q_PROPERTY(bool animationsBlocked READ animationsBlocked NOTIFY animationsBlockedChanged) Q_PROPERTY(bool drawShadows READ drawShadows WRITE setDrawShadows NOTIFY drawShadowsChanged) Q_PROPERTY(bool drawEffects READ drawEffects WRITE setDrawEffects NOTIFY drawEffectsChanged) - Q_PROPERTY(bool settingsMaskSubtracted READ settingsMaskSubtracted WRITE setSettingsMaskSubtracted NOTIFY settingsMaskSubtractedChanged) //! thickness shadow size when is drawn inside the window from qml Q_PROPERTY(int editShadow READ editShadow WRITE setEditShadow NOTIFY editShadowChanged) @@ -72,9 +71,6 @@ public: void setForceTopBorder(bool draw); void setForceBottomBorder(bool draw); - bool settingsMaskSubtracted() const; - void setSettingsMaskSubtracted(bool enabled); - int editShadow() const; void setEditShadow(int shadow); @@ -111,7 +107,6 @@ signals: void maskChanged(); void innerShadowChanged(); void rectChanged(); - void settingsMaskSubtractedChanged(); private slots: void init(); @@ -121,16 +116,12 @@ private slots: private: qreal currentMidValue(const qreal &max, const qreal &factor, const qreal &min) const; - QRegion subtractedMask(); - QRegion subtrackedMaskFromWindow(QRegion initialRegion, QQuickView *window); - private: bool m_animationsBlocked{false}; bool m_drawShadows{true}; bool m_drawEffects{false}; bool m_forceTopBorder{false}; bool m_forceBottomBorder{false}; - bool m_settingsMaskSubtracted{false}; int m_editShadow{0}; int m_innerShadow{0}; diff --git a/containment/package/contents/ui/VisibilityManager.qml b/containment/package/contents/ui/VisibilityManager.qml index 11dba1c1e..aca8e955c 100644 --- a/containment/package/contents/ui/VisibilityManager.qml +++ b/containment/package/contents/ui/VisibilityManager.qml @@ -325,22 +325,6 @@ Item{ } } - Binding{ - target: latteView && latteView.effects ? latteView.effects : null - property: "settingsMaskSubtracted" - when: latteView && latteView.effects - value: { - if (LatteCore.WindowSystem.compositingActive - && root.editMode - && editModeVisual.editAnimationEnded - && (animations.needBothAxis.count === 0 || parabolic.factor.maxZoom===1) ) { - return true; - } else { - return false; - } - } - } - //! View::Positioner bindings Binding{ target: latteView && latteView.positioner ? latteView.positioner : null