| 13710 | } |
| 13711 | |
| 13712 | void ImGui::FocusTopMostWindowUnderOne(ImGuiWindow* under_this_window, ImGuiWindow* ignore_window, ImGuiViewport* filter_viewport, ImGuiFocusRequestFlags flags) |
| 13713 | { |
| 13714 | ImGuiContext& g = *GImGui; |
| 13715 | int start_idx = g.WindowsFocusOrder.Size - 1; |
| 13716 | if (under_this_window != NULL) |
| 13717 | { |
| 13718 | // Aim at root window behind us, if we are in a child window that's our own root (see #4640) |
| 13719 | int offset = -1; |
| 13720 | while (under_this_window->Flags & ImGuiWindowFlags_ChildWindow) |
| 13721 | { |
| 13722 | under_this_window = under_this_window->ParentWindow; |
| 13723 | offset = 0; |
| 13724 | } |
| 13725 | start_idx = FindWindowFocusIndex(under_this_window) + offset; |
| 13726 | } |
| 13727 | for (int i = start_idx; i >= 0; i--) |
| 13728 | { |
| 13729 | // 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. |
| 13730 | ImGuiWindow* window = g.WindowsFocusOrder[i]; |
| 13731 | if (window == ignore_window || !window->WasActive) |
| 13732 | continue; |
| 13733 | if (filter_viewport != NULL && window->Viewport != filter_viewport) |
| 13734 | continue; |
| 13735 | if ((window->Flags & (ImGuiWindowFlags_NoMouseInputs | ImGuiWindowFlags_NoNavInputs)) != (ImGuiWindowFlags_NoMouseInputs | ImGuiWindowFlags_NoNavInputs)) |
| 13736 | { |
| 13737 | // FIXME-DOCK: When ImGuiFocusRequestFlags_RestoreFocusedChild is set... |
| 13738 | // This is failing (lagging by one frame) for docked windows. |
| 13739 | // If A and B are docked into window and B disappear, at the NewFrame() call site window->NavLastChildNavWindow will still point to B. |
| 13740 | // We might leverage the tab order implicitly stored in window->DockNodeAsHost->TabBar (essentially the 'most_recently_selected_tab' code in tab bar will do that but on next update) |
| 13741 | // to tell which is the "previous" window. Or we may leverage 'LastFrameFocused/LastFrameJustFocused' and have this function handle child window itself? |
| 13742 | FocusWindow(window, flags); |
| 13743 | return; |
| 13744 | } |
| 13745 | } |
| 13746 | FocusWindow(NULL, flags); |
| 13747 | } |
| 13748 | |
| 13749 | //----------------------------------------------------------------------------- |
| 13750 | // [SECTION] KEYBOARD/GAMEPAD NAVIGATION |
nothing calls this directly
no outgoing calls
no test coverage detected