#pragma once #include "../defines.hpp" #include "../helpers/time/Timer.hpp" #include "../helpers/signal/Signal.hpp" #include "./eventLoop/EventLoopTimer.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 lockTimer; SP sendDeniedTimer; std::vector> vSessionLockSurfaces; struct { CHyprSignalListener newSurface; CHyprSignalListener unlock; CHyprSignalListener destroy; } listeners; bool hasSentLocked = false; bool hasSentDenied = false; std::unordered_set lockedMonitors; }; class CSessionLockManager { public: CSessionLockManager(); ~CSessionLockManager() = default; WP getSessionLockSurfaceForMonitor(uint64_t); bool isSessionLocked(); bool clientLocked(); bool clientDenied(); bool isSurfaceSessionLock(SP); bool anySessionLockSurfacesPresent(); void removeSessionLockSurface(SSessionLockSurface*); void onLockscreenRenderedOnMonitor(uint64_t id); bool shallConsiderLockMissing(); private: UP m_sessionLock; struct { CHyprSignalListener newLock; } m_listeners; void onNewSessionLock(SP pWlrLock); void removeSendDeniedTimer(); }; inline UP g_pSessionLockManager;