|
2 | 2 | #include "../../Compositor.hpp" |
3 | 3 | #include <aquamarine/output/Output.hpp> |
4 | 4 | #include <cstdint> |
| 5 | +#include <hyprutils/math/Vector2D.hpp> |
5 | 6 | #include <ranges> |
6 | 7 | #include "../../config/ConfigValue.hpp" |
7 | 8 | #include "../../config/ConfigManager.hpp" |
@@ -249,15 +250,29 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) { |
249 | 250 | g_pCompositor->setActiveMonitor(PMONITOR); |
250 | 251 |
|
251 | 252 | if (g_pSessionLockManager->isSessionLocked()) { |
| 253 | + |
| 254 | + // set keyboard focus on session lock surface regardless of layers |
252 | 255 | const auto PSESSIONLOCKSURFACE = g_pSessionLockManager->getSessionLockSurfaceForMonitor(PMONITOR->ID); |
253 | | - surfacePos = PMONITOR->vecPosition; |
| 256 | + const auto foundLockSurface = PSESSIONLOCKSURFACE ? PSESSIONLOCKSURFACE->surface->surface() : nullptr; |
| 257 | + |
| 258 | + g_pCompositor->focusSurface(foundLockSurface); |
| 259 | + |
| 260 | + // search for interactable abovelock surfaces for pointer focus, or use session lock surface if not found |
| 261 | + for (auto& lsl : PMONITOR->m_aLayerSurfaceLayers | std::views::reverse) { |
| 262 | + foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &lsl, &surfaceCoords, &pFoundLayerSurface, true); |
| 263 | + |
| 264 | + if (foundSurface) |
| 265 | + break; |
| 266 | + } |
| 267 | + |
| 268 | + if (!foundSurface) { |
| 269 | + surfaceCoords = mouseCoords - PMONITOR->vecPosition; |
| 270 | + foundSurface = foundLockSurface; |
| 271 | + } |
254 | 272 |
|
255 | | - foundSurface = PSESSIONLOCKSURFACE ? PSESSIONLOCKSURFACE->surface->surface() : nullptr; |
256 | | - g_pCompositor->focusSurface(foundSurface); |
| 273 | + g_pSeatManager->setPointerFocus(foundSurface, surfaceCoords); |
| 274 | + g_pSeatManager->sendPointerMotion(time, surfaceCoords); |
257 | 275 |
|
258 | | - const auto SURFACELOCAL = mouseCoords - surfacePos; |
259 | | - g_pSeatManager->setPointerFocus(foundSurface, SURFACELOCAL); |
260 | | - g_pSeatManager->sendPointerMotion(time, SURFACELOCAL); |
261 | 276 | return; |
262 | 277 | } |
263 | 278 |
|
|
0 commit comments