From 2d674d8b040b27ee0dbecfe1940ffa306c27228a Mon Sep 17 00:00:00 2001 From: Piyush Aggarwal Date: Wed, 4 Aug 2021 23:05:14 +0530 Subject: [PATCH] pointerlockerqt: fix Lock button not reappearing after unlocking the pointer --- declarativeplugin/pointerlocker.cpp | 5 +++-- declarativeplugin/pointerlocker.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) 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; };