mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-15 06:25:59 +01:00
a958884b52
* lock: use uint64_t for iMonitorID * lock: move activateLock to onNewSessionLock * lock: add red screen fade * lock: damage when fading the red screen and delay for screencopy * lock: remove redundant scheduleFrameForMonitor
52 lines
No EOL
1.4 KiB
C++
52 lines
No EOL
1.4 KiB
C++
#pragma once
|
|
|
|
#include "../defines.hpp"
|
|
#include "../helpers/Timer.hpp"
|
|
#include <cstdint>
|
|
#include <unordered_map>
|
|
|
|
struct SSessionLockSurface {
|
|
wlr_session_lock_surface_v1* pWlrLockSurface = nullptr;
|
|
uint64_t iMonitorID = -1;
|
|
|
|
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;
|
|
std::unordered_map<uint64_t, CTimer> mMonitorsWithoutMappedSurfaceTimers;
|
|
|
|
DYNLISTENER(newSurface);
|
|
DYNLISTENER(unlock);
|
|
DYNLISTENER(destroy);
|
|
};
|
|
|
|
class CSessionLockManager {
|
|
public:
|
|
CSessionLockManager() = default;
|
|
~CSessionLockManager() = default;
|
|
|
|
void onNewSessionLock(wlr_session_lock_v1*);
|
|
SSessionLockSurface* getSessionLockSurfaceForMonitor(uint64_t);
|
|
|
|
float getRedScreenAlphaForMonitor(uint64_t);
|
|
|
|
bool isSessionLocked();
|
|
bool isSurfaceSessionLock(wlr_surface*);
|
|
|
|
void removeSessionLockSurface(SSessionLockSurface*);
|
|
|
|
void activateLock();
|
|
|
|
private:
|
|
SSessionLock m_sSessionLock;
|
|
};
|
|
|
|
inline std::unique_ptr<CSessionLockManager> g_pSessionLockManager; |