Moving window to front of display and set focus (which happens to be back of our sorted list)
| 6725 | |
| 6726 | // Moving window to front of display and set focus (which happens to be back of our sorted list) |
| 6727 | void ImGui::FocusWindow(ImGuiWindow* window) |
| 6728 | { |
| 6729 | ImGuiContext& g = *GImGui; |
| 6730 | |
| 6731 | if (g.NavWindow != window) |
| 6732 | { |
| 6733 | g.NavWindow = window; |
| 6734 | if (window && g.NavDisableMouseHover) |
| 6735 | g.NavMousePosDirty = true; |
| 6736 | g.NavId = window ? window->NavLastIds[0] : 0; // Restore NavId |
| 6737 | g.NavFocusScopeId = 0; |
| 6738 | g.NavIdIsAlive = false; |
| 6739 | g.NavLayer = ImGuiNavLayer_Main; |
| 6740 | g.NavInitRequest = g.NavMoveSubmitted = g.NavMoveScoringItems = false; |
| 6741 | NavUpdateAnyRequestFlag(); |
| 6742 | //IMGUI_DEBUG_LOG("FocusWindow(\"%s\")\n", window ? window->Name : NULL); |
| 6743 | } |
| 6744 | |
| 6745 | // Close popups if any |
| 6746 | ClosePopupsOverWindow(window, false); |
| 6747 | |
| 6748 | // Move the root window to the top of the pile |
| 6749 | IM_ASSERT(window == NULL || window->RootWindow != NULL); |
| 6750 | ImGuiWindow* focus_front_window = window ? window->RootWindow : NULL; // NB: In docking branch this is window->RootWindowDockStop |
| 6751 | ImGuiWindow* display_front_window = window ? window->RootWindow : NULL; |
| 6752 | |
| 6753 | // Steal active widgets. Some of the cases it triggers includes: |
| 6754 | // - Focus a window while an InputText in another window is active, if focus happens before the old InputText can run. |
| 6755 | // - When using Nav to activate menu items (due to timing of activating on press->new window appears->losing ActiveId) |
| 6756 | if (g.ActiveId != 0 && g.ActiveIdWindow && g.ActiveIdWindow->RootWindow != focus_front_window) |
| 6757 | if (!g.ActiveIdNoClearOnFocusLoss) |
| 6758 | ClearActiveID(); |
| 6759 | |
| 6760 | // Passing NULL allow to disable keyboard focus |
| 6761 | if (!window) |
| 6762 | return; |
| 6763 | |
| 6764 | // Bring to front |
| 6765 | BringWindowToFocusFront(focus_front_window); |
| 6766 | if (((window->Flags | display_front_window->Flags) & ImGuiWindowFlags_NoBringToFrontOnFocus) == 0) |
| 6767 | BringWindowToDisplayFront(display_front_window); |
| 6768 | } |
| 6769 | |
| 6770 | void ImGui::FocusTopMostWindowUnderOne(ImGuiWindow* under_this_window, ImGuiWindow* ignore_window) |
| 6771 | { |
nothing calls this directly
no outgoing calls
no test coverage detected