When a modal popup is open, newly created windows that want focus (i.e. are not popups and do not specify ImGuiWindowFlags_NoFocusOnAppearing) should be positioned behind that modal window, unless the window was created inside the modal begin-stack. In case of multiple stacked modals newly created window honors begin stack order and does not go below its own modal parent. - WindowA // F
| 6310 | // - FindBlockingModal(NULL) == NULL is generally equivalent to GetTopMostPopupModal() == NULL. |
| 6311 | // Only difference is here we check for ->Active/WasActive but it may be unecessary. |
| 6312 | ImGuiWindow* ImGui::FindBlockingModal(ImGuiWindow* window) |
| 6313 | { |
| 6314 | ImGuiContext& g = *GImGui; |
| 6315 | if (g.OpenPopupStack.Size <= 0) |
| 6316 | return NULL; |
| 6317 | |
| 6318 | // Find a modal that has common parent with specified window. Specified window should be positioned behind that modal. |
| 6319 | for (ImGuiPopupData& popup_data : g.OpenPopupStack) |
| 6320 | { |
| 6321 | ImGuiWindow* popup_window = popup_data.Window; |
| 6322 | if (popup_window == NULL || !(popup_window->Flags & ImGuiWindowFlags_Modal)) |
| 6323 | continue; |
| 6324 | if (!popup_window->Active && !popup_window->WasActive) // Check WasActive, because this code may run before popup renders on current frame, also check Active to handle newly created windows. |
| 6325 | continue; |
| 6326 | if (window == NULL) // FindBlockingModal(NULL) test for if FocusWindow(NULL) is naturally possible via a mouse click. |
| 6327 | return popup_window; |
| 6328 | if (IsWindowWithinBeginStackOf(window, popup_window)) // Window may be over modal |
| 6329 | continue; |
| 6330 | return popup_window; // Place window right below first block modal |
| 6331 | } |
| 6332 | return NULL; |
| 6333 | } |
| 6334 | |
| 6335 | // Push a new Dear ImGui window to add widgets to. |
| 6336 | // - A default window called "Debug" is automatically stacked at the beginning of every frame so you can use widgets without explicitly calling a Begin/End pair. |
nothing calls this directly
no outgoing calls
no test coverage detected