From 341e04a36ce5254315a40c563ea7f5d891b289e8 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Fri, 2 Feb 2024 15:04:04 +0000 Subject: dwindle: avoid sending negative sizes to wlr fixes #4591 --- src/helpers/Box.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/helpers/Box.cpp') diff --git a/src/helpers/Box.cpp b/src/helpers/Box.cpp index 3d57bc79..d3f5d36c 100644 --- a/src/helpers/Box.cpp +++ b/src/helpers/Box.cpp @@ -105,6 +105,13 @@ CBox& CBox::expand(const double& value) { return *this; } +CBox& CBox::noNegativeSize() { + std::clamp(w, 0.0, std::numeric_limits::infinity()); + std::clamp(h, 0.0, std::numeric_limits::infinity()); + + return *this; +} + CBox CBox::roundInternal() { float newW = x + w - std::floor(x); float newH = y + h - std::floor(y); -- cgit v1.2.3