File indexing completed on 2024-11-10 04:29:48

0001 /*
0002     SPDX-FileCopyrightText: 2021 Aleix Pol Gonzalez <aleixpol@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #ifndef POINTERLOCKERWAYLAND_H
0008 #define POINTERLOCKERWAYLAND_H
0009 
0010 #include "pointerlocker.h"
0011 
0012 class PointerConstraints;
0013 class RelativePointerManagerV1;
0014 class RelativePointerV1;
0015 class LockedPointer;
0016 struct wl_pointer;
0017 
0018 class PointerLockerWayland : public AbstractPointerLocker
0019 {
0020     Q_OBJECT
0021 public:
0022     PointerLockerWayland(QObject *parent = nullptr);
0023     ~PointerLockerWayland();
0024 
0025     void setLocked(bool locked) override;
0026     bool isLocked() const override
0027     {
0028         return m_isLocked;
0029     }
0030     bool isLockEffective() const override;
0031     bool isSupported() const override
0032     {
0033         return m_pointerConstraints;
0034     }
0035 
0036     void setWindow(QWindow *window) override;
0037 
0038 private:
0039     void setupRegistry();
0040     void enforceLock();
0041     void cleanupLock();
0042 
0043     wl_pointer *getPointer();
0044 
0045     bool m_isLocked = false;
0046 
0047     PointerConstraints *m_pointerConstraints;
0048     LockedPointer *m_lockedPointer = nullptr;
0049     std::unique_ptr<RelativePointerManagerV1> m_relativePointerMgr;
0050     std::unique_ptr<RelativePointerV1> m_relativePointer;
0051 };
0052 
0053 #endif