Popups: calling OpenPopup() on already open popup doesn't close it's child (#126)

It think it makes more sense? Maybe?
Note that calling OpenPopup() every frame probably doesn't make sense.
This commit is contained in:
ocornut 2015-05-28 23:37:11 +01:00
parent 7847100ad8
commit 78dc54ab3d

View File

@ -3054,9 +3054,12 @@ void ImGui::OpenPopup(const char* str_id)
ImGuiState& g = *GImGui; ImGuiState& g = *GImGui;
ImGuiWindow* window = GetCurrentWindow(); ImGuiWindow* window = GetCurrentWindow();
const ImGuiID id = window->GetID(str_id); const ImGuiID id = window->GetID(str_id);
g.OpenedPopupStack.resize(g.CurrentPopupStack.size() + 1); size_t current_stack_size = g.CurrentPopupStack.size();
if (g.OpenedPopupStack.back().PopupID != id) ImGuiPopupRef popup_ref = ImGuiPopupRef(id, window, window->GetID("##menus")); // Tagged as new ref because constructor sets Window to NULL (we are passing the ParentWindow info here)
g.OpenedPopupStack.back() = ImGuiPopupRef(id, window, window->GetID("##menus")); if (g.OpenedPopupStack.size() < current_stack_size + 1)
g.OpenedPopupStack.push_back(popup_ref);
else if (g.OpenedPopupStack[current_stack_size].PopupID != id)
g.OpenedPopupStack[current_stack_size] = popup_ref;
} }
static void CloseInactivePopups() static void CloseInactivePopups()