From 32dbb57618a5e9df04168c40eb6ec6af58bede52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Wed, 27 Aug 2014 21:48:23 +0200 Subject: [PATCH] block warps after warping for VD switch until the event cycle finished - xcb_flush nor even XSync around the cursor setting does not help and the pushback operates on a false position, purging the VD switch warp BUG: 338593 REVIEW: 119960 --- screenedge.cpp | 14 ++++++++++++++ screenedge.h | 1 + 2 files changed, 15 insertions(+) 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; };