diff options
| author | fazzi <18248986+fxzzi@users.noreply.github.com> | 2026-05-03 15:00:16 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-05-03 15:00:16 +0100 |
| commit | 90fe7c6569e3ea900cdc664a13368e52c986165d (patch) | |
| tree | cb5f93200264a9b406e608435b5e455eb630aa02 /src/managers/input/InputManager.cpp | |
| parent | aa5e38041ed332416ac2f5ace908389c35b28192 (diff) | |
InputManager: add guards to confineToRegion to avoid issues (#14269)
Diffstat (limited to 'src/managers/input/InputManager.cpp')
| -rw-r--r-- | src/managers/input/InputManager.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index 2f9b64a3..b6f38433 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -266,11 +266,17 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse, st // constraints auto confineToRegion = [&](const CRegion& rg, SP<Desktop::View::CWLSurface> surf) { + if (!surf) + return; + const auto CLOSEST = rg.closestPoint(mouseCoords); const auto BOX = surf->getSurfaceBoxGlobal(); const auto WINDOW = Desktop::View::CWindow::fromView(surf->view()); const auto CLOSESTLOCAL = (CLOSEST - (BOX.has_value() ? BOX->pos() : Vector2D{})) * (WINDOW ? WINDOW->m_X11SurfaceScaledBy : 1.0); + if (g_pSeatManager->m_state.pointerFocus != surf->resource()) + g_pSeatManager->setPointerFocus(surf->resource(), CLOSESTLOCAL); + g_pCompositor->warpCursorTo(CLOSEST, true); g_pSeatManager->sendPointerMotion(time, CLOSESTLOCAL); PROTO::relativePointer->sendRelativeMotion(sc<uint64_t>(time) * 1000, {}, {}); |
