| 3679 | } |
| 3680 | |
| 3681 | static inline bool IsWindowContentHoverable(ImGuiWindow* window, ImGuiHoveredFlags flags) |
| 3682 | { |
| 3683 | // An active popup disable hovering on other windows (apart from its own children) |
| 3684 | // FIXME-OPT: This could be cached/stored within the window. |
| 3685 | ImGuiContext& g = *GImGui; |
| 3686 | if (g.NavWindow) |
| 3687 | if (ImGuiWindow* focused_root_window = g.NavWindow->RootWindowDockTree) |
| 3688 | if (focused_root_window->WasActive && focused_root_window != window->RootWindowDockTree) |
| 3689 | { |
| 3690 | // For the purpose of those flags we differentiate "standard popup" from "modal popup" |
| 3691 | // NB: The 'else' is important because Modal windows are also Popups. |
| 3692 | bool want_inhibit = false; |
| 3693 | if (focused_root_window->Flags & ImGuiWindowFlags_Modal) |
| 3694 | want_inhibit = true; |
| 3695 | else if ((focused_root_window->Flags & ImGuiWindowFlags_Popup) && !(flags & ImGuiHoveredFlags_AllowWhenBlockedByPopup)) |
| 3696 | want_inhibit = true; |
| 3697 | |
| 3698 | // Inhibit hover unless the window is within the stack of our modal/popup |
| 3699 | if (want_inhibit) |
| 3700 | if (!ImGui::IsWindowWithinBeginStackOf(window->RootWindow, focused_root_window)) |
| 3701 | return false; |
| 3702 | } |
| 3703 | |
| 3704 | // Filter by viewport |
| 3705 | if (window->Viewport != g.MouseViewport) |
| 3706 | if (g.MovingWindow == NULL || window->RootWindowDockTree != g.MovingWindow->RootWindowDockTree) |
| 3707 | return false; |
| 3708 | |
| 3709 | return true; |
| 3710 | } |
| 3711 | |
| 3712 | // This is roughly matching the behavior of internal-facing ItemHoverable() |
| 3713 | // - 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