Revert "Remove mysterious s_cursorUpdateBlocking boolean flag in pointer_input.cpp"

This reverts commit 3d0bdc56a4.

seat->setFocusedPointerSurface() before notifyPointerMotion() is needed
to prevent sending a motion event that's outside the previously focused
surface.

BUG: 449273
This commit is contained in:
Vlad Zahorodnii 2022-02-23 20:17:28 +02:00
parent d54723cbf2
commit aaa07f0605

View file

@ -553,6 +553,8 @@ void PointerInputRedirection::cleanupDecoration(Decoration::DecoratedClientImpl
m_decorationDestroyedConnection = connect(now, &QObject::destroyed, this, &PointerInputRedirection::update, Qt::QueuedConnection);
}
static bool s_cursorUpdateBlocking = false;
void PointerInputRedirection::focusUpdate(Toplevel *focusOld, Toplevel *focusNow)
{
if (AbstractClient *ac = qobject_cast<AbstractClient*>(focusOld)) {
@ -573,6 +575,11 @@ void PointerInputRedirection::focusUpdate(Toplevel *focusOld, Toplevel *focusNow
return;
}
// prevent updating cursor and sending motion event outside the previously focused surface
s_cursorUpdateBlocking = true;
seat->setFocusedPointerSurface(nullptr);
s_cursorUpdateBlocking = false;
seat->notifyPointerMotion(m_pos.toPoint());
seat->setFocusedPointerSurface(focusNow->surface(), focusNow->inputTransformation());
@ -1021,6 +1028,10 @@ void CursorImage::handlePointerChanged()
void CursorImage::handleFocusedSurfaceChanged()
{
if (s_cursorUpdateBlocking) {
return;
}
KWaylandServer::PointerInterface *pointer = waylandServer()->seat()->pointer();
disconnect(m_serverCursor.connection);