From 3fe7571164c5576e2ba27a17e7728e3cba5dcbef Mon Sep 17 00:00:00 2001 From: xnep1 Date: Wed, 19 Feb 2025 07:29:52 -0300 Subject: [PATCH] chore: minor cleanup --- src/protocols/PointerConstraints.cpp | 25 +++---------------------- src/protocols/PointerConstraints.hpp | 7 +------ 2 files changed, 4 insertions(+), 28 deletions(-) diff --git a/src/protocols/PointerConstraints.cpp b/src/protocols/PointerConstraints.cpp index e3250e897a9..0a93d3327a8 100644 --- a/src/protocols/PointerConstraints.cpp +++ b/src/protocols/PointerConstraints.cpp @@ -93,9 +93,6 @@ void CPointerConstraint::sharedConstructions() { } cursorPosOnActivate = g_pInputManager->getMouseCoordsInternal(); - - if (g_pCompositor->m_pLastFocus == pHLSurface->resource()) - activate(); } bool CPointerConstraint::good() { @@ -111,8 +108,7 @@ void CPointerConstraint::deactivate() { else resourceC->sendUnconfined(); - pendingActivation = false; - active = false; + active = false; if (lifetime == ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ONESHOT) { dead = true; @@ -128,13 +124,7 @@ void CPointerConstraint::activate() { if (dead || active) return; - if (!attached) { - pendingActivation = true; - return; - } - pendingActivation = false; - - //TODO: hack, probably not a super duper great idea + // TODO: hack, probably not a super duper great idea if (g_pSeatManager->state.pointerFocus != pHLSurface->resource()) { const auto SURFBOX = pHLSurface->getSurfaceBoxGlobal(); const auto LOCAL = SURFBOX.has_value() ? logicPositionHint() - SURFBOX->pos() : Vector2D{}; @@ -155,14 +145,6 @@ bool CPointerConstraint::isActive() { return active; } -void CPointerConstraint::setAttached() { - attached = true; -} - -bool CPointerConstraint::isActivationPending() { - return pendingActivation; -} - void CPointerConstraint::onSetRegion(wl_resource* wlRegion) { if (!wlRegion) { region.clear(); @@ -260,8 +242,7 @@ void CPointerConstraintsProtocol::onNewConstraint(SP constra g_pInputManager->m_vConstraints.emplace_back(constraint); - constraint->setAttached(); - if (constraint->isActivationPending()) + if (g_pCompositor->m_pLastFocus == OWNER->resource()) constraint->activate(); } diff --git a/src/protocols/PointerConstraints.hpp b/src/protocols/PointerConstraints.hpp index 09d77f4070a..1cd2fca9535 100644 --- a/src/protocols/PointerConstraints.hpp +++ b/src/protocols/PointerConstraints.hpp @@ -24,9 +24,6 @@ class CPointerConstraint { void activate(); bool isActive(); - void setAttached(); - bool isActivationPending(); - SP owner(); CRegion logicConstraintRegion(); @@ -45,8 +42,6 @@ class CPointerConstraint { Vector2D positionHint = {-1, -1}; Vector2D cursorPosOnActivate = {-1, -1}; bool active = false; - bool attached = false; - bool pendingActivation = false; bool locked = false; bool dead = false; zwpPointerConstraintsV1Lifetime lifetime = ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ONESHOT; @@ -81,4 +76,4 @@ class CPointerConstraintsProtocol : public IWaylandProtocol { namespace PROTO { inline UP constraints; -}; +}; \ No newline at end of file