diff --git a/app/view/effects.cpp b/app/view/effects.cpp index 91d1bc770..89debbd85 100644 --- a/app/view/effects.cpp +++ b/app/view/effects.cpp @@ -63,17 +63,6 @@ void Effects::init() connect(m_view, &Latte::View::behaveAsPlasmaPanelChanged, this, &Effects::updateEffects); connect(m_view, &Latte::View::behaveAsPlasmaPanelChanged, this, &Effects::updateShadows); connect(m_view, &Latte::View::configWindowGeometryChanged, this, &Effects::updateMask); - - connect(m_view, &QQuickWindow::widthChanged, this, [&]() { - if (m_view->behaveAsPlasmaPanel() && m_view->formFactor() == Plasma::Types::Vertical) { - updateMaskThickness(); - } - }); - connect(m_view, &QQuickWindow::heightChanged, this, [&]() { - if (m_view->behaveAsPlasmaPanel() && m_view->formFactor() == Plasma::Types::Horizontal) { - updateMaskThickness(); - } - }); } bool Effects::animationsBlocked() const @@ -206,40 +195,29 @@ void Effects::setSettingsMaskSubtracted(bool enabled) int Effects::maskThickness() const { - return m_maskThickness; -} - -void Effects::setMaskThickness(const int &thickness) -{ - if (m_maskThickness == thickness) { - return; - } - - m_maskThickness = thickness; - emit maskThicknessChanged(); -} - -void Effects::updateMaskThickness() -{ - if (m_mask.isNull() || m_mask.width() == 0 || m_mask.height() == 0) { - setMaskThickness(m_view->formFactor() == Plasma::Types::Horizontal ? m_view->height() : m_view->width()); + if (m_view->mask().isEmpty()) { + return m_view->formFactor() == Plasma::Types::Horizontal ? m_view->width() : m_view->height(); } switch (m_view->location()) { case Plasma::Types::TopEdge: - setMaskThickness(m_mask.bottom()); + return m_view->mask().boundingRect().bottom(); break; case Plasma::Types::LeftEdge: - setMaskThickness(m_mask.right()); + return m_view->mask().boundingRect().right(); break; case Plasma::Types::RightEdge: - setMaskThickness(m_mask.left()); + return m_view->mask().boundingRect().left(); break; case Plasma::Types::BottomEdge: - setMaskThickness(m_mask.top()); + return m_view->mask().boundingRect().top(); + break; + + default: + return 64; break; } } @@ -354,13 +332,11 @@ QRect Effects::mask() const void Effects::setMask(QRect area) { - if (m_mask == area) { + if (m_mask == area) return; - } m_mask = area; updateMask(); - updateMaskThickness(); // qDebug() << "dock mask set:" << m_mask; emit maskChanged(); diff --git a/app/view/effects.h b/app/view/effects.h index 0207dc8d3..673c066b3 100644 --- a/app/view/effects.h +++ b/app/view/effects.h @@ -84,7 +84,6 @@ public: void setInnerShadow(int shadow); int maskThickness() const; - void setMaskThickness(const int &thickness); QRect mask() const; void setMask(QRect area); @@ -111,14 +110,12 @@ signals: void editShadowChanged(); void enabledBordersChanged(); void maskChanged(); - void maskThicknessChanged(); void innerShadowChanged(); void rectChanged(); void settingsMaskSubtractedChanged(); private slots: void init(); - void updateMaskThickness(); private: QRegion subtractedMask(); @@ -134,7 +131,6 @@ private: int m_backgroundOpacity{100}; int m_editShadow{0}; int m_innerShadow{0}; - int m_maskThickness{64}; QRect m_rect; QRect m_mask; diff --git a/app/view/visibilitymanager.cpp b/app/view/visibilitymanager.cpp index c5d53b05a..105d31394 100644 --- a/app/view/visibilitymanager.cpp +++ b/app/view/visibilitymanager.cpp @@ -170,17 +170,14 @@ void VisibilityManager::setMode(Latte::Types::Visibility mode) updateStrutsBasedOnLayoutsAndActivities(); } - m_connections[base] = connect(m_latteView->effects(), &ViewPart::Effects::maskThicknessChanged, this, [&]() { - updateStrutsBasedOnLayoutsAndActivities(); - }); - m_connections[base+1] = connect(m_corona->layoutsManager(), &Layouts::Manager::currentLayoutNameChanged, this, [&]() { + m_connections[base] = connect(m_corona->layoutsManager(), &Layouts::Manager::currentLayoutNameChanged, this, [&]() { if (m_corona && m_corona->layoutsManager()->memoryUsage() == Types::MultipleLayouts) { updateStrutsBasedOnLayoutsAndActivities(true); } }); - m_connections[base+2] = connect(m_latteView, &Latte::View::activitiesChanged, this, [&]() { + m_connections[base+1] = connect(m_latteView, &Latte::View::activitiesChanged, this, [&]() { if (m_corona && m_corona->layoutsManager()->memoryUsage() == Types::MultipleLayouts) { updateStrutsBasedOnLayoutsAndActivities(true); } @@ -273,30 +270,28 @@ QRect VisibilityManager::acceptableStruts() int visibleThickness = qMin(m_latteView->effects()->maskThickness(), m_latteView->normalThickness()); - qDebug() << " VISIBLE THICKNESS ::: " << visibleThickness; - switch (m_latteView->location()) { - case Plasma::Types::TopEdge: { - calcs = QRect(m_latteView->x(), m_latteView->y(), m_latteView->width(), visibleThickness); - break; - } + case Plasma::Types::TopEdge: { + calcs = QRect(m_latteView->x(), m_latteView->y(), m_latteView->width(), visibleThickness); + break; + } - case Plasma::Types::BottomEdge: { - int y = m_latteView->y() + m_latteView->height() - visibleThickness; - calcs = QRect(m_latteView->x(), y, m_latteView->width(), visibleThickness); - break; - } + case Plasma::Types::BottomEdge: { + int y = m_latteView->y() + m_latteView->height() - visibleThickness; + calcs = QRect(m_latteView->x(), y, m_latteView->width(), visibleThickness); + break; + } - case Plasma::Types::LeftEdge: { - calcs = QRect(m_latteView->x(), m_latteView->y(), visibleThickness, m_latteView->height()); - break; - } + case Plasma::Types::LeftEdge: { + calcs = QRect(m_latteView->x(), m_latteView->y(), visibleThickness, m_latteView->height()); + break; + } - case Plasma::Types::RightEdge: { - int x = m_latteView->x() + m_latteView->width() - visibleThickness; - calcs = QRect(x, m_latteView->y(), visibleThickness, m_latteView->height()); - break; - } + case Plasma::Types::RightEdge: { + int x = m_latteView->x() + m_latteView->width() - visibleThickness; + calcs = QRect(x, m_latteView->y(), visibleThickness, m_latteView->height()); + break; + } } return calcs;