diff options
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; } |
