From 896a78aaa0bb2e4d4f197ed1286c4f030dbaef5f Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Sat, 13 May 2023 12:36:36 +0100 Subject: [PATCH] lock: add allow_session_lock_restore --- src/config/ConfigManager.cpp | 1 + src/managers/SessionLockManager.cpp | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 3b558540..371234c3 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -93,6 +93,7 @@ void CConfigManager::setDefaultVars() { configValues["misc:render_ahead_safezone"].intValue = 1; configValues["misc:cursor_zoom_factor"].floatValue = 1.f; configValues["misc:cursor_zoom_rigid"].intValue = 0; + configValues["misc:allow_session_lock_restore"].intValue = 0; configValues["debug:int"].intValue = 0; configValues["debug:log_damage"].intValue = 0; diff --git a/src/managers/SessionLockManager.cpp b/src/managers/SessionLockManager.cpp index 29e6ddca..df284c04 100644 --- a/src/managers/SessionLockManager.cpp +++ b/src/managers/SessionLockManager.cpp @@ -44,7 +44,9 @@ static void handleSurfaceDestroy(void* owner, void* data) { void CSessionLockManager::onNewSessionLock(wlr_session_lock_v1* pWlrLock) { - if (m_sSessionLock.active) { + static auto* const PALLOWRELOCK = &g_pConfigManager->getConfigValuePtr("misc:allow_session_lock_restore")->intValue; + + if (m_sSessionLock.active && (!*PALLOWRELOCK || m_sSessionLock.pWlrLock)) { Debug::log(LOG, "Attempted to lock a locked session!"); wlr_session_lock_v1_destroy(pWlrLock); return; @@ -113,6 +115,8 @@ void CSessionLockManager::onNewSessionLock(wlr_session_lock_v1* pWlrLock) { g_pCompositor->focusSurface(nullptr); + m_sSessionLock.pWlrLock = nullptr; + for (auto& m : g_pCompositor->m_vMonitors) g_pHyprRenderer->damageMonitor(m.get()); },