Docking: Fixed incorrect focus highlight on docking node when focusing empty central node or a child window which was manually injected into a dockspace window.

This commit is contained in:
ocornut 2022-06-13 20:12:41 +02:00
parent e900ca355e
commit 24dfebf455
2 changed files with 12 additions and 5 deletions

View File

@ -223,6 +223,8 @@ Docking+Viewports Branch:
when io.ConfigWindowsMoveFromTitleBarOnly is true and multi-viewports are disabled. (#5044)
- Docking: Fixed a regression where moving window would be interrupted after undocking a tab
when io.ConfigDockingAlwaysTabBar is true. (#5324) [@rokups]
- Docking: Fixed incorrect focus highlight on docking node when focusing empty central node
or a child window which was manually injected into a dockspace window.
- Viewports: Fixed translating a host viewport from briefly altering the size of AlwaysAutoResize windows. (#5057)
- Viewports: Fixed main viewport size not matching ImDrawData::DisplaySize for one frame during resize
when multi-viewports are disabled. (#4900)

View File

@ -15259,7 +15259,11 @@ static void ImGui::DockNodeUpdateTabBar(ImGuiDockNode* node, ImGuiWindow* host_w
if (g.NavWindowingTarget)
is_focused = (g.NavWindowingTarget->DockNode == node);
else if (g.NavWindow && g.NavWindow->RootWindowForTitleBarHighlight == host_window->RootWindowDockTree && root_node->LastFocusedNodeId == node->ID)
is_focused = true;
{
// FIXME-DOCKING: May want alternative to treat central node void differently? e.g. if (g.NavWindow == host_window)
if (g.NavWindow->DockNode && DockNodeIsInHierarchyOf(g.NavWindow->DockNode, root_node)) // Omit child windows injected in window hierarchy
is_focused = true;
}
// Hidden tab bar will show a triangle on the upper-left (in Begin)
if (node->IsHiddenTabBar() || node->IsNoTabBar())
@ -18263,10 +18267,11 @@ void ImGui::DebugNodeDockNode(ImGuiDockNode* node, const char* label)
const bool is_active = (g.FrameCount - node->LastFrameActive < 2); // Submitted
if (!is_alive) { PushStyleColor(ImGuiCol_Text, GetStyleColorVec4(ImGuiCol_TextDisabled)); }
bool open;
ImGuiTreeNodeFlags tree_node_flags = node->IsFocused ? ImGuiTreeNodeFlags_Selected : ImGuiTreeNodeFlags_None;
if (node->Windows.Size > 0)
open = TreeNode((void*)(intptr_t)node->ID, "%s 0x%04X%s: %d windows (vis: '%s')", label, node->ID, node->IsVisible ? "" : " (hidden)", node->Windows.Size, node->VisibleWindow ? node->VisibleWindow->Name : "NULL");
open = TreeNodeEx((void*)(intptr_t)node->ID, tree_node_flags, "%s 0x%04X%s: %d windows (vis: '%s')", label, node->ID, node->IsVisible ? "" : " (hidden)", node->Windows.Size, node->VisibleWindow ? node->VisibleWindow->Name : "NULL");
else
open = TreeNode((void*)(intptr_t)node->ID, "%s 0x%04X%s: %s split (vis: '%s')", label, node->ID, node->IsVisible ? "" : " (hidden)", (node->SplitAxis == ImGuiAxis_X) ? "horizontal" : (node->SplitAxis == ImGuiAxis_Y) ? "vertical" : "n/a", node->VisibleWindow ? node->VisibleWindow->Name : "NULL");
open = TreeNodeEx((void*)(intptr_t)node->ID, tree_node_flags, "%s 0x%04X%s: %s split (vis: '%s')", label, node->ID, node->IsVisible ? "" : " (hidden)", (node->SplitAxis == ImGuiAxis_X) ? "horizontal" : (node->SplitAxis == ImGuiAxis_Y) ? "vertical" : "n/a", node->VisibleWindow ? node->VisibleWindow->Name : "NULL");
if (!is_alive) { PopStyleColor(); }
if (is_active && IsItemHovered())
if (ImGuiWindow* window = node->HostWindow ? node->HostWindow : node->VisibleWindow)
@ -18280,10 +18285,10 @@ void ImGui::DebugNodeDockNode(ImGuiDockNode* node, const char* label)
DebugNodeWindow(node->HostWindow, "HostWindow");
DebugNodeWindow(node->VisibleWindow, "VisibleWindow");
BulletText("SelectedTabID: 0x%08X, LastFocusedNodeID: 0x%08X", node->SelectedTabId, node->LastFocusedNodeId);
BulletText("Misc:%s%s%s%s%s%s",
BulletText("Misc:%s%s%s%s%s%s%s",
node->IsDockSpace() ? " IsDockSpace" : "",
node->IsCentralNode() ? " IsCentralNode" : "",
is_alive ? " IsAlive" : "", is_active ? " IsActive" : "",
is_alive ? " IsAlive" : "", is_active ? " IsActive" : "", node->IsFocused ? " IsFocused" : "",
node->WantLockSizeOnce ? " WantLockSizeOnce" : "",
node->HasCentralNodeChild ? " HasCentralNodeChild" : "");
if (TreeNode("flags", "Flags Merged: 0x%04X, Local: 0x%04X, InWindows: 0x%04X, Shared: 0x%04X", node->MergedFlags, node->LocalFlags, node->LocalFlagsInWindows, node->SharedFlags))