diff options
| author | Vaxry <43317083+vaxerski@users.noreply.github.com> | 2026-02-21 21:30:39 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-02-21 21:30:39 +0000 |
| commit | 723870337f299d4c80aa0048144f3a1ca1c885bd (patch) | |
| tree | ca3279ae5dbc841f676c64d2f58f895de13cd3bf /src/managers/input/InputManager.cpp | |
| parent | 51f8849e541f0a8150ac3a43fa928c1e299daf18 (diff) | |
layout: rethonk layouts from the ground up (#12890)
Rewrites layouts to be much smaller, and deal with much less annoying
BS. Improves the overall architecture, unifies handling of pseudotiling,
and various other improvements.
Diffstat (limited to 'src/managers/input/InputManager.cpp')
| -rw-r--r-- | src/managers/input/InputManager.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index 860a4b78..e0b1a452 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -37,12 +37,13 @@ #include "../../render/Renderer.hpp" #include "../../managers/HookSystemManager.hpp" #include "../../managers/EventManager.hpp" -#include "../../managers/LayoutManager.hpp" #include "../../managers/permissions/DynamicPermissionManager.hpp" #include "../../helpers/time/Time.hpp" #include "../../helpers/MiscFunctions.hpp" +#include "../../layout/LayoutManager.hpp" + #include "trackpad/TrackpadGestures.hpp" #include "../cursor/CursorShapeOverrideController.hpp" @@ -230,6 +231,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st Vector2D surfacePos = Vector2D(-1337, -1337); PHLWINDOW pFoundWindow; PHLLS pFoundLayerSurface; + const auto FOCUS_REASON = refocus ? Desktop::FOCUS_REASON_CLICK : Desktop::FOCUS_REASON_FFM; EMIT_HOOK_EVENT_CANCELLABLE("mouseMove", MOUSECOORDSFLOORED); @@ -365,7 +367,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st } } - g_pLayoutManager->getCurrentLayout()->onMouseMove(getMouseCoordsInternal()); + g_layoutManager->moveMouse(getMouseCoordsInternal()); // forced above all if (!g_pInputManager->m_exclusiveLSes.empty()) { @@ -522,7 +524,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st g_pSeatManager->setPointerFocus(nullptr, {}); if (refocus || !Desktop::focusState()->window()) // if we are forcing a refocus, and we don't find a surface, clear the kb focus too! - Desktop::focusState()->rawWindowFocus(nullptr); + Desktop::focusState()->rawWindowFocus(nullptr, FOCUS_REASON); return; } @@ -550,7 +552,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st m_foundSurfaceToFocus = foundSurface; } - if (m_currentlyDraggedWindow.lock() && pFoundWindow != m_currentlyDraggedWindow) { + if (g_layoutManager->dragController()->target() && pFoundWindow != g_layoutManager->dragController()->target()) { g_pSeatManager->setPointerFocus(foundSurface, surfaceLocal); return; } @@ -582,7 +584,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st ((pFoundWindow->m_isFloating && *PFLOATBEHAVIOR == 2) || (Desktop::focusState()->window()->m_isFloating != pFoundWindow->m_isFloating && *PFLOATBEHAVIOR != 0))) { // enter if change floating style if (FOLLOWMOUSE != 3 && allowKeyboardRefocus) - Desktop::focusState()->rawWindowFocus(pFoundWindow, foundSurface); + Desktop::focusState()->rawWindowFocus(pFoundWindow, FOCUS_REASON, foundSurface); g_pSeatManager->setPointerFocus(foundSurface, surfaceLocal); } else if (FOLLOWMOUSE == 2 || FOLLOWMOUSE == 3) g_pSeatManager->setPointerFocus(foundSurface, surfaceLocal); @@ -610,7 +612,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st const bool hasNoFollowMouse = pFoundWindow && pFoundWindow->m_ruleApplicator->noFollowMouse().valueOrDefault(); if (refocus || !hasNoFollowMouse) - Desktop::focusState()->rawWindowFocus(pFoundWindow, foundSurface); + Desktop::focusState()->rawWindowFocus(pFoundWindow, FOCUS_REASON, foundSurface); } } else Desktop::focusState()->rawSurfaceFocus(foundSurface, pFoundWindow); @@ -619,7 +621,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st } if (g_pSeatManager->m_state.keyboardFocus == nullptr) - Desktop::focusState()->rawWindowFocus(pFoundWindow, foundSurface); + Desktop::focusState()->rawWindowFocus(pFoundWindow, FOCUS_REASON, foundSurface); m_lastFocusOnLS = false; } else { @@ -1629,13 +1631,13 @@ bool CInputManager::refocusLastWindow(PHLMONITOR pMonitor) { if (!foundSurface && Desktop::focusState()->window() && Desktop::focusState()->window()->m_workspace && Desktop::focusState()->window()->m_workspace->isVisibleNotCovered()) { // then the last focused window if we're on the same workspace as it const auto PLASTWINDOW = Desktop::focusState()->window(); - Desktop::focusState()->fullWindowFocus(PLASTWINDOW); + Desktop::focusState()->fullWindowFocus(PLASTWINDOW, Desktop::FOCUS_REASON_FFM); } else { // otherwise fall back to a normal refocus. if (foundSurface && !foundSurface->m_hlSurface->keyboardFocusable()) { const auto PLASTWINDOW = Desktop::focusState()->window(); - Desktop::focusState()->fullWindowFocus(PLASTWINDOW); + Desktop::focusState()->fullWindowFocus(PLASTWINDOW, Desktop::FOCUS_REASON_FFM); } refocus(); @@ -1951,7 +1953,7 @@ void CInputManager::setCursorIconOnBorder(PHLWINDOW w) { if (w->hasPopupAt(mouseCoords)) direction = BORDERICON_NONE; - else if (!boxFullGrabInput.containsPoint(mouseCoords) || (!m_currentlyHeldButtons.empty() && m_currentlyDraggedWindow.expired())) + else if (!boxFullGrabInput.containsPoint(mouseCoords) || (!m_currentlyHeldButtons.empty() && !g_layoutManager->dragController()->target())) direction = BORDERICON_NONE; else { |
