From 15ec78e9d8347ff3e731375181b225e0a5e9318d Mon Sep 17 00:00:00 2001 From: omar Date: Thu, 11 Oct 2018 21:31:42 +0200 Subject: [PATCH] Internal: Moved stored window name update code to the first_begin_of_the_frame block. This will be useful in the Docking branch. --- imgui.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 0dfe9795f..2b6ef904f 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -4766,15 +4766,6 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) window = CreateNewWindow(name, size_on_first_use, flags); } - // Update stored window name when it changes (which can only happen with the "###" operator). - // Only if it is meant to be displayed to the end user in a different place than the title bar (which already always display the 'name' parameter) - bool window_title_visible_elsewhere = (window->Viewport && window->Viewport->Window == window); - if (!window_just_created && window_title_visible_elsewhere && strcmp(name, window->Name) != 0) - { - IM_DELETE(window->Name); - window->Name = ImStrdup(name); - } - // Automatically disable manual moving/resizing when NoInputs is set if (flags & ImGuiWindowFlags_NoInputs) flags |= ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize; @@ -4886,6 +4877,15 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags) window->LastFrameActive = current_frame; window->IDStack.resize(1); + // Update stored window name when it changes (which can only happen with the "###" operator). + // The title bar always display the 'name' parameter, so we only update storage if the title is displayed to the end-user in a different place. + bool window_title_visible_elsewhere = (window->Viewport && window->Viewport->Window == window); + if (!window_just_created && window_title_visible_elsewhere && strcmp(name, window->Name) != 0) + { + IM_DELETE(window->Name); + window->Name = ImStrdup(name); + } + // UPDATE CONTENTS SIZE, UPDATE HIDDEN STATUS // Update contents size from last frame for auto-fitting (or use explicit size)