Docking: Dockspace() never draws a background. (#3924)

This commit is contained in:
ocornut 2021-03-16 14:30:36 +01:00
parent 256594575d
commit 2231e1a369

View File

@ -14747,22 +14747,19 @@ void ImGui::DockSpace(ImGuiID id, const ImVec2& size_arg, ImGuiDockNodeFlags fla
SetNextWindowSize(node->Size); SetNextWindowSize(node->Size);
g.NextWindowData.PosUndock = false; g.NextWindowData.PosUndock = false;
// FIXME-DOCK 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?
// FIXME-DOCK: What is the reason for not simply calling BeginChild()? (OK to have a reason but should be commented)
ImGuiWindowFlags window_flags = ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_DockNodeHost; ImGuiWindowFlags window_flags = ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_DockNodeHost;
window_flags |= ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoTitleBar; window_flags |= ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoTitleBar;
window_flags |= ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse; window_flags |= ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse;
window_flags |= ImGuiWindowFlags_NoBackground;
char title[256]; char title[256];
ImFormatString(title, IM_ARRAYSIZE(title), "%s/DockSpace_%08X", window->Name, id); ImFormatString(title, IM_ARRAYSIZE(title), "%s/DockSpace_%08X", window->Name, id);
// FIXME-DOCK: What is the reason for not simply calling BeginChild()?
if (node->Windows.Size > 0 || node->IsSplitNode())
PushStyleColor(ImGuiCol_ChildBg, IM_COL32(0, 0, 0, 0));
PushStyleVar(ImGuiStyleVar_ChildBorderSize, 0.0f); PushStyleVar(ImGuiStyleVar_ChildBorderSize, 0.0f);
Begin(title, NULL, window_flags); Begin(title, NULL, window_flags);
PopStyleVar(); PopStyleVar();
if (node->Windows.Size > 0 || node->IsSplitNode())
PopStyleColor();
ImGuiWindow* host_window = g.CurrentWindow; ImGuiWindow* host_window = g.CurrentWindow;
host_window->DockNodeAsHost = node; host_window->DockNodeAsHost = node;