Browse Source

Docking: Fixed reappearing docked windows with no close button showing a tab with extraneous space for one frame.

pull/4076/head
ocornut 4 years ago
parent
commit
646c873598
  1. 3
      docs/CHANGELOG.txt
  2. 9
      imgui.cpp
  3. 3
      imgui_widgets.cpp

3
docs/CHANGELOG.txt

@ -138,7 +138,8 @@ Docking Branch:
- Docking: Dockspace() never draws a background. (#3924) - 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: 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 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) - 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: GLFW: Add a workaround for stuck keys after closing a GLFW window (#3837).
- Backends, Viewports: Vulkan: Rebuild swapchain on VK_SUBOPTIMAL_KHR. (#3881) - Backends, Viewports: Vulkan: Rebuild swapchain on VK_SUBOPTIMAL_KHR. (#3881)

9
imgui.cpp

@ -16260,7 +16260,12 @@ void ImGui::ShowMetricsWindow(bool* p_open)
if (TreeNode("TabBars", "Tab Bars (%d)", g.TabBars.GetSize())) if (TreeNode("TabBars", "Tab Bars (%d)", g.TabBars.GetSize()))
{ {
for (int n = 0; n < g.TabBars.GetSize(); n++) 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(); TreePop();
} }
@ -16702,7 +16707,7 @@ void ImGui::DebugNodeTabBar(ImGuiTabBar* tab_bar, const char* label)
} }
p += ImFormatString(p, buf_end - p, (tab_bar->Tabs.Size > 3) ? " ... }" : " } "); p += ImFormatString(p, buf_end - p, (tab_bar->Tabs.Size > 3) ? " ... }" : " } ");
if (!is_active) { PushStyleColor(ImGuiCol_Text, GetStyleColorVec4(ImGuiCol_TextDisabled)); } 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) { PopStyleColor(); }
if (is_active && IsItemHovered()) if (is_active && IsItemHovered())
{ {

3
imgui_widgets.cpp

@ -7422,6 +7422,9 @@ void ImGui::TabBarAddTab(ImGuiTabBar* tab_bar, ImGuiTabItemFlags tab_flags, ImGu
IM_ASSERT(TabBarFindTabByID(tab_bar, window->ID) == NULL); 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) 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; ImGuiTabItem new_tab;
new_tab.ID = window->ID; new_tab.ID = window->ID;
new_tab.Flags = tab_flags; new_tab.Flags = tab_flags;

Loading…
Cancel
Save