From 72d78eff95948a3eb3260791cfdf625c0102d33a Mon Sep 17 00:00:00 2001 From: drendog <53359960+drendog@users.noreply.github.com> Date: Fri, 15 Mar 2024 19:44:17 +0100 Subject: [PATCH] sessionlock: refocus after destroy focused surface (#5117) * fix: refocus after destroy focused surface * refactor: minor refactor on refocus loop condition * refactor: minor refactor on condition * style: format code --- src/managers/SessionLockManager.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/managers/SessionLockManager.cpp b/src/managers/SessionLockManager.cpp index 1e366034..a0374b85 100644 --- a/src/managers/SessionLockManager.cpp +++ b/src/managers/SessionLockManager.cpp @@ -172,6 +172,17 @@ bool CSessionLockManager::isSurfaceSessionLock(wlr_surface* pSurface) { void CSessionLockManager::removeSessionLockSurface(SSessionLockSurface* pSLS) { std::erase_if(m_sSessionLock.vSessionLockSurfaces, [&](const auto& other) { return pSLS == other.get(); }); + + if (g_pCompositor->m_pLastFocus) + return; + + for (auto& sls : m_sSessionLock.vSessionLockSurfaces) { + if (!sls->mapped) + continue; + + g_pCompositor->focusSurface(sls->pWlrLockSurface->surface); + break; + } } void CSessionLockManager::activateLock() {