#pragma once #include "../defines.hpp" #include "../helpers/Timer.hpp" #include "../helpers/signal/Signal.hpp" #include #include #include class CSessionLockSurface; class CSessionLock; class CWLSurfaceResource; struct SSessionLockSurface { SSessionLockSurface(SP surface_); WP surface; WP pWlrSurface; uint64_t iMonitorID = -1; bool mapped = false; struct { CHyprSignalListener map; CHyprSignalListener destroy; CHyprSignalListener commit; } listeners; }; struct SSessionLock { WP lock; CTimer mLockTimer; std::vector> vSessionLockSurfaces; std::unordered_map mMonitorsWithoutMappedSurfaceTimers; struct { CHyprSignalListener newSurface; CHyprSignalListener unlock; CHyprSignalListener destroy; } listeners; bool m_hasSentLocked = false; std::unordered_set m_lockedMonitors; }; class CSessionLockManager { public: CSessionLockManager(); ~CSessionLockManager() = default; SSessionLockSurface* getSessionLockSurfaceForMonitor(uint64_t); float getRedScreenAlphaForMonitor(uint64_t); bool isSessionLocked(); bool isSessionLockPresent(); bool isSurfaceSessionLock(SP); bool anySessionLockSurfacesPresent(); void removeSessionLockSurface(SSessionLockSurface*); void onLockscreenRenderedOnMonitor(uint64_t id); bool shallConsiderLockMissing(); private: UP m_pSessionLock; struct { CHyprSignalListener newLock; } listeners; void onNewSessionLock(SP pWlrLock); }; inline std::unique_ptr g_pSessionLockManager;