summaryrefslogtreecommitdiff
path: root/src/protocols/XDGShell.cpp
diff options
context:
space:
mode:
authorVaxry <vaxry@vaxry.net>2024-06-07 18:42:31 +0200
committerVaxry <vaxry@vaxry.net>2024-06-07 18:42:38 +0200
commitd6337146bb99a20c96c89b7693f4ad726455f6ba (patch)
tree98d1566a7de03bb9a739c29719e674c4d8cb2bf7 /src/protocols/XDGShell.cpp
parent429cff340de68b3bfa4790062734c23fcbf26088 (diff)
xdg_shell: improve xdg_positioner resize calculations
ref #6240
Diffstat (limited to 'src/protocols/XDGShell.cpp')
-rw-r--r--src/protocols/XDGShell.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/protocols/XDGShell.cpp b/src/protocols/XDGShell.cpp
index cbb93de9..b192b43c 100644
--- a/src/protocols/XDGShell.cpp
+++ b/src/protocols/XDGShell.cpp
@@ -528,7 +528,7 @@ CBox CXDGPositionerRules::getPosition(const CBox& constraint, const Vector2D& pa
bool success = predictedBox.inside(constraint);
if (success)
- return predictedBox.translate(-parentCoord - constraint.pos());
+ return predictedBox;
if (state.constraintAdjustment & (XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_FLIP_X | XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_FLIP_Y)) {
// attempt to flip
@@ -547,7 +547,7 @@ CBox CXDGPositionerRules::getPosition(const CBox& constraint, const Vector2D& pa
success = false;
if (success)
- return test.translate(-parentCoord - constraint.pos());
+ return test;
}
// if flips fail, we will slide and remember.
@@ -584,7 +584,7 @@ CBox CXDGPositionerRules::getPosition(const CBox& constraint, const Vector2D& pa
success = test.copy().expand(-1).inside(constraint);
if (success)
- return test.translate(-parentCoord - constraint.pos());
+ return test;
}
if (state.constraintAdjustment & (XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_RESIZE_X | XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_RESIZE_Y)) {
@@ -602,18 +602,18 @@ CBox CXDGPositionerRules::getPosition(const CBox& constraint, const Vector2D& pa
test.x = constraint.x + EDGE_PADDING;
}
if (rightEdgeOut && resizeX)
- test.w = -(constraint.w + constraint.x - test.w - test.x + EDGE_PADDING);
+ test.w = constraint.w - (test.x - constraint.w) - EDGE_PADDING;
if (topEdgeOut && resizeY) {
test.h = test.y + test.h - constraint.y - EDGE_PADDING;
test.y = constraint.y + EDGE_PADDING;
}
if (bottomEdgeOut && resizeY)
- test.h = -(constraint.h + constraint.y - test.h - test.y + EDGE_PADDING);
+ test.h = constraint.h - (test.y - constraint.y) - EDGE_PADDING;
success = test.copy().expand(-1).inside(constraint);
if (success)
- return test.translate(parentCoord - constraint.pos());
+ return test;
}
LOGM(WARN, "Compositor/client bug: xdg_positioner couldn't find a place");