Docking: Removed seemingly unnecessary test in TabItemEx() for undocking tab leading to window move. Added ImGuiDockNode::IsFloatingNode() helper to clarify code intent in various places.

This commit is contained in:
omar
2019-07-22 10:54:17 -07:00
parent 9cda3035fd
commit 6f8d34768d
4 changed files with 8 additions and 8 deletions

View File

@ -11216,7 +11216,7 @@ void ImGui::DockContextUpdateDocking(ImGuiContext* ctx)
// We can have NULL pointers when we delete nodes, but because ID are recycled this should amortize nicely (and our node count will never be very high)
for (int n = 0; n < dc->Nodes.Data.Size; n++)
if (ImGuiDockNode* node = (ImGuiDockNode*)dc->Nodes.Data[n].val_p)
if (node->IsRootNode() && !node->IsDockSpace())
if (node->IsFloatingNode())
DockNodeUpdate(node);
}
@ -11702,7 +11702,7 @@ static void ImGui::DockNodeAddWindow(ImGuiDockNode* node, ImGuiWindow* window, b
// When reactivating a node with one or two loose window, the window pos/size/viewport are authoritative over the node storage.
// In particular it is important we init the viewport from the first window so we don't create two viewports and drop one.
if (node->HostWindow == NULL && !node->IsDockSpace() && node->IsRootNode())
if (node->HostWindow == NULL && node->IsFloatingNode())
{
if (node->AuthorityForPos == ImGuiDataAuthority_Auto)
node->AuthorityForPos = ImGuiDataAuthority_Window;
@ -12026,7 +12026,7 @@ static void ImGui::DockNodeUpdate(ImGuiDockNode* node)
DockNodeRemoveTabBar(node);
// Early out for hidden root dock nodes (when all DockId references are in inactive windows, or there is only 1 floating window holding on the DockId)
if (node->Windows.Size <= 1 && node->IsRootNode() && node->IsLeafNode() && !node->IsDockSpace() && !g.IO.ConfigDockingTabBarOnSingleWindows)
if (node->Windows.Size <= 1 && node->IsFloatingNode() && node->IsLeafNode() && !g.IO.ConfigDockingTabBarOnSingleWindows)
{
if (node->Windows.Size == 1)
{
@ -13219,6 +13219,7 @@ ImGuiDockNode* ImGui::DockNodeTreeFindNodeByPos(ImGuiDockNode* node, ImVec2 pos)
// Docking: Public Functions (SetWindowDock, DockSpace, DockSpaceOverViewport)
//-----------------------------------------------------------------------------
// [Internal] Called via SetNextWindowDockID()
void ImGui::SetWindowDock(ImGuiWindow* window, ImGuiID dock_id, ImGuiCond cond)
{
// Test condition (NB: bit 0 is always true) and clear flags for next time
@ -14156,7 +14157,7 @@ static void ImGui::DockSettingsHandler_WriteAll(ImGuiContext* ctx, ImGuiSettings
if (ImGuiDockNode* node = DockContextFindNodeByID(ctx, node_settings->ID))
{
buf->appendf("%*s", ImMax(2, (line_start_pos + 92) - buf->size()), ""); // Align everything
if (node->IsDockSpace && node->HostWindow && node->HostWindow->ParentWindow)
if (node->IsDockSpace() && node->HostWindow && node->HostWindow->ParentWindow)
buf->appendf(" ; in '%s'", node->HostWindow->ParentWindow->Name);
int contains_window = 0;
for (int window_n = 0; window_n < ctx->SettingsWindows.Size; window_n++)