mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-23 01:05:59 +01:00
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
This commit is contained in:
parent
09bb5658b7
commit
592b4a709c
1 changed files with 4 additions and 3 deletions
|
@ -71,7 +71,8 @@ void CSessionLockManager::onNewSessionLock(SP<CSessionLock> pLock) {
|
||||||
g_pHyprRenderer->damageMonitor(m.get());
|
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);
|
g_pCompositor->focusSurface(nullptr);
|
||||||
|
|
||||||
for (auto& m : g_pCompositor->m_vMonitors)
|
for (auto& m : g_pCompositor->m_vMonitors)
|
||||||
|
@ -104,7 +105,7 @@ SSessionLockSurface* CSessionLockManager::getSessionLockSurfaceForMonitor(uint64
|
||||||
// We don't want the red screen to flash.
|
// We don't want the red screen to flash.
|
||||||
float CSessionLockManager::getRedScreenAlphaForMonitor(uint64_t id) {
|
float CSessionLockManager::getRedScreenAlphaForMonitor(uint64_t id) {
|
||||||
if (!m_pSessionLock)
|
if (!m_pSessionLock)
|
||||||
return 0.F;
|
return 1.F;
|
||||||
|
|
||||||
const auto& NOMAPPEDSURFACETIMER = m_pSessionLock->mMonitorsWithoutMappedSurfaceTimers.find(id);
|
const auto& NOMAPPEDSURFACETIMER = m_pSessionLock->mMonitorsWithoutMappedSurfaceTimers.find(id);
|
||||||
|
|
||||||
|
@ -123,7 +124,7 @@ void CSessionLockManager::onLockscreenRenderedOnMonitor(uint64_t id) {
|
||||||
m_pSessionLock->m_lockedMonitors.emplace(id);
|
m_pSessionLock->m_lockedMonitors.emplace(id);
|
||||||
const auto MONITORS = g_pCompositor->m_vMonitors;
|
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::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->lock->sendLocked();
|
||||||
m_pSessionLock->m_hasSentLocked = true;
|
m_pSessionLock->m_hasSentLocked = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue