Skip to content

Commit

Permalink
session-lock: send locked when in unsafe state (#9399)
Browse files Browse the repository at this point in the history
  • Loading branch information
PaideiaDilemma authored Feb 13, 2025
1 parent 68bb3e7 commit 1789405
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/managers/SessionLockManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 1789405

Please sign in to comment.