diff options
| author | Vaxry <vaxry@vaxry.net> | 2024-04-30 16:32:05 +0100 |
|---|---|---|
| committer | Vaxry <vaxry@vaxry.net> | 2024-04-30 16:34:09 +0100 |
| commit | 90e1411315065ead5b5a7873be4109bdfb9f5470 (patch) | |
| tree | 3e55d49559d1e77ae655a7c5ea4d4d73f8054180 /src/managers/SessionLockManager.hpp | |
| parent | d7a48cf47816041c5cb705c9de218c3395635822 (diff) | |
session-lock: move to new impl
Diffstat (limited to 'src/managers/SessionLockManager.hpp')
| -rw-r--r-- | src/managers/SessionLockManager.hpp | 46 |
1 files changed, 30 insertions, 16 deletions
diff --git a/src/managers/SessionLockManager.hpp b/src/managers/SessionLockManager.hpp index c2c539db..d655a2bc 100644 --- a/src/managers/SessionLockManager.hpp +++ b/src/managers/SessionLockManager.hpp @@ -2,51 +2,65 @@ #include "../defines.hpp" #include "../helpers/Timer.hpp" +#include "../helpers/signal/Listener.hpp" #include <cstdint> #include <unordered_map> +class CSessionLockSurface; +class CSessionLock; + struct SSessionLockSurface { - wlr_session_lock_surface_v1* pWlrLockSurface = nullptr; - uint64_t iMonitorID = -1; + SSessionLockSurface(SP<CSessionLockSurface> surface_); + + WP<CSessionLockSurface> surface; + wlr_surface* pWlrSurface = nullptr; + uint64_t iMonitorID = -1; - bool mapped = false; + bool mapped = false; - DYNLISTENER(map); - DYNLISTENER(destroy); - DYNLISTENER(commit); + struct { + CHyprSignalListener map; + CHyprSignalListener destroy; + CHyprSignalListener commit; + } listeners; }; struct SSessionLock { - bool active = false; - wlr_session_lock_v1* pWlrLock = nullptr; + WP<CSessionLock> lock; std::vector<std::unique_ptr<SSessionLockSurface>> vSessionLockSurfaces; std::unordered_map<uint64_t, CTimer> mMonitorsWithoutMappedSurfaceTimers; - DYNLISTENER(newSurface); - DYNLISTENER(unlock); - DYNLISTENER(destroy); + struct { + CHyprSignalListener newSurface; + CHyprSignalListener unlock; + CHyprSignalListener destroy; + } listeners; }; class CSessionLockManager { public: - CSessionLockManager() = default; + CSessionLockManager(); ~CSessionLockManager() = default; - void onNewSessionLock(wlr_session_lock_v1*); SSessionLockSurface* getSessionLockSurfaceForMonitor(uint64_t); float getRedScreenAlphaForMonitor(uint64_t); bool isSessionLocked(); + bool isSessionLockPresent(); bool isSurfaceSessionLock(wlr_surface*); void removeSessionLockSurface(SSessionLockSurface*); - void activateLock(); - private: - SSessionLock m_sSessionLock; + UP<SSessionLock> m_pSessionLock; + + struct { + CHyprSignalListener newLock; + } listeners; + + void onNewSessionLock(SP<CSessionLock> pWlrLock); }; inline std::unique_ptr<CSessionLockManager> g_pSessionLockManager;
\ No newline at end of file |
