diff options
| author | Vaxry <43317083+vaxerski@users.noreply.github.com> | 2025-12-27 12:43:45 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-27 12:43:45 +0100 |
| commit | 42447a50d6840c5e28bd58db1225bae2fd7d5ed0 (patch) | |
| tree | e73584ecd482bf5320a3e35f963a12787ce7cce5 /src/managers/XWaylandManager.cpp | |
| parent | d7f26038ee2b44f3d02fe2a7556bafb91a02f46e (diff) | |
rules/windowRuleApplicator: fix min/max size effects (#12491)
fixes #12412
Diffstat (limited to 'src/managers/XWaylandManager.cpp')
| -rw-r--r-- | src/managers/XWaylandManager.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/managers/XWaylandManager.cpp b/src/managers/XWaylandManager.cpp index ca65e934..c3c4f901 100644 --- a/src/managers/XWaylandManager.cpp +++ b/src/managers/XWaylandManager.cpp @@ -88,6 +88,14 @@ CBox CHyprXWaylandManager::getGeometryForWindow(PHLWINDOW pWindow) { else if (pWindow->m_xdgSurface) box = pWindow->m_xdgSurface->m_current.geometry; + Vector2D MINSIZE = pWindow->minSize().value_or(Vector2D{MIN_WINDOW_SIZE, MIN_WINDOW_SIZE}); + Vector2D MAXSIZE = pWindow->maxSize().value_or(Math::VECTOR2D_MAX); + + Vector2D oldSize = box.size(); + box.w = std::clamp(box.w, MINSIZE.x, MAXSIZE.x); + box.h = std::clamp(box.h, MINSIZE.y, MAXSIZE.y); + box.translate((oldSize - box.size()) / 2.F); + return box; } |
