From 0919501bb82e6ddd0b9f933450fd7764413f8da5 Mon Sep 17 00:00:00 2001 From: Fabio Kreusch Date: Mon, 12 Jan 2026 15:36:54 -0300 Subject: [PATCH] hyprscrolling: Fix issue with std:clamp and window size https://github.com/hyprwm/hyprland-plugins/issues/567 --- hyprscrolling/Scrolling.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hyprscrolling/Scrolling.cpp b/hyprscrolling/Scrolling.cpp index bd9613c..c3ffee5 100644 --- a/hyprscrolling/Scrolling.cpp +++ b/hyprscrolling/Scrolling.cpp @@ -237,7 +237,9 @@ void SWorkspaceData::fitCol(SP c) { if (COL != c) currentLeft += ITEM_WIDTH; else { - leftOffset = std::clamp((double)leftOffset, currentLeft - USABLE.w + ITEM_WIDTH, currentLeft); + const double minOffset = currentLeft - USABLE.w + ITEM_WIDTH; + const double maxOffset = currentLeft; + leftOffset = std::clamp((double)leftOffset, std::min(minOffset, maxOffset), std::max(minOffset, maxOffset)); return; } }