From 578e15f006ef87ce6e5c28173146bb12f993cd42 Mon Sep 17 00:00:00 2001 From: omar Date: Thu, 31 Jan 2019 14:55:00 +0100 Subject: [PATCH] Docking: Removed unnecessary ImGuiTabItemFlags_DockedWindow internal flag. --- imgui.cpp | 2 +- imgui_internal.h | 3 +-- imgui_widgets.cpp | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 9d84c7ee..ebef15a1 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -11474,7 +11474,7 @@ static void ImGui::DockNodeUpdateTabBar(ImGuiDockNode* node, ImGuiWindow* host_w continue; if (window->LastFrameActive + 1 >= g.FrameCount || !node_was_active) { - ImGuiTabItemFlags tab_item_flags = ImGuiTabItemFlags_DockedWindow; + ImGuiTabItemFlags tab_item_flags = 0; if (window->Flags & ImGuiWindowFlags_UnsavedDocument) tab_item_flags |= ImGuiTabItemFlags_UnsavedDocument; if (tab_bar->Flags & ImGuiTabBarFlags_NoCloseWithMiddleMouseButton) diff --git a/imgui_internal.h b/imgui_internal.h index 6ee34b71..872d20ea 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -1397,8 +1397,7 @@ enum ImGuiTabBarFlagsPrivate_ enum ImGuiTabItemFlagsPrivate_ { - ImGuiTabItemFlags_DockedWindow = 1 << 20, // [Docking] - ImGuiTabItemFlags_Unsorted = 1 << 22, // [Docking] Trailing tabs with the _Unsorted flag will be sorted based on the DockOrder of their Window. + ImGuiTabItemFlags_Unsorted = 1 << 20, // [Docking] Trailing tabs with the _Unsorted flag will be sorted based on the DockOrder of their Window. ImGuiTabItemFlags_Preview = 1 << 21 // [Docking] Display tab shape for docking preview (height is adjusted slightly to compensate for the yet missing tab bar) }; diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 2b45e8dc..7590875a 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -6507,7 +6507,7 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, { // Drag and drop: re-order tabs float drag_distance_from_edge_x = 0.0f; - if (!g.DragDropActive && ((tab_bar->Flags & ImGuiTabBarFlags_Reorderable) || (flags & ImGuiTabItemFlags_DockedWindow))) + if (!g.DragDropActive && ((tab_bar->Flags & ImGuiTabBarFlags_Reorderable) || (docked_window != NULL))) { // While moving a tab it will jump on the other side of the mouse, so we also test for MouseDelta.x if (g.IO.MouseDelta.x < 0.0f && g.IO.MousePos.x < bb.Min.x) @@ -6525,7 +6525,7 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, } // Extract a Dockable window out of it's tab bar - if (flags & ImGuiTabItemFlags_DockedWindow) + if (docked_window != NULL) { // 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);