| 3599 | } |
| 3600 | |
| 3601 | static inline bool IsWindowContentHoverable(ImGuiWindow* window, ImGuiHoveredFlags flags) |
| 3602 | { |
| 3603 | // An active popup disable hovering on other windows (apart from its own children) |
| 3604 | // FIXME-OPT: This could be cached/stored within the window. |
| 3605 | ImGuiContext& g = *GImGui; |
| 3606 | if (g.NavWindow) |
| 3607 | if (ImGuiWindow* focused_root_window = g.NavWindow->RootWindow) |
| 3608 | if (focused_root_window->WasActive && focused_root_window != window->RootWindow) |
| 3609 | { |
| 3610 | // For the purpose of those flags we differentiate "standard popup" from "modal popup" |
| 3611 | // NB: The 'else' is important because Modal windows are also Popups. |
| 3612 | bool want_inhibit = false; |
| 3613 | if (focused_root_window->Flags & ImGuiWindowFlags_Modal) |
| 3614 | want_inhibit = true; |
| 3615 | else if ((focused_root_window->Flags & ImGuiWindowFlags_Popup) && !(flags & ImGuiHoveredFlags_AllowWhenBlockedByPopup)) |
| 3616 | want_inhibit = true; |
| 3617 | |
| 3618 | // Inhibit hover unless the window is within the stack of our modal/popup |
| 3619 | if (want_inhibit) |
| 3620 | if (!ImGui::IsWindowWithinBeginStackOf(window->RootWindow, focused_root_window)) |
| 3621 | return false; |
| 3622 | } |
| 3623 | return true; |
| 3624 | } |
| 3625 | |
| 3626 | // This is roughly matching the behavior of internal-facing ItemHoverable() |
| 3627 | // - we allow hovering to be true when ActiveId==window->MoveID, so that clicking on non-interactive items such as a Text() item still returns true with IsItemHovered() |
no outgoing calls
no test coverage detected