diff --git a/screenedge.cpp b/screenedge.cpp index a8d61d6fd4..a4a1ea1f09 100644 --- a/screenedge.cpp +++ b/screenedge.cpp @@ -43,6 +43,7 @@ along with this program. If not, see . // DBus generated #include "screenlocker_interface.h" // Qt +#include #include #include #include @@ -63,6 +64,7 @@ Edge::Edge(ScreenEdges *parent) , m_approaching(false) , m_lastApproachingFactor(0) , m_blocked(false) + , m_pushBackBlocked(false) , m_client(nullptr) { } @@ -288,12 +290,24 @@ void Edge::switchDesktop(const QPoint &cursorPos) } vds->setCurrent(desktop); if (vds->current() != oldDesktop) { + m_pushBackBlocked = true; Cursor::setPos(pos); + QSharedPointer me(new QMetaObject::Connection); + *me = QObject::connect(QCoreApplication::eventDispatcher(), + &QAbstractEventDispatcher::aboutToBlock, this, + [this, me](){ + QObject::disconnect(*me); + const_cast*>(&me)->reset(nullptr); + m_pushBackBlocked = false; + } + ); } } void Edge::pushCursorBack(const QPoint &cursorPos) { + if (m_pushBackBlocked) + return; int x = cursorPos.x(); int y = cursorPos.y(); const QSize &distance = edges()->cursorPushBackDistance(); diff --git a/screenedge.h b/screenedge.h index d00bb0b137..a4b3e62089 100644 --- a/screenedge.h +++ b/screenedge.h @@ -112,6 +112,7 @@ private: bool m_approaching; int m_lastApproachingFactor; bool m_blocked; + bool m_pushBackBlocked; Client *m_client; };