1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-11-30 18:34:34 +01:00

Docking: Added an assert to clarify that ImGuiDockNodeFlags_CentralNode flag does not need to be passed to DockSpace(). (#8145)

This commit is contained in:
ocornut 2024-11-26 11:36:50 +01:00
parent dad1047b04
commit 14d213ca85
3 changed files with 9 additions and 2 deletions

View File

@ -64,6 +64,9 @@ Other changes:
Docking+Viewports Branch:
- Docking: Added an assert to clarify that ImGuiDockNodeFlags_CentralNode flag
(from internals) does not need to be passed to DockSpace(), as it causes general
havoc. (#8145)
- Backends: Win32: Fixed a crash/regression in 1.91.5 when running two processes
with multi-viewports (was using GetProp() to query property which could have
belonged to another process). (#8162, #8069) [@sammyfreg, @ocornut]

View File

@ -4957,7 +4957,7 @@ void ImGui::StartMouseMovingWindowOrNode(ImGuiWindow* window, ImGuiDockNode* nod
{
// Can undock if:
// - part of a hierarchy with more than one visible node (if only one is visible, we'll just move the root window)
// - part of a dockspace node hierarchy: so we can undock the last single visible node too (trivia: undocking from a fixed/central node will create a new node and copy windows)
// - part of a dockspace node hierarchy: so we can undock the last single visible node too. Undocking from a fixed/central node will create a new node and copy windows.
ImGuiDockNode* root_node = DockNodeGetRootNode(node);
if (root_node->OnlyNodeWithWindows != node || root_node->CentralNode != NULL) // -V1051 PVS-Studio thinks node should be root_node and is wrong about that.
can_undock_node = true;
@ -19320,7 +19320,9 @@ ImGuiID ImGui::DockSpace(ImGuiID dockspace_id, const ImVec2& size_arg, ImGuiDock
if ((flags & ImGuiDockNodeFlags_KeepAliveOnly) == 0)
window = GetCurrentWindow(); // call to set window->WriteAccessed = true;
IM_ASSERT((flags & ImGuiDockNodeFlags_DockSpace) == 0);
IM_ASSERT((flags & ImGuiDockNodeFlags_DockSpace) == 0); // Flag is automatically set by DockSpace() as LocalFlags, not SharedFlags!
IM_ASSERT((flags & ImGuiDockNodeFlags_CentralNode) == 0); // Flag is automatically set by DockSpace() as LocalFlags, not SharedFlags! (#8145)
IM_ASSERT(dockspace_id != 0);
ImGuiDockNode* node = DockContextFindNodeByID(&g, dockspace_id);
if (node == NULL)

View File

@ -1835,6 +1835,7 @@ enum ImGuiDockNodeFlagsPrivate_
ImGuiDockNodeFlags_NoResizeX = 1 << 16, // //
ImGuiDockNodeFlags_NoResizeY = 1 << 17, // //
ImGuiDockNodeFlags_DockedWindowsInFocusRoute= 1 << 18, // // Any docked window will be automatically be focus-route chained (window->ParentWindowForFocusRoute set to this) so Shortcut() in this window can run when any docked window is focused.
// Disable docking/undocking actions in this dockspace or individual node (existing docked nodes will be preserved)
// Those are not exposed in public because the desirable sharing/inheriting/copy-flag-on-split behaviors are quite difficult to design and understand.
// The two public flags ImGuiDockNodeFlags_NoDockingOverCentralNode/ImGuiDockNodeFlags_NoDockingSplit don't have those issues.
@ -1843,6 +1844,7 @@ enum ImGuiDockNodeFlagsPrivate_
ImGuiDockNodeFlags_NoDockingOverOther = 1 << 21, // // Disable this node from being docked over another window or non-empty node.
ImGuiDockNodeFlags_NoDockingOverEmpty = 1 << 22, // // Disable this node from being docked over an empty node (e.g. DockSpace with no other windows)
ImGuiDockNodeFlags_NoDocking = ImGuiDockNodeFlags_NoDockingOverMe | ImGuiDockNodeFlags_NoDockingOverOther | ImGuiDockNodeFlags_NoDockingOverEmpty | ImGuiDockNodeFlags_NoDockingSplit | ImGuiDockNodeFlags_NoDockingSplitOther,
// Masks
ImGuiDockNodeFlags_SharedFlagsInheritMask_ = ~0,
ImGuiDockNodeFlags_NoResizeFlagsMask_ = (int)ImGuiDockNodeFlags_NoResize | ImGuiDockNodeFlags_NoResizeX | ImGuiDockNodeFlags_NoResizeY,