aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMariuszTrybus <[email protected]>2024-06-22 17:05:05 +0200
committerGitHub <[email protected]>2024-06-22 17:05:05 +0200
commit0b924f541c744f96d32c9a0d98dcfd90205bab4c (patch)
treee5e66cb93c1342d09b115ab1f1c30890d99f1f4f
parent4778afe2e6b4a6f8c7d218ccd8fe7e0bd4d2ee9c (diff)
downloadHyprland-0b924f541c744f96d32c9a0d98dcfd90205bab4c.tar.gz
Hyprland-0b924f541c744f96d32c9a0d98dcfd90205bab4c.zip
constraints: Lock surface region when region is empty (#6627)
* Pointer constraints: Lock surface region when region is empty * Format code
-rw-r--r--src/protocols/PointerConstraints.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/protocols/PointerConstraints.cpp b/src/protocols/PointerConstraints.cpp
index c7b78a5b..a17fa6cd 100644
--- a/src/protocols/PointerConstraints.cpp
+++ b/src/protocols/PointerConstraints.cpp
@@ -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;