mirror of
https://github.com/Drezil/imgui.git
synced 2025-09-19 01:23:14 +02:00
Combo: Fixed not reusing windows optimally when used inside a popup stack.
This commit is contained in:
@ -6434,7 +6434,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||
window_stack_data.StackSizesOnBegin.SetToContextState(&g);
|
||||
g.CurrentWindowStack.push_back(window_stack_data);
|
||||
if (flags & ImGuiWindowFlags_ChildMenu)
|
||||
g.BeginMenuCount++;
|
||||
g.BeginMenuDepth++;
|
||||
|
||||
// Update ->RootWindow and others pointers (before any possible call to FocusWindow)
|
||||
if (first_begin_of_the_frame)
|
||||
@ -7106,7 +7106,7 @@ void ImGui::End()
|
||||
// Pop from window stack
|
||||
g.LastItemData = g.CurrentWindowStack.back().ParentLastItemDataBackup;
|
||||
if (window->Flags & ImGuiWindowFlags_ChildMenu)
|
||||
g.BeginMenuCount--;
|
||||
g.BeginMenuDepth--;
|
||||
if (window->Flags & ImGuiWindowFlags_Popup)
|
||||
g.BeginPopupStack.pop_back();
|
||||
g.CurrentWindowStack.back().StackSizesOnBegin.CompareWithContextState(&g);
|
||||
@ -10926,7 +10926,7 @@ bool ImGui::BeginPopupEx(ImGuiID id, ImGuiWindowFlags flags)
|
||||
|
||||
char name[20];
|
||||
if (flags & ImGuiWindowFlags_ChildMenu)
|
||||
ImFormatString(name, IM_ARRAYSIZE(name), "##Menu_%02d", g.BeginMenuCount); // Recycle windows based on depth
|
||||
ImFormatString(name, IM_ARRAYSIZE(name), "##Menu_%02d", g.BeginMenuDepth); // 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
|
||||
|
||||
|
Reference in New Issue
Block a user