mirror of
https://github.com/ocornut/imgui.git
synced 2024-12-05 06:57:13 +08:00
Docking: Fix for IMGUI_DEBUG_INI_SETTINGS=1, comments
This commit is contained in:
parent
07eb7adbb4
commit
c163b856d7
19
imgui.cpp
19
imgui.cpp
@ -6761,7 +6761,7 @@ void ImGui::FocusTopMostWindowUnderOne(ImGuiWindow* under_this_window, ImGuiWind
|
||||
if (window != ignore_window && window->WasActive && !(window->Flags & ImGuiWindowFlags_ChildWindow))
|
||||
if ((window->Flags & (ImGuiWindowFlags_NoMouseInputs | ImGuiWindowFlags_NoNavInputs)) != (ImGuiWindowFlags_NoMouseInputs | ImGuiWindowFlags_NoNavInputs))
|
||||
{
|
||||
// FIXME-DOCKING: This is failing (lagging by one frame) for docked windows.
|
||||
// FIXME-DOCK: This is failing (lagging by one frame) for docked windows.
|
||||
// If A and B are docked into window and B disappear, at the NewFrame() call site window->NavLastChildNavWindow will still point to B.
|
||||
// We might leverage the tab order implicitly stored in window->DockNodeAsHost->TabBar (essentially the 'most_recently_selected_tab' code in tab bar will do that but on next update)
|
||||
// to tell which is the "previous" window. Or we may leverage 'LastFrameFocused/LastFrameJustFocused' and have this function handle child window itself?
|
||||
@ -11534,7 +11534,7 @@ static ImGuiDockNode* ImGui::DockContextFindNodeByID(ImGuiContext* ctx, ImGuiID
|
||||
ImGuiID ImGui::DockContextGenNodeID(ImGuiContext* ctx)
|
||||
{
|
||||
// Generate an ID for new node (the exact ID value doesn't matter as long as it is not already used)
|
||||
// FIXME-OPT FIXME-DOCKING: This is suboptimal, even if the node count is small enough not to be a worry. We should poke in ctx->Nodes to find a suitable ID faster.
|
||||
// FIXME-OPT FIXME-DOCK: This is suboptimal, even if the node count is small enough not to be a worry. We should poke in ctx->Nodes to find a suitable ID faster.
|
||||
ImGuiID id = 0x0001;
|
||||
while (DockContextFindNodeByID(ctx, id) != NULL)
|
||||
id++;
|
||||
@ -11862,7 +11862,7 @@ void ImGui::DockContextProcessDock(ImGuiContext* ctx, ImGuiDockRequest* req)
|
||||
if (node->IsCentralNode())
|
||||
{
|
||||
// Central node property needs to be moved to a leaf node, pick the last focused one.
|
||||
// FIXME-DOCKING: If we had to transfer other flags here, what would the policy be?
|
||||
// FIXME-DOCK: If we had to transfer other flags here, what would the policy be?
|
||||
ImGuiDockNode* last_focused_node = DockContextFindNodeByID(ctx, payload_node->LastFocusedNodeID);
|
||||
IM_ASSERT(last_focused_node != NULL);
|
||||
ImGuiDockNode* last_focused_root_node = DockNodeGetRootNode(last_focused_node);
|
||||
@ -12775,7 +12775,7 @@ static void ImGui::DockNodeUpdateTabBar(ImGuiDockNode* node, ImGuiWindow* host_w
|
||||
const bool has_close_button = (node_flags & ImGuiDockNodeFlags_NoCloseButton) == 0;
|
||||
|
||||
// In a dock node, the Collapse Button turns into the Window Menu button.
|
||||
// FIXME-DOCK FIXME-OPT: Could we recycle popups id accross multiple dock nodes?
|
||||
// FIXME-DOCK FIXME-OPT: Could we recycle popups id across multiple dock nodes?
|
||||
if (has_window_menu_button && IsPopupOpen("#WindowMenu"))
|
||||
{
|
||||
if (ImGuiID tab_id = DockNodeUpdateWindowMenu(node, tab_bar))
|
||||
@ -12818,7 +12818,7 @@ static void ImGui::DockNodeUpdateTabBar(ImGuiDockNode* node, ImGuiWindow* host_w
|
||||
int tabs_unsorted_start = tab_bar->Tabs.Size;
|
||||
for (int tab_n = tab_bar->Tabs.Size - 1; tab_n >= 0 && (tab_bar->Tabs[tab_n].Flags & ImGuiTabItemFlags_Unsorted); tab_n--)
|
||||
{
|
||||
// FIXME-DOCKING: Consider only clearing the flag after the tab has been alive for a few consecutive frames, allowing late comers to not break sorting?
|
||||
// FIXME-DOCK: Consider only clearing the flag after the tab has been alive for a few consecutive frames, allowing late comers to not break sorting?
|
||||
tab_bar->Tabs[tab_n].Flags &= ~ImGuiTabItemFlags_Unsorted;
|
||||
tabs_unsorted_start = tab_n;
|
||||
}
|
||||
@ -13747,7 +13747,7 @@ void ImGui::DockSpace(ImGuiID id, const ImVec2& size_arg, ImGuiDockNodeFlags fla
|
||||
SetNextWindowSize(node->Size);
|
||||
g.NextWindowData.PosUndock = false;
|
||||
|
||||
// FIXME-DOCKING: Why do we need a child window to host a dockspace, could we host it in the existing window?
|
||||
// FIXME-DOCK Why do we need a child window to host a dockspace, could we host it in the existing window?
|
||||
ImGuiWindowFlags window_flags = ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_DockNodeHost;
|
||||
window_flags |= ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoTitleBar;
|
||||
window_flags |= ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse;
|
||||
@ -14674,13 +14674,14 @@ static void ImGui::DockSettingsHandler_WriteAll(ImGuiContext* ctx, ImGuiSettings
|
||||
buf->appendf("%*s", ImMax(2, (line_start_pos + 92) - buf->size()), ""); // Align everything
|
||||
if (node->IsDockSpace() && node->HostWindow && node->HostWindow->ParentWindow)
|
||||
buf->appendf(" ; in '%s'", node->HostWindow->ParentWindow->Name);
|
||||
// Iterate settings so we can give info about windows that didn't exist during the session.
|
||||
int contains_window = 0;
|
||||
for (int window_n = 0; window_n < ctx->SettingsWindows.Size; window_n++) // Iterate settings so we can give info about windows that didn't exist during the session.
|
||||
if (ctx->SettingsWindows[window_n].DockId == node_settings->ID)
|
||||
for (ImGuiWindowSettings* settings = g.SettingsWindows.begin(); settings != NULL; settings = g.SettingsWindows.next_chunk(settings))
|
||||
if (settings->DockId == node_settings->ID)
|
||||
{
|
||||
if (contains_window++ == 0)
|
||||
buf->appendf(" ; contains ");
|
||||
buf->appendf("'%s' ", ctx->SettingsWindows[window_n].Name);
|
||||
buf->appendf("'%s' ", settings->GetName());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user