From c31d9ef4172452f6f219f91d9b87a24d91f0cf3a Mon Sep 17 00:00:00 2001 From: Vaxry Date: Fri, 7 Jun 2024 20:23:35 +0200 Subject: [PATCH] xdg_shell: fix nested xdg_positioner calculations ref #6240 --- src/protocols/XDGShell.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/protocols/XDGShell.cpp b/src/protocols/XDGShell.cpp index 23148fab..80e3487d 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; + return predictedBox.translate(-parentCoord - constraint.pos()); 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; + return test.translate(-parentCoord - constraint.pos()); } // 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; + return test.translate(-parentCoord - constraint.pos()); } if (state.constraintAdjustment & (XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_RESIZE_X | XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_RESIZE_Y)) { @@ -613,7 +613,7 @@ CBox CXDGPositionerRules::getPosition(const CBox& constraint, const Vector2D& pa success = test.copy().expand(-1).inside(constraint); if (success) - return test; + return test.translate(-parentCoord - constraint.pos()); } LOGM(WARN, "Compositor/client bug: xdg_positioner couldn't find a place");