|
@@ -5990,6 +5990,8 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|
|
window_stack_data.StackSizesOnBegin.SetToCurrentState();
|
|
|
g.CurrentWindowStack.push_back(window_stack_data);
|
|
|
g.CurrentWindow = NULL;
|
|
|
+ if (flags & ImGuiWindowFlags_ChildMenu)
|
|
|
+ g.BeginMenuCount++;
|
|
|
|
|
|
if (flags & ImGuiWindowFlags_Popup)
|
|
|
{
|
|
@@ -6595,6 +6597,8 @@ void ImGui::End()
|
|
|
|
|
|
// Pop from window stack
|
|
|
g.LastItemData = g.CurrentWindowStack.back().ParentLastItemDataBackup;
|
|
|
+ if (window->Flags & ImGuiWindowFlags_ChildMenu)
|
|
|
+ g.BeginMenuCount--;
|
|
|
if (window->Flags & ImGuiWindowFlags_Popup)
|
|
|
g.BeginPopupStack.pop_back();
|
|
|
g.CurrentWindowStack.back().StackSizesOnBegin.CompareWithCurrentState();
|
|
@@ -8710,7 +8714,7 @@ bool ImGui::BeginPopupEx(ImGuiID id, ImGuiWindowFlags flags)
|
|
|
|
|
|
char name[20];
|
|
|
if (flags & ImGuiWindowFlags_ChildMenu)
|
|
|
- ImFormatString(name, IM_ARRAYSIZE(name), "##Menu_%02d", g.BeginPopupStack.Size); // Recycle windows based on depth
|
|
|
+ ImFormatString(name, IM_ARRAYSIZE(name), "##Menu_%02d", g.BeginMenuCount); // Recycle windows based on depth
|
|
|
else
|
|
|
ImFormatString(name, IM_ARRAYSIZE(name), "##Popup_%08x", id); // Not recycling, so we can close/open during the same frame
|
|
|
|