mirror of
https://github.com/hyprwm/Hyprland
synced 2025-02-17 03:42:08 +01:00
constraints: Lock surface region when region is empty (#6627)
* Pointer constraints: Lock surface region when region is empty * Format code
This commit is contained in:
parent
4778afe2e6
commit
0b924f541c
1 changed files with 9 additions and 2 deletions
|
@ -165,8 +165,15 @@ SP<CWLSurface> CPointerConstraint::owner() {
|
||||||
}
|
}
|
||||||
|
|
||||||
CRegion CPointerConstraint::logicConstraintRegion() {
|
CRegion CPointerConstraint::logicConstraintRegion() {
|
||||||
CRegion rg = region;
|
CRegion rg = region;
|
||||||
const auto SURFBOX = pHLSurface->getSurfaceBoxGlobal();
|
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{};
|
const auto CONSTRAINTPOS = SURFBOX.has_value() ? SURFBOX->pos() : Vector2D{};
|
||||||
rg.translate(CONSTRAINTPOS);
|
rg.translate(CONSTRAINTPOS);
|
||||||
return rg;
|
return rg;
|
||||||
|
|
Loading…
Add table
Reference in a new issue