mirror of
https://github.com/hyprwm/Hyprland
synced 2026-05-07 15:58:02 +02:00
InputManager: add guards to confineToRegion to avoid issues (#14269)
This commit is contained in:
parent
aa5e38041e
commit
90fe7c6569
1 changed files with 6 additions and 0 deletions
|
|
@ -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, {}, {});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue