diff options
author | Maximilian Seidler <[email protected]> | 2024-08-02 15:25:51 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2024-08-02 15:25:51 +0200 |
commit | 592b4a709c8093273c6051fb7e76ce3c3d82cedf (patch) | |
tree | dab0881a068c14c9fad5785e8ffa306ac6e4fc95 | |
parent | 09bb5658b7fa6c0dc4e2744797e51ad4dd25af42 (diff) | |
download | Hyprland-592b4a709c8093273c6051fb7e76ce3c3d82cedf.tar.gz Hyprland-592b4a709c8093273c6051fb7e76ce3c3d82cedf.zip |
sessionLock: don't sendLocked when session lock has already been destoyed (#7150)
* sessionLock: reset m_pSessionLock on destroy
* sessionLock: only send locked when resource is good
-rw-r--r-- | src/managers/SessionLockManager.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/managers/SessionLockManager.cpp b/src/managers/SessionLockManager.cpp index 83ff3ee7..a82432a8 100644 --- a/src/managers/SessionLockManager.cpp +++ b/src/managers/SessionLockManager.cpp @@ -71,7 +71,8 @@ void CSessionLockManager::onNewSessionLock(SP<CSessionLock> pLock) { g_pHyprRenderer->damageMonitor(m.get()); }); - m_pSessionLock->listeners.destroy = pLock->events.destroyed.registerListener([](std::any data) { + m_pSessionLock->listeners.destroy = pLock->events.destroyed.registerListener([this](std::any data) { + m_pSessionLock.reset(); g_pCompositor->focusSurface(nullptr); for (auto& m : g_pCompositor->m_vMonitors) @@ -104,7 +105,7 @@ SSessionLockSurface* CSessionLockManager::getSessionLockSurfaceForMonitor(uint64 // We don't want the red screen to flash. float CSessionLockManager::getRedScreenAlphaForMonitor(uint64_t id) { if (!m_pSessionLock) - return 0.F; + return 1.F; const auto& NOMAPPEDSURFACETIMER = m_pSessionLock->mMonitorsWithoutMappedSurfaceTimers.find(id); @@ -123,7 +124,7 @@ void CSessionLockManager::onLockscreenRenderedOnMonitor(uint64_t id) { 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); }); - if (LOCKED) { + if (LOCKED && m_pSessionLock->lock->good()) { m_pSessionLock->lock->sendLocked(); m_pSessionLock->m_hasSentLocked = true; } |