Browse Source

BeginChild: undo child name simplification as it reveal an issue with handling of ### in child names.

When the later is fixed we can re-enable this. Essentially reverts 8ee8513.
ocornut 1 year ago
parent
commit
afadf74a53
3 changed files with 6 additions and 7 deletions
  1. 0 4
      docs/CHANGELOG.txt
  2. 5 2
      imgui.cpp
  3. 1 1
      imgui.h

+ 0 - 4
docs/CHANGELOG.txt

@@ -119,10 +119,6 @@ Other changes:
   - BeginChild(): Added ImGuiChildFlags_FrameStyle as a replacement for BeginChildFrame(),
     use it to make child window use FrameBg, FrameRounding, FrameBorderSize, FramePadding
     instead of ChildBg, ChildRounding, ChildBorderSize, WindowPadding.
-  - BeginChild(): Internal name used by child windows now omits the hash/id if the child
-    window is submitted in root of id stack of parent window.
-    So "Parent/Child_XXXXXXX" becomes "Parent/Child" when in root of id stack.
-    Makes debugging/metrics easier and shorter to read in many cases.
   - Popups: clarified meaning of 'p_open != NULL' in BeginPopupModal() + set back user value
     to false when popup is closed in ways other than clicking the close button. (#6900)
   - Double-clicking lower-left resize grip auto-resize (like lower-right one).

+ 5 - 2
imgui.cpp

@@ -5495,10 +5495,13 @@ bool ImGui::BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, I
     SetNextWindowSize(size);
 
     // Build up name. If you need to append to a same child from multiple location in the ID stack, use BeginChild(ImGuiID id) with a stable value.
+    // FIXME: 2023/11/14: commented out shorted version. We had an issue with multiple ### in child window path names, which the trailing hash helped workaround.
+    // e.g. "ParentName###ParentIdentifier/ChildName###ChildIdentifier" would get hashed incorrectly by ImHashStr(), trailing _%08X somehow fixes it.
     const char* temp_window_name;
-    if (name && parent_window->IDStack.back() == parent_window->ID)
+    /*if (name && parent_window->IDStack.back() == parent_window->ID)
         ImFormatStringToTempBuffer(&temp_window_name, NULL, "%s/%s", parent_window->Name, name); // May omit ID if in root of ID stack
-    else if (name)
+    else*/
+    if (name)
         ImFormatStringToTempBuffer(&temp_window_name, NULL, "%s/%s_%08X", parent_window->Name, name, id);
     else
         ImFormatStringToTempBuffer(&temp_window_name, NULL, "%s/%08X", parent_window->Name, id);

+ 1 - 1
imgui.h

@@ -24,7 +24,7 @@
 // Library Version
 // (Integer encoded as XYYZZ for use in #if preprocessor conditionals, e.g. '#if IMGUI_VERSION_NUM >= 12345')
 #define IMGUI_VERSION       "1.90 WIP"
-#define IMGUI_VERSION_NUM   18998
+#define IMGUI_VERSION_NUM   18999
 #define IMGUI_HAS_TABLE
 
 /*