input: Rewritten pointer constraints (#4889)

* rewritten constraints

* send pointer enter on activate if not pointer focus

* minor cleanup

* simulate movement on commit

* don't ignore oneshot prop

* various fixes

* dont send motion on confined

* update pos hint on region change
This commit is contained in:
Vaxry
2024-03-02 21:04:55 +00:00
committed by GitHub
parent 328ab43165
commit d72ea5f2a7
14 changed files with 282 additions and 386 deletions

View File

@@ -157,20 +157,14 @@ struct SKeyboard {
};
struct SMouse {
wlr_input_device* mouse = nullptr;
wlr_input_device* mouse = nullptr;
wlr_pointer_constraint_v1* currentConstraint = nullptr;
bool constraintActive = false;
std::string name = "";
CRegion confinedTo;
bool virt = false;
std::string name = "";
bool connected = false; // means connected to the cursor
bool virt = false;
bool connected = false; // means connected to the cursor
DYNLISTENER(commitConstraint);
DYNLISTENER(destroyMouse);
bool operator==(const SMouse& b) const {
@@ -178,29 +172,6 @@ struct SMouse {
}
};
struct SConstraint {
SMouse* pMouse = nullptr;
wlr_pointer_constraint_v1* constraint = nullptr;
bool active = false;
bool hintSet = false;
Vector2D positionHint = {-1, -1}; // the position hint, but will use cursorPosOnActivate if unset
Vector2D cursorPosOnActivate = {-1, -1};
DYNLISTENER(setConstraintRegion);
DYNLISTENER(destroyConstraint);
CRegion getLogicCoordsRegion();
Vector2D getLogicConstraintPos();
Vector2D getLogicConstraintSize();
//
bool operator==(const SConstraint& b) const {
return constraint == b.constraint;
}
};
class CMonitor;
struct SSeat {