pointerlockerqt: fix Lock button not reappearing after unlocking the pointer

This commit is contained in:
Piyush Aggarwal 2021-08-04 23:05:14 +05:30 committed by Aleix Pol Gonzalez
parent d41558d541
commit 2d674d8b04
2 changed files with 4 additions and 3 deletions

View file

@ -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)

View file

@ -57,7 +57,7 @@ private:
bool eventFilter(QObject *watched, QEvent *event) override;
QPoint m_originalPosition;
bool m_moving = false;
bool m_isLocked = false;
};