2023-02-03 12:58:55 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "../defines.hpp"
|
2024-03-15 17:17:13 +01:00
|
|
|
#include "../helpers/Timer.hpp"
|
|
|
|
#include <cstdint>
|
|
|
|
#include <unordered_map>
|
2023-02-03 12:58:55 +01:00
|
|
|
|
|
|
|
struct SSessionLockSurface {
|
|
|
|
wlr_session_lock_surface_v1* pWlrLockSurface = nullptr;
|
2024-03-15 17:17:13 +01:00
|
|
|
uint64_t iMonitorID = -1;
|
2023-02-03 12:58:55 +01:00
|
|
|
|
|
|
|
bool mapped = false;
|
|
|
|
|
|
|
|
DYNLISTENER(map);
|
|
|
|
DYNLISTENER(destroy);
|
|
|
|
DYNLISTENER(commit);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SSessionLock {
|
|
|
|
bool active = false;
|
|
|
|
wlr_session_lock_v1* pWlrLock = nullptr;
|
|
|
|
|
|
|
|
std::vector<std::unique_ptr<SSessionLockSurface>> vSessionLockSurfaces;
|
2024-03-15 17:17:13 +01:00
|
|
|
std::unordered_map<uint64_t, CTimer> mMonitorsWithoutMappedSurfaceTimers;
|
2023-02-03 12:58:55 +01:00
|
|
|
|
|
|
|
DYNLISTENER(newSurface);
|
|
|
|
DYNLISTENER(unlock);
|
|
|
|
DYNLISTENER(destroy);
|
|
|
|
};
|
|
|
|
|
|
|
|
class CSessionLockManager {
|
|
|
|
public:
|
|
|
|
CSessionLockManager() = default;
|
|
|
|
~CSessionLockManager() = default;
|
|
|
|
|
|
|
|
void onNewSessionLock(wlr_session_lock_v1*);
|
2024-03-15 17:17:13 +01:00
|
|
|
SSessionLockSurface* getSessionLockSurfaceForMonitor(uint64_t);
|
|
|
|
|
|
|
|
float getRedScreenAlphaForMonitor(uint64_t);
|
2023-02-03 12:58:55 +01:00
|
|
|
|
|
|
|
bool isSessionLocked();
|
|
|
|
bool isSurfaceSessionLock(wlr_surface*);
|
|
|
|
|
|
|
|
void removeSessionLockSurface(SSessionLockSurface*);
|
|
|
|
|
|
|
|
void activateLock();
|
|
|
|
|
|
|
|
private:
|
|
|
|
SSessionLock m_sSessionLock;
|
|
|
|
};
|
|
|
|
|
|
|
|
inline std::unique_ptr<CSessionLockManager> g_pSessionLockManager;
|