MCPcopy Create free account
hub / github.com/Wemino/EchoPatch / FocusTopMostWindowUnderOne

Method FocusTopMostWindowUnderOne

include/imgui/imgui.cpp:12984–13013  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12982}
12983
12984void ImGui::FocusTopMostWindowUnderOne(ImGuiWindow* under_this_window, ImGuiWindow* ignore_window, ImGuiViewport* filter_viewport, ImGuiFocusRequestFlags flags)
12985{
12986 ImGuiContext& g = *GImGui;
12987 IM_UNUSED(filter_viewport); // Unused in master branch.
12988 int start_idx = g.WindowsFocusOrder.Size - 1;
12989 if (under_this_window != NULL)
12990 {
12991 // Aim at root window behind us, if we are in a child window that's our own root (see #4640)
12992 int offset = -1;
12993 while (under_this_window->Flags & ImGuiWindowFlags_ChildWindow)
12994 {
12995 under_this_window = under_this_window->ParentWindow;
12996 offset = 0;
12997 }
12998 start_idx = FindWindowFocusIndex(under_this_window) + offset;
12999 }
13000 for (int i = start_idx; i >= 0; i--)
13001 {
13002 // We may later decide to test for different NoXXXInputs based on the active navigation input (mouse vs nav) but that may feel more confusing to the user.
13003 ImGuiWindow* window = g.WindowsFocusOrder[i];
13004 if (window == ignore_window || !window->WasActive)
13005 continue;
13006 if ((window->Flags & (ImGuiWindowFlags_NoMouseInputs | ImGuiWindowFlags_NoNavInputs)) != (ImGuiWindowFlags_NoMouseInputs | ImGuiWindowFlags_NoNavInputs))
13007 {
13008 FocusWindow(window, flags);
13009 return;
13010 }
13011 }
13012 FocusWindow(NULL, flags);
13013}
13014
13015//-----------------------------------------------------------------------------
13016// [SECTION] KEYBOARD/GAMEPAD NAVIGATION

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected