Skip to content

Commit

Permalink
Docking: Dockspace() never draws a background. (#3924)
Browse files Browse the repository at this point in the history
  • Loading branch information
ocornut committed Mar 16, 2021
1 parent 2565945 commit 2231e1a
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14747,22 +14747,19 @@ void ImGui::DockSpace(ImGuiID id, const ImVec2& size_arg, ImGuiDockNodeFlags fla
SetNextWindowSize(node->Size);
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;
window_flags |= ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoTitleBar;
window_flags |= ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse;
window_flags |= ImGuiWindowFlags_NoBackground;

char title[256];
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);
Begin(title, NULL, window_flags);
PopStyleVar();
if (node->Windows.Size > 0 || node->IsSplitNode())
PopStyleColor();

ImGuiWindow* host_window = g.CurrentWindow;
host_window->DockNodeAsHost = node;
Expand Down

0 comments on commit 2231e1a

Please sign in to comment.