From 5ccb543e8996f1d0681a2b0454365fb835418f54 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Fri, 12 May 2023 12:49:15 +0300 Subject: [PATCH] Use flooredPoint() in pointer constraint tests .toPoint() doesn't work as expected when the pointer has fractional coordinates and it's near constraint region boundaries. --- src/pointer_input.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pointer_input.cpp b/src/pointer_input.cpp index 9f2b3db1c5..b6e4232ab6 100644 --- a/src/pointer_input.cpp +++ b/src/pointer_input.cpp @@ -632,7 +632,7 @@ void PointerInputRedirection::updatePointerConstraints() } return; } - if (canConstrain && cf->region().contains(focus()->mapToLocal(m_pos).toPoint())) { + if (canConstrain && cf->region().contains(flooredPoint(focus()->mapToLocal(m_pos)))) { cf->setConfined(true); m_confined = true; m_confinedPointerRegionConnection = connect(cf, &KWaylandServer::ConfinedPointerV1Interface::regionChanged, this, [this]() { @@ -644,7 +644,7 @@ void PointerInputRedirection::updatePointerConstraints() return; } const auto cf = s->confinedPointer(); - if (!cf->region().contains(focus()->mapToLocal(m_pos).toPoint())) { + if (!cf->region().contains(flooredPoint(focus()->mapToLocal(m_pos)))) { // pointer no longer in confined region, break the confinement cf->setConfined(false); m_confined = false; @@ -675,7 +675,7 @@ void PointerInputRedirection::updatePointerConstraints() } return; } - if (canConstrain && lock->region().contains(focus()->mapToLocal(m_pos).toPoint())) { + if (canConstrain && lock->region().contains(flooredPoint(focus()->mapToLocal(m_pos)))) { lock->setLocked(true); m_locked = true;