From 612b787b0d594d878117fe05732eee8e01e45cff Mon Sep 17 00:00:00 2001 From: ocornut Date: Tue, 21 Dec 2021 15:05:10 +0100 Subject: [PATCH] Menus: fixed top-level menu from not consistently using style.PopupRounding. (#4788) + Stack tool default size. --- docs/CHANGELOG.txt | 1 + imgui.cpp | 4 +++- imgui_widgets.cpp | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 9caacb13105b..b9b7ad7dd27a 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -74,6 +74,7 @@ Other Changes: - Menus: fixed closing a menu by clicking on its menu-bar item when inside a popup. (#3496, #4797) [@xndcn] - Menus: fixed menu inside a popup/modal not inhibiting hovering of items in the popup/modal. (#3496, #4797) - Menus: fixed sub-menu items inside a popups from closing the popup. +- Menus: fixed top-level menu from not consistently using style.PopupRounding. (#4788) - InputText, Nav: fixed repeated calls to SetKeyboardFocusHere() preventing to use InputText(). (#4682) - Inputtext, Nav: fixed using SetKeyboardFocusHere() on InputTextMultiline(). (#4761) - InputText: made double-click select word, triple-line select line. Word delimitation logic differs diff --git a/imgui.cpp b/imgui.cpp index 79c9fe643b76..9be374c36972 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -12530,6 +12530,9 @@ void ImGui::DebugHookIdInfo(ImGuiID id, ImGuiDataType data_type, const void* dat // Stack Tool: Display UI void ImGui::ShowStackToolWindow(bool* p_open) { + ImGuiContext& g = *GImGui; + if (!(g.NextWindowData.Flags & ImGuiNextWindowDataFlags_HasSize)) + SetNextWindowSize(ImVec2(0.0f, GetFontSize() * 8.0f), ImGuiCond_FirstUseEver); if (!Begin("Dear ImGui Stack Tool", p_open) || GetCurrentWindow()->BeginCount > 1) { End(); @@ -12537,7 +12540,6 @@ void ImGui::ShowStackToolWindow(bool* p_open) } // Display hovered/active status - ImGuiContext& g = *GImGui; const ImGuiID hovered_id = g.HoveredIdPreviousFrame; const ImGuiID active_id = g.ActiveId; #ifdef IMGUI_ENABLE_TEST_ENGINE diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 0de14bf82f2d..021c31b7d933 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -7050,7 +7050,9 @@ bool ImGui::BeginMenuEx(const char* label, const char* icon, bool enabled) if (menu_is_open) { SetNextWindowPos(popup_pos, ImGuiCond_Always); // Note: this is super misleading! The value will serve as reference for FindBestWindowPosForPopup(), not actual pos. + PushStyleVar(ImGuiStyleVar_ChildRounding, style.PopupRounding); // First level will use _PopupRounding, subsequent will use _ChildRounding menu_is_open = BeginPopupEx(id, flags); // menu_is_open can be 'false' when the popup is completely clipped (e.g. zero size display) + PopStyleVar(); } else {