Skip to content

Commit

Permalink
constraints: Lock surface region when region is empty (#6627)
Browse files Browse the repository at this point in the history
* Pointer constraints: Lock surface region when region is empty

* Format code
  • Loading branch information
MariuszTrybus authored Jun 22, 2024
1 parent 4778afe commit 0b924f5
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/protocols/PointerConstraints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,15 @@ SP<CWLSurface> CPointerConstraint::owner() {
}

CRegion CPointerConstraint::logicConstraintRegion() {
CRegion rg = region;
const auto SURFBOX = pHLSurface->getSurfaceBoxGlobal();
CRegion rg = region;
const auto SURFBOX = pHLSurface->getSurfaceBoxGlobal();

// if region wasn't set in pointer-constraints request take surface region
if (rg.empty() && SURFBOX.has_value()) {
rg.set(SURFBOX.value());
return rg;
}

const auto CONSTRAINTPOS = SURFBOX.has_value() ? SURFBOX->pos() : Vector2D{};
rg.translate(CONSTRAINTPOS);
return rg;
Expand Down

0 comments on commit 0b924f5

Please sign in to comment.