From f68aac0501ec31c376b98db9a83255774615a71c Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Tue, 13 Apr 2021 12:46:39 +0300 Subject: [PATCH] slide-out views when deleted --- app/layout/genericlayout.cpp | 5 ++++- app/view/positioner.cpp | 19 ++++++++++++------- app/view/positioner.h | 2 ++ 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/app/layout/genericlayout.cpp b/app/layout/genericlayout.cpp index e78767144..75c15a21b 100644 --- a/app/layout/genericlayout.cpp +++ b/app/layout/genericlayout.cpp @@ -758,7 +758,7 @@ void GenericLayout::containmentDestroyed(QObject *cont) if (view) { view->disconnectSensitiveSignals(); - + view->positioner()->hideOnExit(); view->deleteLater(); emit viewEdgeChanged(); @@ -904,6 +904,7 @@ void GenericLayout::addView(Plasma::Containment *containment, bool forceOnPrimar qDebug() << "Rejected explicit latteView and removing it in order add an onPrimary with higher priority at screen: " << connector; auto viewToDelete = m_latteViews.take(testContainment); viewToDelete->disconnectSensitiveSignals(); + viewToDelete->positioner()->hideOnExit(); viewToDelete->deleteLater(); } } @@ -1425,6 +1426,7 @@ void GenericLayout::syncLatteViewsToScreens(Layout::ViewsMap *occupiedMap) auto view = m_latteViews.take(containment); qDebug() << "syncLatteViewsToScreens: view must be deleted... for containment:" << containment->id() << " at screen:" << view->positioner()->currentScreenName(); view->disconnectSensitiveSignals(); + view->positioner()->hideOnExit(); view->deleteLater(); } @@ -1583,6 +1585,7 @@ void GenericLayout::updateView(const Latte::Data::View &viewData) //! viewMustBeDeleted m_latteViews.remove(view->containment()); view->disconnectSensitiveSignals(); + view->positioner()->hideOnExit(); delete view; } } diff --git a/app/view/positioner.cpp b/app/view/positioner.cpp index 59b19f1e5..8306b9430 100644 --- a/app/view/positioner.cpp +++ b/app/view/positioner.cpp @@ -294,14 +294,8 @@ QString Positioner::currentScreenName() const return m_screenNameToFollow; } -void Positioner::onCurrentLayoutIsSwitching(const QString &layoutName) +void Positioner::hideOnExit() { - if (!m_view || !m_view->layout() || m_view->layout()->name() != layoutName || !m_view->isVisible()) { - return; - } - - m_inLayoutUnloading = true; - auto slideLocation = WindowSystem::AbstractWindowInterface::Slide::None; switch (m_view->containment()->location()) { @@ -330,6 +324,17 @@ void Positioner::onCurrentLayoutIsSwitching(const QString &layoutName) m_view->setVisible(false); } +void Positioner::onCurrentLayoutIsSwitching(const QString &layoutName) +{ + if (!m_view || !m_view->layout() || m_view->layout()->name() != layoutName || !m_view->isVisible()) { + return; + } + + m_inLayoutUnloading = true; + + hideOnExit(); +} + void Positioner::syncLatteViews() { if (m_view->layout()) { diff --git a/app/view/positioner.h b/app/view/positioner.h index bef15276f..1b99bb951 100644 --- a/app/view/positioner.h +++ b/app/view/positioner.h @@ -108,6 +108,8 @@ public slots: //! that might prevent them. It must be called with care. void immediateSyncGeometry(); + void hideOnExit(); + void initDelayedSignals(); void updateWaylandId();