From 0836f69d9b27c6858b33bea9672f77dc700ec75b Mon Sep 17 00:00:00 2001 From: ocornut Date: Sun, 24 May 2015 23:56:29 +0100 Subject: [PATCH] WIP Menus: Fixed style.WindowPadding == 0 leading to zero-sized initial clipping rectangle leading to self-collapsing childs (#126) --- imgui.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 9add2701..f1d211dc 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -3821,8 +3821,11 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_ IM_ASSERT((flags & ImGuiWindowFlags_NoTitleBar) != 0); window->Collapsed = parent_window && parent_window->Collapsed; - const ImVec4 clip_rect_t = window->ClipRectStack.back(); - window->Collapsed |= (clip_rect_t.x >= clip_rect_t.z || clip_rect_t.y >= clip_rect_t.w); + if (!(flags & ImGuiWindowFlags_AlwaysAutoResize) && window->AutoFitFrames <= 0) + { + const ImVec4 clip_rect_t = window->ClipRectStack.back(); + window->Collapsed |= (clip_rect_t.x >= clip_rect_t.z || clip_rect_t.y >= clip_rect_t.w); + } // We also hide the window from rendering because we've already added its border to the command list. // (we could perform the check earlier in the function but it is simpler at this point)