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.
This commit is contained in:
parent
6c71b87200
commit
5ccb543e89
1 changed files with 3 additions and 3 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue