@@ -5452,7 +5452,9 @@ bool ImGui::BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, b
5452
5452
const float backup_border_size = g.Style.ChildBorderSize;
5453
5453
if (!border)
5454
5454
g.Style.ChildBorderSize = 0.0f;
5455
- bool ret = Begin(temp_window_name, NULL, flags);
5455
+
5456
+ // Begin into window
5457
+ const bool ret = Begin(temp_window_name, NULL, flags);
5456
5458
g.Style.ChildBorderSize = backup_border_size;
5457
5459
5458
5460
ImGuiWindow* child_window = g.CurrentWindow;
@@ -5464,7 +5466,7 @@ bool ImGui::BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, b
5464
5466
parent_window->DC.CursorPos = child_window->Pos;
5465
5467
5466
5468
// Process navigation-in immediately so NavInit can run on first frame
5467
- // Can enter a child if (A) it has navigatable items or (B) it can be scrolled.
5469
+ // Can enter a child if (A) it has navigable items or (B) it can be scrolled.
5468
5470
const ImGuiID temp_id_for_activation = ImHashStr("##Child", 0, id);
5469
5471
if (g.ActiveId == temp_id_for_activation)
5470
5472
ClearActiveID();
@@ -5481,26 +5483,26 @@ bool ImGui::BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, b
5481
5483
void ImGui::EndChild()
5482
5484
{
5483
5485
ImGuiContext& g = *GImGui;
5484
- ImGuiWindow* window = g.CurrentWindow;
5486
+ ImGuiWindow* child_window = g.CurrentWindow;
5485
5487
5486
5488
IM_ASSERT(g.WithinEndChild == false);
5487
- IM_ASSERT(window ->Flags & ImGuiWindowFlags_ChildWindow); // Mismatched BeginChild()/EndChild() calls
5489
+ IM_ASSERT(child_window ->Flags & ImGuiWindowFlags_ChildWindow); // Mismatched BeginChild()/EndChild() calls
5488
5490
5489
5491
g.WithinEndChild = true;
5490
- ImVec2 child_size = window ->Size;
5492
+ ImVec2 child_size = child_window ->Size;
5491
5493
End();
5492
- if (window ->BeginCount == 1)
5494
+ if (child_window ->BeginCount == 1)
5493
5495
{
5494
5496
ImGuiWindow* parent_window = g.CurrentWindow;
5495
5497
ImRect bb(parent_window->DC.CursorPos, parent_window->DC.CursorPos + child_size);
5496
5498
ItemSize(child_size);
5497
- if ((window ->DC.NavLayersActiveMask != 0 || window ->DC.NavWindowHasScrollY) && !(window ->Flags & ImGuiWindowFlags_NavFlattened))
5499
+ if ((child_window ->DC.NavLayersActiveMask != 0 || child_window ->DC.NavWindowHasScrollY) && !(child_window ->Flags & ImGuiWindowFlags_NavFlattened))
5498
5500
{
5499
- ItemAdd(bb, window ->ChildId);
5500
- RenderNavHighlight(bb, window ->ChildId);
5501
+ ItemAdd(bb, child_window ->ChildId);
5502
+ RenderNavHighlight(bb, child_window ->ChildId);
5501
5503
5502
5504
// When browsing a window that has no activable items (scroll only) we keep a highlight on the child (pass g.NavId to trick into always displaying)
5503
- if (window ->DC.NavLayersActiveMask == 0 && window == g.NavWindow)
5505
+ if (child_window ->DC.NavLayersActiveMask == 0 && child_window == g.NavWindow)
5504
5506
RenderNavHighlight(ImRect(bb.Min - ImVec2(2, 2), bb.Max + ImVec2(2, 2)), g.NavId, ImGuiNavHighlightFlags_TypeThin);
5505
5507
}
5506
5508
else
@@ -5509,10 +5511,10 @@ void ImGui::EndChild()
5509
5511
ItemAdd(bb, 0);
5510
5512
5511
5513
// But when flattened we directly reach items, adjust active layer mask accordingly
5512
- if (window ->Flags & ImGuiWindowFlags_NavFlattened)
5513
- parent_window->DC.NavLayersActiveMaskNext |= window ->DC.NavLayersActiveMaskNext;
5514
+ if (child_window ->Flags & ImGuiWindowFlags_NavFlattened)
5515
+ parent_window->DC.NavLayersActiveMaskNext |= child_window ->DC.NavLayersActiveMaskNext;
5514
5516
}
5515
- if (g.HoveredWindow == window )
5517
+ if (g.HoveredWindow == child_window )
5516
5518
g.LastItemData.StatusFlags |= ImGuiItemStatusFlags_HoveredWindow;
5517
5519
}
5518
5520
g.WithinEndChild = false;
@@ -6314,7 +6316,6 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
6314
6316
window->IDStack.push_back(window->ID);
6315
6317
6316
6318
// Add to stack
6317
- // We intentionally set g.CurrentWindow to NULL to prevent usage until when the viewport is set, then will call SetCurrentWindow()
6318
6319
g.CurrentWindow = window;
6319
6320
ImGuiWindowStackData window_stack_data;
6320
6321
window_stack_data.Window = window;
@@ -6332,6 +6333,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
6332
6333
}
6333
6334
6334
6335
// Add to focus scope stack
6336
+ // We intentionally set g.CurrentWindow to NULL to prevent usage until when the viewport is set, then will call SetCurrentWindow()
6335
6337
PushFocusScope(window->ID);
6336
6338
window->NavRootFocusScopeId = g.CurrentFocusScopeId;
6337
6339
g.CurrentWindow = NULL;
0 commit comments