diff options
| author | Virt <41426325+VirtCode@users.noreply.github.com> | 2025-04-25 16:38:31 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-25 16:38:31 +0200 |
| commit | 4cf62c114e8fd2cc4fa47d07459e00c52f6dc1d3 (patch) | |
| tree | caf19b6084c2f8b4eb1e9f5c604479c99565de4e /src/managers/input/InputManager.cpp | |
| parent | 41f5f67f6c8675ec48d893007ca93f8bf6c0049a (diff) | |
layerrules: add abovelock to render above lockscreen (#9793)
Diffstat (limited to 'src/managers/input/InputManager.cpp')
| -rw-r--r-- | src/managers/input/InputManager.cpp | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index c51b8e1c..58ae6e93 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -2,6 +2,7 @@ #include "../../Compositor.hpp" #include <aquamarine/output/Output.hpp> #include <cstdint> +#include <hyprutils/math/Vector2D.hpp> #include <ranges> #include "../../config/ConfigValue.hpp" #include "../../config/ConfigManager.hpp" @@ -249,15 +250,29 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) { g_pCompositor->setActiveMonitor(PMONITOR); if (g_pSessionLockManager->isSessionLocked()) { + + // set keyboard focus on session lock surface regardless of layers const auto PSESSIONLOCKSURFACE = g_pSessionLockManager->getSessionLockSurfaceForMonitor(PMONITOR->ID); - surfacePos = PMONITOR->vecPosition; + const auto foundLockSurface = PSESSIONLOCKSURFACE ? PSESSIONLOCKSURFACE->surface->surface() : nullptr; + + g_pCompositor->focusSurface(foundLockSurface); + + // search for interactable abovelock surfaces for pointer focus, or use session lock surface if not found + for (auto& lsl : PMONITOR->m_aLayerSurfaceLayers | std::views::reverse) { + foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &lsl, &surfaceCoords, &pFoundLayerSurface, true); + + if (foundSurface) + break; + } + + if (!foundSurface) { + surfaceCoords = mouseCoords - PMONITOR->vecPosition; + foundSurface = foundLockSurface; + } - foundSurface = PSESSIONLOCKSURFACE ? PSESSIONLOCKSURFACE->surface->surface() : nullptr; - g_pCompositor->focusSurface(foundSurface); + g_pSeatManager->setPointerFocus(foundSurface, surfaceCoords); + g_pSeatManager->sendPointerMotion(time, surfaceCoords); - const auto SURFACELOCAL = mouseCoords - surfacePos; - g_pSeatManager->setPointerFocus(foundSurface, SURFACELOCAL); - g_pSeatManager->sendPointerMotion(time, SURFACELOCAL); return; } |
