From 5a6b8e00dbd2271f433dfb5e1ec9b25ee9bf0781 Mon Sep 17 00:00:00 2001 From: omar Date: Tue, 11 Dec 2018 15:22:10 +0100 Subject: [PATCH] BeginTabBar: Fix to push the expected ID into the ID stack (instead of a hash's hash). (#261) --- imgui_widgets.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 8f524ba70..d08583a1f 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -6218,7 +6218,10 @@ bool ImGui::BeginTabItem(const char* label, bool* p_open, ImGuiTabItemFlags f ImGuiTabBar* tab_bar = g.CurrentTabBar.back(); bool ret = TabItemEx(tab_bar, label, p_open, flags); if (ret && !(flags & ImGuiTabItemFlags_NoPushId)) - PushID(tab_bar->Tabs[tab_bar->LastTabItemIdx].ID); + { + ImGuiTabItem* tab = &tab_bar->Tabs[tab_bar->LastTabItemIdx]; + g.CurrentWindow->IDStack.push_back(tab->ID); // We already hashed 'label' so push into the ID stack directly instead of doing another hash through PushID(label) + } return ret; } @@ -6232,7 +6235,7 @@ void ImGui::EndTabItem() ImGuiTabBar* tab_bar = g.CurrentTabBar.back(); ImGuiTabItem* tab = &tab_bar->Tabs[tab_bar->LastTabItemIdx]; if (!(tab->Flags & ImGuiTabItemFlags_NoPushId)) - PopID(); + g.CurrentWindow->IDStack.pop_back(); } bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, ImGuiTabItemFlags flags)