From dcde80e6ede2616192ca26001ccb46effb7c2f3e Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Mon, 28 Dec 2020 00:40:18 +0200 Subject: [PATCH] view::use a timer to nulify currentParabolicItem --- app/view/view.cpp | 17 +++++++++++++++-- app/view/view.h | 2 ++ .../contents/ui/task/ParabolicArea.qml | 19 +++++++++++++++++++ 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/app/view/view.cpp b/app/view/view.cpp index 741796cac..8cebd86ed 100644 --- a/app/view/view.cpp +++ b/app/view/view.cpp @@ -112,6 +112,12 @@ View::View(Plasma::Corona *corona, QScreen *targetScreen, bool byPassWM) connect(m_contextMenu, &ViewPart::ContextMenu::menuChanged, this, &View::updateTransientWindowsTracking); + m_parabolicItemNullifier.setInterval(100); + m_parabolicItemNullifier.setSingleShot(true); + connect(&m_parabolicItemNullifier, &QTimer::timeout, this, [&]() { + setCurrentParabolicItem(nullptr); + }); + connect(this, &View::containmentChanged , this, [ &, byPassWM]() { qDebug() << "dock view c++ containment changed 1..."; @@ -319,6 +325,8 @@ void View::init(Plasma::Containment *plasma_containment) connect(m_interface, &ViewPart::ContainmentInterface::hasExpandedAppletChanged, this, &View::verticalUnityViewHasFocus); + connect(this, &View::currentParabolicItemChanged, &m_parabolicItemNullifier, &QTimer::stop); + //! View sends this signal in order to avoid crashes from ViewPart::Indicator when the view is recreated connect(m_corona->indicatorFactory(), &Latte::Indicator::Factory::indicatorChanged, this, [&](const QString &indicatorId) { emit indicatorPluginChanged(indicatorId); @@ -1428,6 +1436,7 @@ bool View::event(QEvent *e) QPointF internal = m_currentParabolicItem->mapFromScene(me->windowPos()); if (m_currentParabolicItem->contains(internal)) { + m_parabolicItemNullifier.stop(); //! sending move event to parabolic item QMetaObject::invokeMethod(m_currentParabolicItem, "parabolicMove", @@ -1436,7 +1445,7 @@ bool View::event(QEvent *e) Q_ARG(qreal, internal.y())); } else { //! clearing parabolic item - setCurrentParabolicItem(nullptr); + m_parabolicItemNullifier.start(); } } @@ -1571,7 +1580,11 @@ bool View::event(QEvent *e) } void View::updateSinkedEventsGeometry() -{ +{ + if (m_inDelete || !m_padding) { + return; + } + QRectF sinked = m_localGeometry; if (m_padding && !m_padding->isEmpty()) { diff --git a/app/view/view.h b/app/view/view.h index 74ec095ca..c75e10da3 100644 --- a/app/view/view.h +++ b/app/view/view.h @@ -432,6 +432,8 @@ private: int m_releaseGrab_x; int m_releaseGrab_y; + QTimer m_parabolicItemNullifier; + Layout::GenericLayout *m_layout{nullptr}; QQuickItem *m_colorizer{nullptr}; diff --git a/plasmoid/package/contents/ui/task/ParabolicArea.qml b/plasmoid/package/contents/ui/task/ParabolicArea.qml index 3a03cb5f2..7df138bb8 100644 --- a/plasmoid/package/contents/ui/task/ParabolicArea.qml +++ b/plasmoid/package/contents/ui/task/ParabolicArea.qml @@ -40,6 +40,25 @@ Item { onEntered: { _parabolicArea.parabolicEntered(mouseX, mouseY); taskItem.parabolic.setCurrentParabolicItem(_parabolicArea); + + //! adjust mouseX/Y because the original are not to be trusted + /* if (root.isHorizontal) { + if (mouseX < center) { + icList.currentSpot = 1; + calculateParabolicScales(icList.currentSpot); + } else { + icList.currentSpot = center * 2 - 1; + calculateParabolicScales(icList.currentSpot); + } + } else { + if (mouseY < center) { + icList.currentSpot = 1; + calculateParabolicScales(icList.currentSpot); + } else { + icList.currentSpot = center * 2 - 1; + calculateParabolicScales(icList.currentSpot); + } + }*/ } }