summaryrefslogtreecommitdiff
path: root/src/managers/SessionLockManager.cpp
diff options
context:
space:
mode:
authorMaximilian Seidler <78690852+PaideiaDilemma@users.noreply.github.com>2025-02-13 11:06:36 +0000
committerGitHub <noreply@github.com>2025-02-13 11:06:36 +0000
commit17894051634716ab80c6502abdbb90ae2bc68f25 (patch)
tree47c7803391a38a41c2894431119b7a2409e0946e /src/managers/SessionLockManager.cpp
parent68bb3e7f0a1d528a8b2da1f92d2005889587561d (diff)
session-lock: send locked when in unsafe state (#9399)
Diffstat (limited to 'src/managers/SessionLockManager.cpp')
-rw-r--r--src/managers/SessionLockManager.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/managers/SessionLockManager.cpp b/src/managers/SessionLockManager.cpp
index 996860a1..40611199 100644
--- a/src/managers/SessionLockManager.cpp
+++ b/src/managers/SessionLockManager.cpp
@@ -89,6 +89,13 @@ void CSessionLockManager::onNewSessionLock(SP<CSessionLock> pLock) {
g_pCompositor->focusSurface(nullptr);
g_pSeatManager->setGrab(nullptr);
+
+ // Normally the locked event is sent after each output rendered a lock screen frame.
+ // When there are no outputs, send it right away.
+ if (g_pCompositor->m_bUnsafeState) {
+ m_pSessionLock->lock->sendLocked();
+ m_pSessionLock->m_hasSentLocked = true;
+ }
}
bool CSessionLockManager::isSessionLocked() {
@@ -131,8 +138,7 @@ void CSessionLockManager::onLockscreenRenderedOnMonitor(uint64_t id) {
if (!m_pSessionLock || m_pSessionLock->m_hasSentLocked)
return;
m_pSessionLock->m_lockedMonitors.emplace(id);
- const auto MONITORS = g_pCompositor->m_vMonitors;
- const bool LOCKED = std::all_of(MONITORS.begin(), MONITORS.end(), [this](auto m) { return m_pSessionLock->m_lockedMonitors.contains(m->ID); });
+ const bool LOCKED = std::ranges::all_of(g_pCompositor->m_vMonitors, [this](auto m) { return m_pSessionLock->m_lockedMonitors.contains(m->ID); });
if (LOCKED && m_pSessionLock->lock->good()) {
m_pSessionLock->lock->sendLocked();
m_pSessionLock->m_hasSentLocked = true;