From 2874aabb9305645ff2e2de0615ce067573d80527 Mon Sep 17 00:00:00 2001 From: omar Date: Sun, 7 Jan 2018 12:29:54 +0100 Subject: [PATCH] Internals: BringWindowToFront() iterate front to back, faster in majority of use cases. --- imgui.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 3728a890..fef9e11c 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -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; }