1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-11-12 10:11:00 +01:00

Internals: BringWindowToFront() iterate front to back, faster in majority of use cases.

This commit is contained in:
omar 2018-01-07 12:29:54 +01:00
parent 3d24a9eb40
commit 2874aabb93

View File

@ -5123,10 +5123,10 @@ void ImGui::BringWindowToFront(ImGuiWindow* window)
ImGuiContext& g = *GImGui;
if (g.Windows.back() == window)
return;
for (int i = 0; i < g.Windows.Size; i++)
for (int i = g.Windows.Size - 2; i >= 0; i--) // We can ignore the front most window
if (g.Windows[i] == window)
{
g.Windows.erase(g.Windows.begin() + i);
g.Windows.erase(g.Windows.Data + i);
g.Windows.push_back(window);
break;
}