diff --git a/input.cpp b/input.cpp --- a/input.cpp +++ b/input.cpp @@ -1197,6 +1197,7 @@ } auto seat = waylandServer()->seat(); seat->setFocusedKeyboardSurface(nullptr); + input()->pointer()->setEnableConstraints(false); // pass the key event to the seat, so that it has a proper model of the currently hold keys // this is important for combinations like alt+shift to ensure that shift is not considered pressed passToWaylandServer(event); diff --git a/pointer_input.h b/pointer_input.h --- a/pointer_input.h +++ b/pointer_input.h @@ -92,6 +92,8 @@ m_blockConstraint = true; } + void setEnableConstraints(bool set); + bool isConstrained() const { return m_confined || m_locked; } @@ -171,6 +173,7 @@ bool m_confined = false; bool m_locked = false; bool m_blockConstraint = false; + bool m_enableConstraints = true; }; class CursorImage : public QObject diff --git a/pointer_input.cpp b/pointer_input.cpp --- a/pointer_input.cpp +++ b/pointer_input.cpp @@ -612,6 +612,15 @@ return intersected.translated(t->pos() + t->clientPos()); } +void PointerInputRedirection::setEnableConstraints(bool set) +{ + if (m_enableConstraints == set) { + return; + } + m_enableConstraints = set; + updatePointerConstraints(); +} + void PointerInputRedirection::updatePointerConstraints() { if (m_window.isNull()) { @@ -630,19 +639,19 @@ if (m_blockConstraint) { return; } - const bool windowIsActive = m_window == workspace()->activeClient(); + const bool canConstrain = m_enableConstraints && m_window == workspace()->activeClient(); const auto cf = s->confinedPointer(); if (cf) { if (cf->isConfined()) { - if (!windowIsActive) { + if (!canConstrain) { cf->setConfined(false); m_confined = false; disconnectConfinedPointerRegionConnection(); } return; } const QRegion r = getConstraintRegion(m_window.data(), cf.data()); - if (windowIsActive && r.contains(m_pos.toPoint())) { + if (canConstrain && r.contains(m_pos.toPoint())) { cf->setConfined(true); m_confined = true; m_confinedPointerRegionConnection = connect(cf.data(), &KWayland::Server::ConfinedPointerInterface::regionChanged, this, @@ -679,14 +688,14 @@ const auto lock = s->lockedPointer(); if (lock) { if (lock->isLocked()) { - if (!windowIsActive) { + if (!canConstrain) { lock->setLocked(false); m_locked = false; } return; } const QRegion r = getConstraintRegion(m_window.data(), lock.data()); - if (windowIsActive && r.contains(m_pos.toPoint())) { + if (canConstrain && r.contains(m_pos.toPoint())) { lock->setLocked(true); m_locked = true; OSD::show(i18nc("notification about mouse pointer locked", diff --git a/tabbox/tabbox.cpp b/tabbox/tabbox.cpp --- a/tabbox/tabbox.cpp +++ b/tabbox/tabbox.cpp @@ -38,6 +38,7 @@ #include "effects.h" #include "input.h" #include "keyboard_input.h" +#include "pointer_input.h" #include "focuschain.h" #include "screenedge.h" #include "screens.h" @@ -1483,6 +1484,7 @@ removeTabBoxGrab(); } hide(abort); + input()->pointer()->setEnableConstraints(true); m_tabGrab = false; m_desktopGrab = false; m_noModifierGrab = false;