From 10a0eb3e1c31b8b6b6595ce75e8d65ec984b2ff9 Mon Sep 17 00:00:00 2001 From: ocornut Date: Mon, 19 May 2025 18:40:45 +0200 Subject: [PATCH] Alter windows min/max size logic to prioritize enforcing size_max bounds rather than size_min. Docking branch until now used the opposite, aka ImClamp(size_desired, size_min, ImMax(size_min, size_max));, will be standardized across branches. --- imgui.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imgui.cpp b/imgui.cpp index 6150475b0..b5d6b802d 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -6408,7 +6408,7 @@ static ImVec2 CalcWindowAutoFitSize(ImGuiWindow* window, const ImVec2& size_cont // Maximum window size is determined by the viewport size or monitor size ImVec2 size_min = CalcWindowMinSize(window); ImVec2 size_max = ((window->Flags & ImGuiWindowFlags_ChildWindow) && !(window->Flags & ImGuiWindowFlags_Popup)) ? ImVec2(FLT_MAX, FLT_MAX) : ImGui::GetMainViewport()->WorkSize - style.DisplaySafeAreaPadding * 2.0f; - ImVec2 size_auto_fit = ImClamp(size_desired, size_min, size_max); + ImVec2 size_auto_fit = ImClamp(size_desired, ImMin(size_min, size_max), size_max); // FIXME: CalcWindowAutoFitSize() doesn't take into account that only one axis may be auto-fit when calculating scrollbars, // we may need to compute/store three variants of size_auto_fit, for x/y/xy.