diff --git a/declarativeplugin/pointerlocker.cpp b/declarativeplugin/pointerlocker.cpp index e6ba9b5f1..0004d21b3 100644 --- a/declarativeplugin/pointerlocker.cpp +++ b/declarativeplugin/pointerlocker.cpp @@ -33,9 +33,10 @@ PointerLockerQt::~PointerLockerQt() = default; void PointerLockerQt::setLocked(bool lock) { - if (isLocked() == lock) { + if (m_isLocked == lock) { return; } + m_isLocked = lock; if (lock) { /* Cursor needs to be hidden such that Xwayland emulates warps. */ @@ -54,7 +55,7 @@ void PointerLockerQt::setLocked(bool lock) bool PointerLockerQt::isLocked() const { - return !m_originalPosition.isNull(); + return m_isLocked; } bool PointerLockerQt::eventFilter(QObject *watched, QEvent *event) diff --git a/declarativeplugin/pointerlocker.h b/declarativeplugin/pointerlocker.h index 6278009e6..cff014997 100644 --- a/declarativeplugin/pointerlocker.h +++ b/declarativeplugin/pointerlocker.h @@ -57,7 +57,7 @@ private: bool eventFilter(QObject *watched, QEvent *event) override; QPoint m_originalPosition; - bool m_moving = false; + bool m_isLocked = false; };