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
This commit is contained in:
Thomas Lübking 2014-08-27 21:48:23 +02:00
parent ed02a9fb96
commit 32dbb57618
2 changed files with 15 additions and 0 deletions

View file

@ -43,6 +43,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// DBus generated
#include "screenlocker_interface.h"
// Qt
#include <QSharedPointer>
#include <QTimer>
#include <QVector>
#include <QTextStream>
@ -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<QMetaObject::Connection> me(new QMetaObject::Connection);
*me = QObject::connect(QCoreApplication::eventDispatcher(),
&QAbstractEventDispatcher::aboutToBlock, this,
[this, me](){
QObject::disconnect(*me);
const_cast<QSharedPointer<QMetaObject::Connection>*>(&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();

View file

@ -112,6 +112,7 @@ private:
bool m_approaching;
int m_lastApproachingFactor;
bool m_blocked;
bool m_pushBackBlocked;
Client *m_client;
};