diff --git a/imgui.cpp b/imgui.cpp index f830659f97c7..520ebc0af0bd 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -4461,7 +4461,7 @@ void ImGui::StartMouseMovingWindowOrNode(ImGuiWindow* window, ImGuiDockNode* nod { ImGuiContext& g = *GImGui; bool can_undock_node = false; - if (node != NULL && node->VisibleWindow && (node->VisibleWindow->Flags & ImGuiWindowFlags_NoMove) == 0) + if (node != NULL && node->VisibleWindow && (node->VisibleWindow->Flags & ImGuiWindowFlags_NoMove) == 0 && (node->MergedFlags & ImGuiDockNodeFlags_NoUndocking) == 0) { // Can undock if: // - part of a floating node hierarchy with more than one visible node (if only one is visible, we'll just move the whole hierarchy) @@ -19893,6 +19893,7 @@ static void DebugNodeDockNodeFlags(ImGuiDockNodeFlags* p_flags, const char* labe CheckboxFlags("NoDockingOverMe", p_flags, ImGuiDockNodeFlags_NoDockingOverMe); CheckboxFlags("NoDockingOverOther", p_flags, ImGuiDockNodeFlags_NoDockingOverOther); CheckboxFlags("NoDockingOverEmpty", p_flags, ImGuiDockNodeFlags_NoDockingOverEmpty); + CheckboxFlags("NoUndocking", p_flags, ImGuiDockNodeFlags_NoUndocking); if (!enabled) EndDisabled(); PopStyleVar(); diff --git a/imgui_internal.h b/imgui_internal.h index 9b466eab4842..5007b9132924 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -1679,8 +1679,9 @@ enum ImGuiDockNodeFlagsPrivate_ ImGuiDockNodeFlags_NoDockingOverMe = 1 << 19, // // [EXPERIMENTAL] Prevent another window/node to be docked over this node. ImGuiDockNodeFlags_NoDockingOverOther = 1 << 20, // // [EXPERIMENTAL] Prevent this node to be docked over another window or non-empty node. ImGuiDockNodeFlags_NoDockingOverEmpty = 1 << 21, // // [EXPERIMENTAL] Prevent this node to be docked over an empty node (e.g. DockSpace with no other windows) - ImGuiDockNodeFlags_NoResizeX = 1 << 22, // // [EXPERIMENTAL] - ImGuiDockNodeFlags_NoResizeY = 1 << 23, // // [EXPERIMENTAL] + ImGuiDockNodeFlags_NoUndocking = 1 << 22, // // Disable undocking from this node. + ImGuiDockNodeFlags_NoResizeX = 1 << 23, // // [EXPERIMENTAL] + ImGuiDockNodeFlags_NoResizeY = 1 << 24, // // [EXPERIMENTAL] ImGuiDockNodeFlags_SharedFlagsInheritMask_ = ~0, ImGuiDockNodeFlags_NoResizeFlagsMask_ = ImGuiDockNodeFlags_NoResize | ImGuiDockNodeFlags_NoResizeX | ImGuiDockNodeFlags_NoResizeY, // When splitting those flags are moved to the inheriting child, never duplicated diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 97d60169634c..05fec0180877 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -8639,7 +8639,8 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, } // Extract a Dockable window out of it's tab bar - if (docked_window != NULL && !(docked_window->Flags & ImGuiWindowFlags_NoMove)) + const bool can_undock = docked_window != NULL && !(docked_window->Flags & ImGuiWindowFlags_NoMove) && !(node->MergedFlags & ImGuiDockNodeFlags_NoUndocking); + if (can_undock) { // We use a variable threshold to distinguish dragging tabs within a tab bar and extracting them out of the tab bar bool undocking_tab = (g.DragDropActive && g.DragDropPayload.SourceId == id);