[plasma/kwin] src: Fix geometry confining when resizing window by bottom-left corner
Vlad Zahorodnii <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit ca4bd9d09f99e10093a87d4edc61110b155c0051 by Vlad Zahorodnii.
Committed on 20/07/2026 at 06:36.
Pushed by vladz into branch 'master'.
Fix geometry confining when resizing window by bottom-left corner
The confining algorithm picks an anchor either in the top-left or the
top-right corner. So, the geometry constraining code has to do the same.
case Gravity::BottomLeft:
case Gravity::Bottom:
case Gravity::BottomRight:
constrainedRect.setTop(std::max(constrainedRect.top(), geometry.top() + minFrameSize.height()));
constrainedRect.setBottom(std::min(constrainedRect.bottom(), geometry.top() + maxFrameSize.height()));
break;
is rather for the case where the anchor lies at the bottom edge of the
window. It is a copy paste error.
This should fix issues such as a window getting unexpectedly shrunk or
grown when resizing by dragging the bottom-left or the bottom-right
corner.
M +3 -7 src/window.cpp
https://invent.kde.org/plasma/kwin/-/commit/ca4bd9d09f99e10093a87d4edc61110b155c0051
diff --git a/src/window.cpp b/src/window.cpp
index 6fa3db05d0d..c4fc876a672 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -1471,6 +1471,9 @@ std::optional<QPointF> Window::confineInteractiveResize(const RectF &geometry, G
case Gravity::TopLeft:
case Gravity::Top:
case Gravity::TopRight:
+ case Gravity::BottomLeft:
+ case Gravity::Bottom:
+ case Gravity::BottomRight:
constrainedRect.setBottom(std::min(constrainedRect.bottom(), geometry.bottom() - minFrameSize.height()));
constrainedRect.setTop(std::max(constrainedRect.top(), geometry.bottom() - maxFrameSize.height()));
break;
@@ -1479,13 +1482,6 @@ std::optional<QPointF> Window::confineInteractiveResize(const RectF &geometry, G
case Gravity::Right:
break;
- case Gravity::BottomLeft:
- case Gravity::Bottom:
- case Gravity::BottomRight:
- constrainedRect.setTop(std::max(constrainedRect.top(), geometry.top() + minFrameSize.height()));
- constrainedRect.setBottom(std::min(constrainedRect.bottom(), geometry.top() + maxFrameSize.height()));
- break;
-
case Gravity::None:
Q_UNREACHABLE();
}