mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
Begin: Simplified code and fixed a bug where appending into a window a second time (from a remote window) would incorrectly overwrite RootWindow with the current window in the stack. Our docking code uses this pattern.
This commit is contained in:
parent
16a5da9521
commit
f0b4097c54
20
imgui.cpp
20
imgui.cpp
@ -4181,21 +4181,17 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
g.SetNextWindowFocus = false;
|
g.SetNextWindowFocus = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update known root window (if we are a child window, otherwise window == window->RootWindow)
|
|
||||||
int root_idx, root_non_popup_idx;
|
|
||||||
for (root_idx = g.CurrentWindowStack.Size - 1; root_idx > 0; root_idx--)
|
|
||||||
if (!(g.CurrentWindowStack[root_idx]->Flags & ImGuiWindowFlags_ChildWindow))
|
|
||||||
break;
|
|
||||||
for (root_non_popup_idx = root_idx; root_non_popup_idx > 0; root_non_popup_idx--)
|
|
||||||
if (!(g.CurrentWindowStack[root_non_popup_idx]->Flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_Popup)) || (g.CurrentWindowStack[root_non_popup_idx]->Flags & ImGuiWindowFlags_Modal))
|
|
||||||
break;
|
|
||||||
window->ParentWindow = parent_window;
|
|
||||||
window->RootWindow = g.CurrentWindowStack[root_idx];
|
|
||||||
window->RootNonPopupWindow = g.CurrentWindowStack[root_non_popup_idx]; // Used to display TitleBgActive color and for selecting which window to use for NavWindowing
|
|
||||||
|
|
||||||
// When reusing window again multiple times a frame, just append content (don't need to setup again)
|
// When reusing window again multiple times a frame, just append content (don't need to setup again)
|
||||||
if (first_begin_of_the_frame)
|
if (first_begin_of_the_frame)
|
||||||
{
|
{
|
||||||
|
// Initialize
|
||||||
|
window->ParentWindow = parent_window;
|
||||||
|
window->RootWindow = !(flags & ImGuiWindowFlags_ChildWindow) ? window : parent_window->RootWindow;
|
||||||
|
window->RootNonPopupWindow = !(flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_Popup)) || (flags & ImGuiWindowFlags_Modal) ? window : parent_window->RootNonPopupWindow; // Used to display TitleBgActive color and for selecting which window to use for NavWindowing
|
||||||
|
//window->RootNavWindow = window;
|
||||||
|
//while (window->RootNavWindow->Flags & ImGuiWindowFlags_NavFlattened)
|
||||||
|
// window->RootNavWindow = window->RootNavWindow->ParentWindow;
|
||||||
|
|
||||||
window->Active = true;
|
window->Active = true;
|
||||||
window->OrderWithinParent = 0;
|
window->OrderWithinParent = 0;
|
||||||
window->BeginCount = 0;
|
window->BeginCount = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user