Bläddra i källkod

Internal: Reworked FocusFrontMostActiveWindow() so it fits the Nav branch usage as well.

omar 7 år sedan
förälder
incheckning
d730a763f6
1 ändrade filer med 4 tillägg och 4 borttagningar
  1. 4 4
      imgui.cpp

+ 4 - 4
imgui.cpp

@@ -675,7 +675,7 @@ static bool             DataTypeApplyOpFromText(const char* buf, const char* ini
 
 
 namespace ImGui
 namespace ImGui
 {
 {
-static void             FocusFrontMostActiveWindow();
+static void             FocusFrontMostActiveWindow(ImGuiWindow* ignore_window);
 }
 }
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
@@ -2511,7 +2511,7 @@ void ImGui::NewFrame()
 
 
     // Closing the focused window restore focus to the first active root window in descending z-order
     // Closing the focused window restore focus to the first active root window in descending z-order
     if (g.NavWindow && !g.NavWindow->WasActive)
     if (g.NavWindow && !g.NavWindow->WasActive)
-        FocusFrontMostActiveWindow();
+        FocusFrontMostActiveWindow(NULL);
 
 
     // No window should be open at the beginning of the frame.
     // No window should be open at the beginning of the frame.
     // But in order to allow the user to call NewFrame() multiple times without calling Render(), we are doing an explicit clear.
     // But in order to allow the user to call NewFrame() multiple times without calling Render(), we are doing an explicit clear.
@@ -5174,11 +5174,11 @@ void ImGui::FocusWindow(ImGuiWindow* window)
         BringWindowToFront(window);
         BringWindowToFront(window);
 }
 }
 
 
-void ImGui::FocusFrontMostActiveWindow()
+void ImGui::FocusFrontMostActiveWindow(ImGuiWindow* ignore_window)
 {
 {
     ImGuiContext& g = *GImGui;
     ImGuiContext& g = *GImGui;
     for (int i = g.Windows.Size - 1; i >= 0; i--)
     for (int i = g.Windows.Size - 1; i >= 0; i--)
-        if (g.Windows[i]->WasActive && !(g.Windows[i]->Flags & ImGuiWindowFlags_ChildWindow))
+        if (g.Windows[i] != ignore_window && g.Windows[i]->WasActive && !(g.Windows[i]->Flags & ImGuiWindowFlags_ChildWindow))
         {
         {
             FocusWindow(g.Windows[i]);
             FocusWindow(g.Windows[i]);
             return;
             return;