2021-07-23 19:28:22 +01:00
|
|
|
/*
|
|
|
|
SPDX-FileCopyrightText: 2021 Aleix Pol Gonzalez <aleixpol@kde.org>
|
|
|
|
|
|
|
|
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef POINTERLOCKERWAYLAND_H
|
|
|
|
#define POINTERLOCKERWAYLAND_H
|
|
|
|
|
|
|
|
#include "pointerlocker.h"
|
|
|
|
|
|
|
|
class PointerConstraints;
|
|
|
|
class LockedPointer;
|
2022-12-11 15:41:08 +00:00
|
|
|
class wl_pointer;
|
2021-07-23 19:28:22 +01:00
|
|
|
|
|
|
|
class PointerLockerWayland : public AbstractPointerLocker
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
PointerLockerWayland(QObject *parent = nullptr);
|
2022-12-11 15:41:08 +00:00
|
|
|
~PointerLockerWayland();
|
2021-07-23 19:28:22 +01:00
|
|
|
|
|
|
|
void setLocked(bool locked) override;
|
2022-09-10 22:23:52 +01:00
|
|
|
bool isLocked() const override
|
|
|
|
{
|
|
|
|
return m_isLocked;
|
|
|
|
}
|
2021-07-23 19:28:22 +01:00
|
|
|
bool isLockEffective() const override;
|
2022-09-10 22:23:52 +01:00
|
|
|
bool isSupported() const override
|
|
|
|
{
|
2022-12-11 15:41:08 +00:00
|
|
|
return m_pointerConstraints;
|
2021-07-23 19:28:22 +01:00
|
|
|
}
|
|
|
|
|
2022-09-10 22:23:52 +01:00
|
|
|
void setWindow(QWindow *window) override;
|
2021-07-23 19:28:22 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
void setupRegistry();
|
|
|
|
void enforceLock();
|
|
|
|
void cleanupLock();
|
|
|
|
|
2022-12-11 15:41:08 +00:00
|
|
|
wl_pointer *getPointer();
|
|
|
|
|
2021-07-23 19:28:22 +01:00
|
|
|
bool m_isLocked = false;
|
|
|
|
|
2022-12-11 15:41:08 +00:00
|
|
|
PointerConstraints *m_pointerConstraints;
|
|
|
|
LockedPointer *m_lockedPointer = nullptr;
|
2021-07-23 19:28:22 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|