Skip to content

Commit 1789405

Browse files
session-lock: send locked when in unsafe state (#9399)
1 parent 68bb3e7 commit 1789405

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/managers/SessionLockManager.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,13 @@ void CSessionLockManager::onNewSessionLock(SP<CSessionLock> pLock) {
8989

9090
g_pCompositor->focusSurface(nullptr);
9191
g_pSeatManager->setGrab(nullptr);
92+
93+
// Normally the locked event is sent after each output rendered a lock screen frame.
94+
// When there are no outputs, send it right away.
95+
if (g_pCompositor->m_bUnsafeState) {
96+
m_pSessionLock->lock->sendLocked();
97+
m_pSessionLock->m_hasSentLocked = true;
98+
}
9299
}
93100

94101
bool CSessionLockManager::isSessionLocked() {
@@ -131,8 +138,7 @@ void CSessionLockManager::onLockscreenRenderedOnMonitor(uint64_t id) {
131138
if (!m_pSessionLock || m_pSessionLock->m_hasSentLocked)
132139
return;
133140
m_pSessionLock->m_lockedMonitors.emplace(id);
134-
const auto MONITORS = g_pCompositor->m_vMonitors;
135-
const bool LOCKED = std::all_of(MONITORS.begin(), MONITORS.end(), [this](auto m) { return m_pSessionLock->m_lockedMonitors.contains(m->ID); });
141+
const bool LOCKED = std::ranges::all_of(g_pCompositor->m_vMonitors, [this](auto m) { return m_pSessionLock->m_lockedMonitors.contains(m->ID); });
136142
if (LOCKED && m_pSessionLock->lock->good()) {
137143
m_pSessionLock->lock->sendLocked();
138144
m_pSessionLock->m_hasSentLocked = true;

0 commit comments

Comments
 (0)