diff --git a/imgui.cpp b/imgui.cpp index 47ba597f559b..7f24b9b0c5cd 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -971,6 +971,7 @@ static bool UpdateWindowManualResize(ImGuiWindow* window, const ImVe static void RenderWindowOuterBorders(ImGuiWindow* window); static void RenderWindowDecorations(ImGuiWindow* window, const ImRect& title_bar_rect, bool title_bar_is_highlight, bool handle_borders_and_resize_grips, int resize_grip_count, const ImU32 resize_grip_col[4], float resize_grip_draw_size); static void RenderWindowTitleBarContents(ImGuiWindow* window, const ImRect& title_bar_rect, const char* name, bool* p_open); +static void EndFrameDrawEmptyDockNodes(ImGuiContext* ctx); static void EndFrameDrawDimmedBackgrounds(); // Viewports @@ -4483,6 +4484,9 @@ void ImGui::EndFrame() g.CurrentWindow->Active = false; End(); + // Draw dock nodes with no windows with alternate backgrounds + EndFrameDrawEmptyDockNodes(&g); + // Draw modal whitening background on _other_ viewports than the one the modal is one EndFrameDrawDimmedBackgrounds(); @@ -11726,6 +11730,7 @@ namespace ImGui // - DockContextPruneUnusedSettingsNodes() // - DockContextBuildNodesFromSettings() // - DockContextBuildAddWindowsToNodes() +// - EndFrameDrawEmptyDockNodes() //----------------------------------------------------------------------------- void ImGui::DockContextInitialize(ImGuiContext* ctx) @@ -12035,6 +12040,19 @@ void ImGui::DockContextBuildAddWindowsToNodes(ImGuiContext* ctx, ImGuiID root_id } } +void ImGui::EndFrameDrawEmptyDockNodes(ImGuiContext* ctx) +{ + ImGuiContext& g = *ctx; + for (int n = 0; n < g.DockContext->Nodes.Data.Size; n++) + if (ImGuiDockNode* node = (ImGuiDockNode*)g.DockContext->Nodes.Data[n].val_p) + { + // Draw empty node background (currently can only be the Central Node) + ImGuiWindow* host_window = node->HostWindow; + if (host_window && node->IsEmpty() && node->IsVisible && !(node->GetMergedFlags() & ImGuiDockNodeFlags_PassthruCentralNode)) + host_window->DrawList->AddRectFilled(node->Pos, node->Pos + node->Size, GetColorU32(ImGuiCol_DockingEmptyBg)); + } +} + //----------------------------------------------------------------------------- // Docking: ImGuiDockContext Docking/Undocking functions //----------------------------------------------------------------------------- @@ -12938,10 +12956,6 @@ static void ImGui::DockNodeUpdate(ImGuiDockNode* node) DockNodeTreeUpdateSplitter(node); } - // Draw empty node background (currently can only be the Central Node) - if (host_window && node->IsEmpty() && node->IsVisible && !(node_flags & ImGuiDockNodeFlags_PassthruCentralNode)) - host_window->DrawList->AddRectFilled(node->Pos, node->Pos + node->Size, GetColorU32(ImGuiCol_DockingEmptyBg)); - // Draw whole dockspace background if ImGuiDockNodeFlags_PassthruCentralNode if set. if (render_dockspace_bg && node->IsVisible) {