diff options
Diffstat (limited to 'src/layout/algorithm/Algorithm.cpp')
| -rw-r--r-- | src/layout/algorithm/Algorithm.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/layout/algorithm/Algorithm.cpp b/src/layout/algorithm/Algorithm.cpp index b9e94524..eb737d34 100644 --- a/src/layout/algorithm/Algorithm.cpp +++ b/src/layout/algorithm/Algorithm.cpp @@ -6,6 +6,7 @@ #include "../space/Space.hpp" #include "../../desktop/view/Window.hpp" #include "../../desktop/history/WindowHistoryTracker.hpp" +#include "../../desktop/state/FocusState.hpp" #include "../../helpers/Monitor.hpp" #include "../../render/Renderer.hpp" @@ -190,6 +191,9 @@ void CAlgorithm::moveTargetInDirection(SP<ITarget> t, Math::eDirection dir, bool void CAlgorithm::updateFloatingAlgo(UP<IFloatingAlgorithm>&& algo) { algo->m_parent = m_self; + const auto FOCUSED_WINDOW = Desktop::focusState()->window(); + const auto FOCUSED_TARGET = FOCUSED_WINDOW ? FOCUSED_WINDOW->layoutTarget() : nullptr; + for (const auto& t : m_floatingTargets) { const auto TARGET = t.lock(); if (!TARGET) @@ -204,12 +208,18 @@ void CAlgorithm::updateFloatingAlgo(UP<IFloatingAlgorithm>&& algo) { algo->newTarget(TARGET); } + if (FOCUSED_TARGET && FOCUSED_TARGET->space() == m_space && FOCUSED_TARGET->floating()) + Desktop::focusState()->fullWindowFocus(FOCUSED_WINDOW, Desktop::eFocusReason::FOCUS_REASON_DESKTOP_STATE_CHANGE); + m_floating = std::move(algo); } void CAlgorithm::updateTiledAlgo(UP<ITiledAlgorithm>&& algo) { algo->m_parent = m_self; + const auto FOCUSED_WINDOW = Desktop::focusState()->window(); + const auto FOCUSED_TARGET = FOCUSED_WINDOW ? FOCUSED_WINDOW->layoutTarget() : nullptr; + for (const auto& t : m_tiledTargets) { const auto TARGET = t.lock(); if (!TARGET) @@ -225,6 +235,9 @@ void CAlgorithm::updateTiledAlgo(UP<ITiledAlgorithm>&& algo) { algo->newTarget(TARGET); } + if (FOCUSED_TARGET && FOCUSED_TARGET->space() == m_space && !FOCUSED_TARGET->floating()) + Desktop::focusState()->fullWindowFocus(FOCUSED_WINDOW, Desktop::eFocusReason::FOCUS_REASON_DESKTOP_STATE_CHANGE); + m_tiled = std::move(algo); } |
