desktop/reservedArea: clamp to 0

ref https://github.com/hyprwm/Hyprland/discussions/12880
This commit is contained in:
Vaxry 2026-01-08 12:24:29 +01:00
parent 3aa4e02720
commit f54dd4da4a
No known key found for this signature in database
GPG key ID: 665806380871D640

View file

@ -6,11 +6,12 @@ using namespace Desktop;
// fuck me. Writing this at 11pm, and I have an in-class test tomorrow.
// I am failing that bitch
CReservedArea::CReservedArea(const Vector2D& tl, const Vector2D& br) : m_initialTopLeft(tl), m_initialBottomRight(br) {
CReservedArea::CReservedArea(const Vector2D& tl, const Vector2D& br) : m_initialTopLeft(tl.clamp({0, 0})), m_initialBottomRight(br.clamp({0, 0})) {
calculate();
}
CReservedArea::CReservedArea(double top, double right, double bottom, double left) : m_initialTopLeft(left, top), m_initialBottomRight(right, bottom) {
CReservedArea::CReservedArea(double top, double right, double bottom, double left) :
m_initialTopLeft(std::max(left, 0.0), std::max(top, 0.0)), m_initialBottomRight(std::max(right, 0.0), std::max(bottom, 0.0)) {
calculate();
}