From b96b1f2412a9f324e2fb5218268eb18bbd190202 Mon Sep 17 00:00:00 2001 From: omar Date: Tue, 4 Dec 2018 16:38:27 +0100 Subject: [PATCH] Docking: Documenting an issue. Renamed member of ImGuiDockFamily. --- imgui.cpp | 8 ++++---- imgui.h | 6 +++--- imgui_demo.cpp | 2 ++ 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 6a4f49e1..3c9fcff6 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -11219,11 +11219,11 @@ static bool DockNodeIsDropAllowedOne(ImGuiWindow* payload, ImGuiWindow* host_win ImGuiDockFamily* host_family = host_window->DockNodeAsHost ? &host_window->DockNodeAsHost->DockFamily : &host_window->DockFamily; ImGuiDockFamily* payload_family = &payload->DockFamily; - if (host_family->ID != payload_family->ID) + if (host_family->FamilyId != payload_family->FamilyId) { - if (host_family->ID != 0 && host_family->CompatibleWithFamilyZero && payload_family->ID == 0) + if (host_family->FamilyId != 0 && host_family->CompatibleWithFamilyZero && payload_family->FamilyId == 0) return true; - if (payload_family->ID != 0 && payload_family->CompatibleWithFamilyZero && host_family->ID == 0) + if (payload_family->FamilyId != 0 && payload_family->CompatibleWithFamilyZero && host_family->FamilyId == 0) return true; return false; } @@ -13068,7 +13068,7 @@ static void SettingsHandlerWindow_WriteAll(ImGuiContext* imgui_ctx, ImGuiSetting settings->ViewportPos = window->ViewportPos; IM_ASSERT(window->DockNode == NULL || window->DockNode->ID == window->DockId); settings->DockId = window->DockId; - settings->DockFamilyId = window->DockFamily.ID; + settings->DockFamilyId = window->DockFamily.FamilyId; settings->DockOrder = window->DockOrder; settings->Collapsed = window->Collapsed; } diff --git a/imgui.h b/imgui.h index 8e94caec..111d1eba 100644 --- a/imgui.h +++ b/imgui.h @@ -1446,11 +1446,11 @@ struct ImGuiPayload // [BETA] For SetNextWindowDockFamily() and DockSpace() function struct ImGuiDockFamily { - ImGuiID ID; // 0 = unaffiliated + ImGuiID FamilyId; // 0 = unaffiliated bool CompatibleWithFamilyZero; // true = can be docked/merged with an unaffiliated window - ImGuiDockFamily() { ID = 0; CompatibleWithFamilyZero = true; } - ImGuiDockFamily(ImGuiID id, bool compatible_with_family_zero = true) { ID = id; CompatibleWithFamilyZero = compatible_with_family_zero; } + ImGuiDockFamily() { FamilyId = 0; CompatibleWithFamilyZero = true; } + ImGuiDockFamily(ImGuiID family_id, bool compatible_with_family_zero = true) { FamilyId = family_id; CompatibleWithFamilyZero = compatible_with_family_zero; } }; //----------------------------------------------------------------------------- diff --git a/imgui_demo.cpp b/imgui_demo.cpp index 6a6505d1..b74720e4 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -1539,6 +1539,8 @@ static void ShowDemoWindowWidgets() ImGui::Checkbox("Hovered/Active tests after Begin() for title bar testing", &test_window); if (test_window) { + // FIXME-DOCK: This window cannot be docked within the ImGui Demo window, this will cause a feedback loop and get them stuck. + // Could we fix this through an ImGuiDockFamily feature? Or an API call to tag our parent as "don't skip items"? ImGui::Begin("Title bar Hovered/Active tests", &test_window); if (ImGui::BeginPopupContextItem()) // <-- This is using IsItemHovered() {