wayland: Avoid pointer warp if constraint region is invalid

It may happen that the constraint region doesn't include the specified
cursor hint anymore. If that's the case, avoid warping the pointer.

BUG: 457021
remotes/origin/work/zzag/pointer-input-rework-cursor-tests
Vlad Zahorodnii 3 years ago
parent 271d758f8c
commit 7c91c4bad9
  1. 4
      src/pointer_input.cpp

@ -669,7 +669,7 @@ void PointerInputRedirection::updatePointerConstraints()
lock->setLocked(false);
m_locked = false;
disconnectLockedPointerAboutToBeUnboundConnection();
if (!(hint.x() < 0 || hint.y() < 0) && focus()) {
if (!(hint.x() < 0 || hint.y() < 0 || !lock->region().contains(hint.toPoint())) && focus()) {
processMotionAbsolute(focus()->mapFromLocal(hint), waylandServer()->seat()->timestamp());
}
}
@ -684,7 +684,7 @@ void PointerInputRedirection::updatePointerConstraints()
// In this case the cached cursor position hint must be fetched before the resource goes away
m_lockedPointerAboutToBeUnboundConnection = connect(lock, &KWaylandServer::LockedPointerV1Interface::aboutToBeDestroyed, this, [this, lock]() {
const auto hint = lock->cursorPositionHint();
if (hint.x() < 0 || hint.y() < 0 || !focus()) {
if (hint.x() < 0 || hint.y() < 0 || !lock->region().contains(hint.toPoint()) || !focus()) {
return;
}
auto globalHint = focus()->mapFromLocal(hint);

Loading…
Cancel
Save