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
| 12248 | // - FindBlockingModal(NULL) == NULL is generally equivalent to GetTopMostPopupModal() == NULL. |
| 12249 | // Only difference is here we check for ->Active/WasActive but it may be unnecessary. |
| 12250 | ImGuiWindow* ImGui::FindBlockingModal(ImGuiWindow* window) |
| 12251 | { |
| 12252 | ImGuiContext& g = *GImGui; |
| 12253 | if (g.OpenPopupStack.Size <= 0) |
| 12254 | return NULL; |
| 12255 | |
| 12256 | // Find a modal that has common parent with specified window. Specified window should be positioned behind that modal. |
| 12257 | for (ImGuiPopupData& popup_data : g.OpenPopupStack) |
| 12258 | { |
| 12259 | ImGuiWindow* popup_window = popup_data.Window; |
| 12260 | if (popup_window == NULL || !(popup_window->Flags & ImGuiWindowFlags_Modal)) |
| 12261 | continue; |
| 12262 | 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. |
| 12263 | continue; |
| 12264 | if (window == NULL) // FindBlockingModal(NULL) test for if FocusWindow(NULL) is naturally possible via a mouse click. |
| 12265 | return popup_window; |
| 12266 | if (IsWindowWithinBeginStackOf(window, popup_window)) // Window may be over modal |
| 12267 | continue; |
| 12268 | return popup_window; // Place window right below first block modal |
| 12269 | } |
| 12270 | return NULL; |
| 12271 | } |
| 12272 | |
| 12273 | void ImGui::OpenPopup(const char* str_id, ImGuiPopupFlags popup_flags) |
| 12274 | { |
nothing calls this directly
no outgoing calls
no test coverage detected