@@ -891,6 +891,8 @@ static bool DataTypeApplyOpFromText(const char* buf, const char* ini
891
891
892
892
namespace ImGui
893
893
{
894
+ static bool BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, bool border, ImGuiWindowFlags flags);
895
+
894
896
static void NavUpdate();
895
897
static void NavUpdateWindowing();
896
898
static void NavProcessItem(ImGuiWindow* window, const ImRect& nav_bb, const ImGuiID id);
@@ -5465,45 +5467,47 @@ bool ImGui::BeginPopupContextVoid(const char* str_id, int mouse_button)
5465
5467
return BeginPopupEx(id, ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoSavedSettings);
5466
5468
}
5467
5469
5468
- static bool BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, bool border, ImGuiWindowFlags extra_flags )
5470
+ static bool ImGui:: BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, bool border, ImGuiWindowFlags flags )
5469
5471
{
5470
5472
ImGuiContext& g = *GImGui;
5471
- ImGuiWindow* parent_window = ImGui::GetCurrentWindow();
5472
- ImGuiWindowFlags flags = ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoSavedSettings|ImGuiWindowFlags_ChildWindow;
5473
+ ImGuiWindow* parent_window = g.CurrentWindow;
5474
+
5475
+ flags |= ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoSavedSettings|ImGuiWindowFlags_ChildWindow;
5473
5476
flags |= (parent_window->Flags & ImGuiWindowFlags_NoMove); // Inherit the NoMove flag
5474
5477
5475
- const ImVec2 content_avail = ImGui::GetContentRegionAvail();
5478
+ // Size
5479
+ const ImVec2 content_avail = GetContentRegionAvail();
5476
5480
ImVec2 size = ImFloor(size_arg);
5477
5481
const int auto_fit_axises = ((size.x == 0.0f) ? (1 << ImGuiAxis_X) : 0x00) | ((size.y == 0.0f) ? (1 << ImGuiAxis_Y) : 0x00);
5478
5482
if (size.x <= 0.0f)
5479
5483
size.x = ImMax(content_avail.x + size.x, 4.0f); // Arbitrary minimum child size (0.0f causing too much issues)
5480
5484
if (size.y <= 0.0f)
5481
5485
size.y = ImMax(content_avail.y + size.y, 4.0f);
5486
+ SetNextWindowSize(size);
5482
5487
5483
- const float backup_border_size = g.Style.ChildBorderSize;
5484
- if (!border)
5485
- g.Style.ChildBorderSize = 0.0f;
5486
- flags |= extra_flags;
5487
-
5488
+ // Name
5488
5489
char title[256];
5489
5490
if (name)
5490
5491
ImFormatString(title, IM_ARRAYSIZE(title), "%s/%s", parent_window->Name, name);
5491
5492
else
5492
5493
ImFormatString(title, IM_ARRAYSIZE(title), "%s/%08X", parent_window->Name, id);
5493
5494
5494
- ImGui::SetNextWindowSize(size);
5495
- bool ret = ImGui::Begin(title, NULL, flags);
5496
- ImGuiWindow* child_window = ImGui::GetCurrentWindow();
5495
+ const float backup_border_size = g.Style.ChildBorderSize;
5496
+ if (!border)
5497
+ g.Style.ChildBorderSize = 0.0f;
5498
+ bool ret = Begin(title, NULL, flags);
5499
+ g.Style.ChildBorderSize = backup_border_size;
5500
+
5501
+ ImGuiWindow* child_window = g.CurrentWindow;
5497
5502
child_window->ChildId = id;
5498
5503
child_window->AutoFitChildAxises = auto_fit_axises;
5499
- g.Style.ChildBorderSize = backup_border_size;
5500
5504
5501
5505
// Process navigation-in immediately so NavInit can run on first frame
5502
- if (!(flags & ImGuiWindowFlags_NavFlattened) && (child_window->DC.NavLayerActiveMask != 0 || child_window->DC.NavHasScroll) && g.NavActivateId == id )
5506
+ if (g.NavActivateId == id && !(flags & ImGuiWindowFlags_NavFlattened) && (child_window->DC.NavLayerActiveMask != 0 || child_window->DC.NavHasScroll))
5503
5507
{
5504
- ImGui:: FocusWindow(child_window);
5505
- ImGui:: NavInitWindow(child_window, false);
5506
- ImGui:: SetActiveID(id+1, child_window); // Steal ActiveId with a dummy id so that key-press won't activate child item
5508
+ FocusWindow(child_window);
5509
+ NavInitWindow(child_window, false);
5510
+ SetActiveID(id+1, child_window); // Steal ActiveId with a dummy id so that key-press won't activate child item
5507
5511
g.ActiveIdSource = ImGuiInputSource_Nav;
5508
5512
}
5509
5513
0 commit comments