1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-01-11 13:18:13 +03:00

view:forward ParabolicEnter from c++

This commit is contained in:
Michail Vourlakos 2020-12-28 10:09:37 +02:00
parent 17865ee21a
commit 259f04f7c9
4 changed files with 27 additions and 3 deletions

View File

@ -325,7 +325,7 @@ void View::init(Plasma::Containment *plasma_containment)
connect(m_interface, &ViewPart::ContainmentInterface::hasExpandedAppletChanged, this, &View::verticalUnityViewHasFocus);
connect(this, &View::currentParabolicItemChanged, &m_parabolicItemNullifier, &QTimer::stop);
connect(this, &View::currentParabolicItemChanged, this, &View::onCurrentParabolicItemChanged);
//! 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) {
@ -1448,6 +1448,8 @@ bool View::event(QEvent *e)
//! clearing parabolic item
m_parabolicItemNullifier.start();
}
} else {
m_lastOrphanParabolicMove = me->windowPos();
}
//! adjust event by taking into account paddings
@ -1580,6 +1582,25 @@ bool View::event(QEvent *e)
return ContainmentView::event(adjustedevent);
}
void View::onCurrentParabolicItemChanged()
{
m_parabolicItemNullifier.stop();
if (m_currentParabolicItem != nullptr) {
//! send the ParabolicEnter because the
QPointF internal = m_currentParabolicItem->mapFromScene(m_lastOrphanParabolicMove);
if (m_currentParabolicItem->contains(internal)) {
//! sending enter event to parabolic item
QMetaObject::invokeMethod(m_currentParabolicItem,
"parabolicEntered",
Qt::DirectConnection,
Q_ARG(qreal, internal.x()),
Q_ARG(qreal, internal.y()));
}
}
}
void View::updateSinkedEventsGeometry()
{
if (m_inDelete || !m_padding) {

View File

@ -362,6 +362,8 @@ private slots:
void addTransientWindow(QWindow *window);
void removeTransientWindow(const bool &visible);
void onCurrentParabolicItemChanged();
void updateSinkedEventsGeometry();
//! workaround in order for top panels to be always on top

View File

@ -42,8 +42,9 @@ Item {
&& appletItem.parabolic.currentParabolicItem !== _parabolicArea
onEntered: {
_parabolicArea.parabolicEntered(mouseX, mouseY);
appletItem.parabolic.setCurrentParabolicItem(_parabolicArea);
//! mouseX/Y can be trusted in that case in comparison to tasks that the relevant ParabolicAreaMouseArea does not
_parabolicArea.parabolicEntered(mouseX, mouseY);
}
}

View File

@ -42,7 +42,7 @@ Item {
onEntered: {
taskItem.parabolic.setCurrentParabolicItem(_parabolicArea);
_parabolicArea.parabolicEntered(mouseX, mouseY);
// _parabolicArea.parabolicEntered(mouseX, mouseY);
}
}