Skip to content

Commit

Permalink
Docking: Fixed reappearing docked windows with no close button showin…
Browse files Browse the repository at this point in the history
…g a tab with extraneous space for one frame.
  • Loading branch information
ocornut committed Apr 13, 2021
1 parent e87dd0e commit 646c873
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
3 changes: 2 additions & 1 deletion docs/CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ Docking Branch:
- Docking: Dockspace() never draws a background. (#3924)
- Docking: undocking nodes/windows covering most of the monitor max their size down to 90% to ease further manipulations.
- Docking: Fixed restoring of tab order within a dockspace or a split node.
- Docking: Fixed multiple simultaneously reappearing window from appearing undocked in their initial frame.
- Docking: Fixed reappearing docked windows with no close button showing a tab with extraneous space for one frame.
- Docking: Fixed multiple simultaneously reappearing window from appearing undocked for one frame.
- Viewports: Hotfix for crash in monitor array access, caused by 4b9bc4902. (#3967)
- Backends, Viewports: GLFW: Add a workaround for stuck keys after closing a GLFW window (#3837).
- Backends, Viewports: Vulkan: Rebuild swapchain on VK_SUBOPTIMAL_KHR. (#3881)
Expand Down
9 changes: 7 additions & 2 deletions imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16260,7 +16260,12 @@ void ImGui::ShowMetricsWindow(bool* p_open)
if (TreeNode("TabBars", "Tab Bars (%d)", g.TabBars.GetSize()))
{
for (int n = 0; n < g.TabBars.GetSize(); n++)
DebugNodeTabBar(g.TabBars.GetByIndex(n), "TabBar");
{
ImGuiTabBar* tab_bar = g.TabBars.GetByIndex(n);
PushID(tab_bar);
DebugNodeTabBar(tab_bar, "TabBar");
PopID();
}
TreePop();
}

Expand Down Expand Up @@ -16702,7 +16707,7 @@ void ImGui::DebugNodeTabBar(ImGuiTabBar* tab_bar, const char* label)
}
p += ImFormatString(p, buf_end - p, (tab_bar->Tabs.Size > 3) ? " ... }" : " } ");
if (!is_active) { PushStyleColor(ImGuiCol_Text, GetStyleColorVec4(ImGuiCol_TextDisabled)); }
bool open = TreeNode(tab_bar, "%s", buf);
bool open = TreeNode(label, "%s", buf);
if (!is_active) { PopStyleColor(); }
if (is_active && IsItemHovered())
{
Expand Down
3 changes: 3 additions & 0 deletions imgui_widgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7422,6 +7422,9 @@ void ImGui::TabBarAddTab(ImGuiTabBar* tab_bar, ImGuiTabItemFlags tab_flags, ImGu
IM_ASSERT(TabBarFindTabByID(tab_bar, window->ID) == NULL);
IM_ASSERT(g.CurrentTabBar != tab_bar); // Can't work while the tab bar is active as our tab doesn't have an X offset yet, in theory we could/should test something like (tab_bar->CurrFrameVisible < g.FrameCount) but we'd need to solve why triggers the commented early-out assert in BeginTabBarEx() (probably dock node going from implicit to explicit in same frame)

if (!window->HasCloseButton)
tab_flags |= ImGuiTabItemFlags_NoCloseButton; // Set _NoCloseButton immediately because it will be used for first-frame width calculation.

ImGuiTabItem new_tab;
new_tab.ID = window->ID;
new_tab.Flags = tab_flags;
Expand Down

0 comments on commit 646c873

Please sign in to comment.