lock: add allow_session_lock_restore

This commit is contained in:
vaxerski 2023-05-13 12:36:36 +01:00
parent cc01550aff
commit 896a78aaa0
2 changed files with 6 additions and 1 deletions

View file

@ -93,6 +93,7 @@ void CConfigManager::setDefaultVars() {
configValues["misc:render_ahead_safezone"].intValue = 1; configValues["misc:render_ahead_safezone"].intValue = 1;
configValues["misc:cursor_zoom_factor"].floatValue = 1.f; configValues["misc:cursor_zoom_factor"].floatValue = 1.f;
configValues["misc:cursor_zoom_rigid"].intValue = 0; configValues["misc:cursor_zoom_rigid"].intValue = 0;
configValues["misc:allow_session_lock_restore"].intValue = 0;
configValues["debug:int"].intValue = 0; configValues["debug:int"].intValue = 0;
configValues["debug:log_damage"].intValue = 0; configValues["debug:log_damage"].intValue = 0;

View file

@ -44,7 +44,9 @@ static void handleSurfaceDestroy(void* owner, void* data) {
void CSessionLockManager::onNewSessionLock(wlr_session_lock_v1* pWlrLock) { 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!"); Debug::log(LOG, "Attempted to lock a locked session!");
wlr_session_lock_v1_destroy(pWlrLock); wlr_session_lock_v1_destroy(pWlrLock);
return; return;
@ -113,6 +115,8 @@ void CSessionLockManager::onNewSessionLock(wlr_session_lock_v1* pWlrLock) {
g_pCompositor->focusSurface(nullptr); g_pCompositor->focusSurface(nullptr);
m_sSessionLock.pWlrLock = nullptr;
for (auto& m : g_pCompositor->m_vMonitors) for (auto& m : g_pCompositor->m_vMonitors)
g_pHyprRenderer->damageMonitor(m.get()); g_pHyprRenderer->damageMonitor(m.get());
}, },