blob: efcaf09a7bd368e7d2fd59143cdbc74a6d38b7ea (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
#pragma once
#include "../defines.hpp"
#include "../helpers/time/Timer.hpp"
#include "../helpers/signal/Signal.hpp"
#include "./eventLoop/EventLoopTimer.hpp"
#include <cstdint>
#include <unordered_map>
#include <unordered_set>
class CSessionLockSurface;
class CSessionLock;
class CWLSurfaceResource;
struct SSessionLockSurface {
SSessionLockSurface(SP<CSessionLockSurface> surface_);
WP<CSessionLockSurface> surface;
WP<CWLSurfaceResource> pWlrSurface;
uint64_t iMonitorID = -1;
bool mapped = false;
struct {
CHyprSignalListener map;
CHyprSignalListener destroy;
CHyprSignalListener commit;
} listeners;
};
struct SSessionLock {
WP<CSessionLock> lock;
CTimer lockTimer;
SP<CEventLoopTimer> sendDeniedTimer;
std::vector<SP<SSessionLockSurface>> vSessionLockSurfaces;
struct {
CHyprSignalListener newSurface;
CHyprSignalListener unlock;
CHyprSignalListener destroy;
} listeners;
bool hasSentLocked = false;
bool hasSentDenied = false;
std::unordered_set<uint64_t> lockedMonitors;
};
class CSessionLockManager {
public:
CSessionLockManager();
~CSessionLockManager() = default;
WP<SSessionLockSurface> getSessionLockSurfaceForMonitor(uint64_t);
bool isSessionLocked();
bool clientLocked();
bool clientDenied();
bool isSurfaceSessionLock(SP<CWLSurfaceResource>);
bool anySessionLockSurfacesPresent();
void removeSessionLockSurface(SSessionLockSurface*);
void onLockscreenRenderedOnMonitor(uint64_t id);
bool shallConsiderLockMissing();
private:
UP<SSessionLock> m_sessionLock;
struct {
CHyprSignalListener newLock;
} m_listeners;
void onNewSessionLock(SP<CSessionLock> pWlrLock);
void removeSendDeniedTimer();
};
inline UP<CSessionLockManager> g_pSessionLockManager;
|