Skip to content

Commit

Permalink
Docking: Fixed splitting/docking into a node that has buttons amended…
Browse files Browse the repository at this point in the history
… into tab bar. Windows were not moved correctly. (#5515)
  • Loading branch information
ocornut committed Aug 3, 2022
1 parent e21f462 commit 0abe7d1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14738,10 +14738,14 @@ static void ImGui::DockNodeMoveWindows(ImGuiDockNode* dst_node, ImGuiDockNode* s
src_node->TabBar = NULL;
}

for (int n = 0; n < src_node->Windows.Size; n++)
for (int n_from_node = 0, n_from_tab_bar = 0; n_from_node < src_node->Windows.Size; n_from_node++, n_from_tab_bar++)
{
// DockNode's TabBar may have non-window Tabs manually appended by user
if (ImGuiWindow* window = src_tab_bar ? src_tab_bar->Tabs[n].Window : src_node->Windows[n])
while (src_tab_bar && src_tab_bar->Tabs[n_from_tab_bar].Window == NULL)
n_from_tab_bar++;

// Using TabBar order (FIXME: Why? Clarify + add tests for it)
if (ImGuiWindow* window = src_tab_bar ? src_tab_bar->Tabs[n_from_tab_bar].Window : src_node->Windows[n_from_node])
{
window->DockNode = NULL;
window->DockIsActive = false;
Expand Down

0 comments on commit 0abe7d1

Please sign in to comment.