pointerlockerqt: fix Lock button not reappearing after unlocking the pointer
This commit is contained in:
parent
d41558d541
commit
2d674d8b04
2 changed files with 4 additions and 3 deletions
|
@ -33,9 +33,10 @@ PointerLockerQt::~PointerLockerQt() = default;
|
||||||
|
|
||||||
void PointerLockerQt::setLocked(bool lock)
|
void PointerLockerQt::setLocked(bool lock)
|
||||||
{
|
{
|
||||||
if (isLocked() == lock) {
|
if (m_isLocked == lock) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
m_isLocked = lock;
|
||||||
|
|
||||||
if (lock) {
|
if (lock) {
|
||||||
/* Cursor needs to be hidden such that Xwayland emulates warps. */
|
/* Cursor needs to be hidden such that Xwayland emulates warps. */
|
||||||
|
@ -54,7 +55,7 @@ void PointerLockerQt::setLocked(bool lock)
|
||||||
|
|
||||||
bool PointerLockerQt::isLocked() const
|
bool PointerLockerQt::isLocked() const
|
||||||
{
|
{
|
||||||
return !m_originalPosition.isNull();
|
return m_isLocked;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PointerLockerQt::eventFilter(QObject *watched, QEvent *event)
|
bool PointerLockerQt::eventFilter(QObject *watched, QEvent *event)
|
||||||
|
|
|
@ -57,7 +57,7 @@ private:
|
||||||
bool eventFilter(QObject *watched, QEvent *event) override;
|
bool eventFilter(QObject *watched, QEvent *event) override;
|
||||||
|
|
||||||
QPoint m_originalPosition;
|
QPoint m_originalPosition;
|
||||||
bool m_moving = false;
|
bool m_isLocked = false;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue