Docking: Amend 91704b7, window->DockXXX booleans not properly cleared when window not docked. (#4177, #3982, #1497, #1061)

Fix issue with freshly split windows/nodes incorrectly returning true to IsWindowAppearing().
This commit is contained in:
ocornut 2021-06-03 16:07:22 +02:00
parent 91704b773e
commit fa1f540e6c

View File

@ -6148,6 +6148,10 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
// Docking currently override constraints // Docking currently override constraints
g.NextWindowData.Flags &= ~ImGuiNextWindowDataFlags_HasSizeConstraint; g.NextWindowData.Flags &= ~ImGuiNextWindowDataFlags_HasSizeConstraint;
} }
else
{
window->DockIsActive = window->DockNodeIsVisible = window->DockTabIsVisible = false;
}
// Update the Appearing flag (again) // Update the Appearing flag (again)
if (window->DockTabIsVisible && !dock_tab_was_visible && dock_node_was_visible && !window->Appearing) if (window->DockTabIsVisible && !dock_tab_was_visible && dock_node_was_visible && !window->Appearing)
@ -15457,6 +15461,9 @@ void ImGui::BeginDocked(ImGuiWindow* window, bool* p_open)
ImGuiContext* ctx = GImGui; ImGuiContext* ctx = GImGui;
ImGuiContext& g = *ctx; ImGuiContext& g = *ctx;
// Clear fields ahead so most early-out paths don't have to do it
window->DockIsActive = window->DockNodeIsVisible = window->DockTabIsVisible = false;
const bool auto_dock_node = GetWindowAlwaysWantOwnTabBar(window); const bool auto_dock_node = GetWindowAlwaysWantOwnTabBar(window);
if (auto_dock_node) if (auto_dock_node)
{ {
@ -15506,14 +15513,9 @@ void ImGui::BeginDocked(ImGuiWindow* window, bool* p_open)
// If the window has been orphaned, transition the docknode to an implicit node processed in DockContextNewFrameUpdateDocking() // If the window has been orphaned, transition the docknode to an implicit node processed in DockContextNewFrameUpdateDocking()
ImGuiDockNode* root_node = DockNodeGetRootNode(node); ImGuiDockNode* root_node = DockNodeGetRootNode(node);
if (root_node->LastFrameAlive < g.FrameCount) if (root_node->LastFrameAlive < g.FrameCount)
{
DockContextProcessUndockWindow(ctx, window); DockContextProcessUndockWindow(ctx, window);
}
else else
{
window->DockIsActive = true; window->DockIsActive = true;
window->DockNodeIsVisible = window->DockTabIsVisible = false;
}
return; return;
} }
@ -15526,8 +15528,8 @@ void ImGui::BeginDocked(ImGuiWindow* window, bool* p_open)
// FIXME-DOCK: replace ->HostWindow NULL compare with something more explicit (~was initially intended as a first frame test) // FIXME-DOCK: replace ->HostWindow NULL compare with something more explicit (~was initially intended as a first frame test)
if (node->HostWindow == NULL) if (node->HostWindow == NULL)
{ {
window->DockIsActive = (node->State == ImGuiDockNodeState_HostWindowHiddenBecauseWindowsAreResizing); if (node->State == ImGuiDockNodeState_HostWindowHiddenBecauseWindowsAreResizing)
window->DockNodeIsVisible = window->DockTabIsVisible = false; window->DockIsActive = true;
if (node->Windows.Size > 1) if (node->Windows.Size > 1)
DockNodeHideWindowDuringHostWindowCreation(window); DockNodeHideWindowDuringHostWindowCreation(window);
return; return;