session-lock: don't render workspaces when locked (#10865)

Avoid rendering the workspace behind if we are locked
This commit is contained in:
Maximilian Seidler 2025-07-14 13:13:54 +02:00 committed by GitHub
parent d0f58baf29
commit 01971cb6c7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 129 additions and 81 deletions

View file

@ -3,6 +3,7 @@
#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>
@ -29,10 +30,10 @@ struct SSessionLockSurface {
struct SSessionLock {
WP<CSessionLock> lock;
CTimer mLockTimer;
CTimer lockTimer;
SP<CEventLoopTimer> sendDeniedTimer;
std::vector<UP<SSessionLockSurface>> vSessionLockSurfaces;
std::unordered_map<uint64_t, CTimer> mMonitorsWithoutMappedSurfaceTimers;
struct {
CHyprSignalListener newSurface;
@ -41,6 +42,7 @@ struct SSessionLock {
} listeners;
bool hasSentLocked = false;
bool hasSentDenied = false;
std::unordered_set<uint64_t> lockedMonitors;
};
@ -51,10 +53,9 @@ class CSessionLockManager {
WP<SSessionLockSurface> getSessionLockSurfaceForMonitor(uint64_t);
float getRedScreenAlphaForMonitor(uint64_t);
bool isSessionLocked();
bool isSessionLockPresent();
bool clientLocked();
bool clientDenied();
bool isSurfaceSessionLock(SP<CWLSurfaceResource>);
bool anySessionLockSurfacesPresent();
@ -72,6 +73,7 @@ class CSessionLockManager {
} m_listeners;
void onNewSessionLock(SP<CSessionLock> pWlrLock);
void removeSendDeniedTimer();
};
inline UP<CSessionLockManager> g_pSessionLockManager;