mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-06 23:21:57 -07:00
@@ -144,26 +144,25 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
|
||||
} else {
|
||||
// Native Wayland apps know how 2 constrain themselves.
|
||||
// XWayland, we just have to accept them. Might cause issues, but thats XWayland for ya.
|
||||
const auto CONSTRAINTPOS =
|
||||
CONSTRAINTWINDOW->m_bIsX11 ? Vector2D(CONSTRAINTWINDOW->m_uSurface.xwayland->x, CONSTRAINTWINDOW->m_uSurface.xwayland->y) : CONSTRAINTWINDOW->m_vRealPosition.vec();
|
||||
const auto CONSTRAINTSIZE = CONSTRAINTWINDOW->m_bIsX11 ? Vector2D(CONSTRAINTWINDOW->m_uSurface.xwayland->width, CONSTRAINTWINDOW->m_uSurface.xwayland->height) :
|
||||
CONSTRAINTWINDOW->m_vRealSize.vec();
|
||||
const auto CONSTRAINTPOS = PCONSTRAINT->getLogicConstraintPos();
|
||||
const auto CONSTRAINTSIZE = PCONSTRAINT->getLogicConstraintSize();
|
||||
|
||||
if (g_pCompositor->m_sSeat.mouse->currentConstraint->type == WLR_POINTER_CONSTRAINT_V1_LOCKED) {
|
||||
// we just snap the cursor to where it should be.
|
||||
|
||||
Vector2D hint = {PCONSTRAINT->positionHint.x, PCONSTRAINT->positionHint.y};
|
||||
|
||||
if (hint != Vector2D{-1, -1})
|
||||
wlr_cursor_warp_closest(g_pCompositor->m_sWLRCursor, g_pCompositor->m_sSeat.mouse->mouse, CONSTRAINTPOS.x + hint.x, CONSTRAINTPOS.y + hint.y);
|
||||
if (PCONSTRAINT->hintSet)
|
||||
wlr_cursor_warp_closest(g_pCompositor->m_sWLRCursor, g_pCompositor->m_sSeat.mouse->mouse, CONSTRAINTPOS.x + PCONSTRAINT->positionHint.x,
|
||||
CONSTRAINTPOS.y + PCONSTRAINT->positionHint.y);
|
||||
|
||||
return; // don't process anything else, the cursor is locked. The surface should not receive any further events.
|
||||
// these are usually FPS games. They will use the relative motion.
|
||||
} else {
|
||||
// we restrict the cursor to the confined region
|
||||
if (!pixman_region32_contains_point(&PCONSTRAINT->constraint->region, mouseCoords.x - CONSTRAINTPOS.x, mouseCoords.y - CONSTRAINTPOS.y, nullptr)) {
|
||||
const auto REGION = PCONSTRAINT->getLogicCoordsRegion();
|
||||
|
||||
if (!REGION.containsPoint(mouseCoords)) {
|
||||
if (g_pCompositor->m_sSeat.mouse->constraintActive) {
|
||||
const auto CLOSEST = CRegion(&PCONSTRAINT->constraint->region).closestPoint(mouseCoords - CONSTRAINTPOS) + CONSTRAINTPOS;
|
||||
const auto CLOSEST = REGION.closestPoint(mouseCoords);
|
||||
wlr_cursor_warp_closest(g_pCompositor->m_sWLRCursor, NULL, CLOSEST.x, CLOSEST.y);
|
||||
mouseCoords = getMouseCoordsInternal();
|
||||
}
|
||||
@@ -1595,7 +1594,7 @@ void CInputManager::setCursorIconOnBorder(CWindow* w) {
|
||||
wlr_box box = {w->m_vRealPosition.vec().x, w->m_vRealPosition.vec().y, w->m_vRealSize.vec().x, w->m_vRealSize.vec().y};
|
||||
eBorderIconDirection direction = BORDERICON_NONE;
|
||||
wlr_box boxFullGrabInput = {box.x - *PEXTENDBORDERGRAB - BORDERSIZE, box.y - *PEXTENDBORDERGRAB - BORDERSIZE, box.width + 2 * (*PEXTENDBORDERGRAB + BORDERSIZE),
|
||||
box.height + 2 * (*PEXTENDBORDERGRAB + BORDERSIZE)};
|
||||
box.height + 2 * (*PEXTENDBORDERGRAB + BORDERSIZE)};
|
||||
|
||||
if (!wlr_box_contains_point(&boxFullGrabInput, mouseCoords.x, mouseCoords.y) || (!m_lCurrentlyHeldButtons.empty() && !currentlyDraggedWindow)) {
|
||||
direction = BORDERICON_NONE;
|
||||
|
Reference in New Issue
Block a user