Explicitly disable pointer constraints on TabBox invocation
Summary: Pointer constraints should become disabled when the TabBox is invoked. Since the current client stays activated while TabBox is enabled and currently can not be deactivated with the risk of regression as discussed in D13758, disable all pointer constraining explicitly and enable it again when the TabBox is closed. Test Plan: Manually in Wayland session. Reviewers: #kwin, graesslin Reviewed By: #kwin, graesslin Subscribers: kwin Tags: #kwin Maniphest Tasks: T8923 Differential Revision: https://phabricator.kde.org/D14142
This commit is contained in:
parent
dc541452f1
commit
f0ba436c72
4 changed files with 20 additions and 5 deletions
|
@ -1197,6 +1197,7 @@ public:
|
|||
}
|
||||
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);
|
||||
|
|
|
@ -612,6 +612,15 @@ static QRegion getConstraintRegion(Toplevel *t, T *constraint)
|
|||
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,11 +639,11 @@ void PointerInputRedirection::updatePointerConstraints()
|
|||
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();
|
||||
|
@ -642,7 +651,7 @@ void PointerInputRedirection::updatePointerConstraints()
|
|||
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 @@ void PointerInputRedirection::updatePointerConstraints()
|
|||
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",
|
||||
|
|
|
@ -92,6 +92,8 @@ public:
|
|||
m_blockConstraint = true;
|
||||
}
|
||||
|
||||
void setEnableConstraints(bool set);
|
||||
|
||||
bool isConstrained() const {
|
||||
return m_confined || m_locked;
|
||||
}
|
||||
|
@ -171,6 +173,7 @@ private:
|
|||
bool m_confined = false;
|
||||
bool m_locked = false;
|
||||
bool m_blockConstraint = false;
|
||||
bool m_enableConstraints = true;
|
||||
};
|
||||
|
||||
class CursorImage : public QObject
|
||||
|
|
|
@ -38,6 +38,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#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 @@ void TabBox::close(bool abort)
|
|||
removeTabBoxGrab();
|
||||
}
|
||||
hide(abort);
|
||||
input()->pointer()->setEnableConstraints(true);
|
||||
m_tabGrab = false;
|
||||
m_desktopGrab = false;
|
||||
m_noModifierGrab = false;
|
||||
|
|
Loading…
Reference in a new issue