diff options
| author | Nikolai Nechaev <nikolay_nechaev@mail.ru> | 2025-11-26 07:44:26 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-25 22:44:26 +0000 |
| commit | 40d8fa84919c6d0e9fcb1536f4bc09710d4c031c (patch) | |
| tree | e45044c92e5d8f716f2aa15668c61fed5aaf5895 /src/managers/SessionLockManager.cpp | |
| parent | 1c1746de61a90dbbae072f3fc618c45af33fdd59 (diff) | |
compositor: Configurable behavior when window to be focused conflicts with fullscreen (#12033)
Renames `misc:new_window_takes_over_fullscreen` into
`misc:on_focus_under_fullscreen` and implements the following behavior:
- By default, when a tiling window is being focused on a workspace where
a fullscreen/maximized window exists, respect
the `misc:on_focus_under_fullscreen` config variable.
Diffstat (limited to 'src/managers/SessionLockManager.cpp')
| -rw-r--r-- | src/managers/SessionLockManager.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/managers/SessionLockManager.cpp b/src/managers/SessionLockManager.cpp index 391b6dbb..f460e17e 100644 --- a/src/managers/SessionLockManager.cpp +++ b/src/managers/SessionLockManager.cpp @@ -4,6 +4,7 @@ #include "../protocols/FractionalScale.hpp" #include "../protocols/SessionLock.hpp" #include "../render/Renderer.hpp" +#include "../desktop/state/FocusState.hpp" #include "./managers/SeatManager.hpp" #include "./managers/input/InputManager.hpp" #include "./managers/eventLoop/EventLoopManager.hpp" @@ -25,8 +26,8 @@ SSessionLockSurface::SSessionLockSurface(SP<CSessionLockSurface> surface_) : sur }); listeners.destroy = surface_->m_events.destroy.listen([this] { - if (pWlrSurface == g_pCompositor->m_lastFocus) - g_pCompositor->m_lastFocus.reset(); + if (pWlrSurface == Desktop::focusState()->surface()) + Desktop::focusState()->surface().reset(); g_pSessionLockManager->removeSessionLockSurface(this); }); @@ -34,7 +35,7 @@ SSessionLockSurface::SSessionLockSurface(SP<CSessionLockSurface> surface_) : sur listeners.commit = surface_->m_events.commit.listen([this] { const auto PMONITOR = g_pCompositor->getMonitorFromID(iMonitorID); - if (mapped && !g_pCompositor->m_lastFocus) + if (mapped && !Desktop::focusState()->surface()) g_pInputManager->simulateMouseMovement(); if (PMONITOR) @@ -82,13 +83,13 @@ void CSessionLockManager::onNewSessionLock(SP<CSessionLock> pLock) { m_sessionLock->listeners.destroy = pLock->m_events.destroyed.listen([this] { m_sessionLock.reset(); - g_pCompositor->focusSurface(nullptr); + Desktop::focusState()->rawSurfaceFocus(nullptr); for (auto const& m : g_pCompositor->m_monitors) g_pHyprRenderer->damageMonitor(m); }); - g_pCompositor->focusSurface(nullptr); + Desktop::focusState()->rawSurfaceFocus(nullptr); g_pSeatManager->setGrab(nullptr); const bool NOACTIVEMONS = std::ranges::all_of(g_pCompositor->m_monitors, [](const auto& m) { return !m->m_enabled || !m->m_dpmsStatus; }); @@ -196,14 +197,14 @@ void CSessionLockManager::removeSessionLockSurface(SSessionLockSurface* pSLS) { std::erase_if(m_sessionLock->vSessionLockSurfaces, [&](const auto& other) { return pSLS == other.get(); }); - if (g_pCompositor->m_lastFocus) + if (Desktop::focusState()->surface()) return; for (auto const& sls : m_sessionLock->vSessionLockSurfaces) { if (!sls->mapped) continue; - g_pCompositor->focusSurface(sls->surface->surface()); + Desktop::focusState()->rawSurfaceFocus(sls->surface->surface()); break; } } |
