Skip to content

Commit

Permalink
Docking: Further fixes for highlight of nested nodes. (#5702)
Browse files Browse the repository at this point in the history
Amend fb0b9c7, 8f43487, 9764adc, 24dfebf
Added more regression tests e.g "docking_focus_nodes_nested"
  • Loading branch information
ocornut committed Oct 24, 2022
1 parent 5370b46 commit 50c4234
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15379,8 +15379,17 @@ static void ImGui::DockNodeUpdate(ImGuiDockNode* node)
if (node->IsSplitNode())
IM_ASSERT(node->TabBar == NULL);
if (node->IsRootNode())
if (g.NavWindow && g.NavWindow->RootWindow->DockNode && g.NavWindow->RootWindow->ParentWindow == host_window)
node->LastFocusedNodeId = g.NavWindow->RootWindow->DockNode->ID;
if (ImGuiWindow* p_window = g.NavWindow ? g.NavWindow->RootWindow : NULL)
while (p_window != NULL && p_window->DockNode != NULL)
{
ImGuiDockNode* p_node = DockNodeGetRootNode(p_window->DockNode);
if (p_node == node)
{
node->LastFocusedNodeId = p_window->DockNode->ID; // Note: not using root node ID!
break;
}
p_window = p_node->HostWindow ? p_node->HostWindow->RootWindow : NULL;
}

// Register a hit-test hole in the window unless we are currently dragging a window that is compatible with our dockspace
ImGuiDockNode* central_node = node->CentralNode;
Expand Down

0 comments on commit 50c4234

Please sign in to comment.