Skip to content

Commit

Permalink
When a popup window is open it inhibit hovering on other windows #126
Browse files Browse the repository at this point in the history
  • Loading branch information
ocornut committed Mar 26, 2015
1 parent de75520 commit ac2da57
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4244,8 +4244,13 @@ static bool IsHovered(const ImRect& bb, ImGuiID id)
ImGuiWindow* window = GetCurrentWindow();
if (g.HoveredRootWindow == window->RootWindow)
{
bool hovered = (g.ActiveId == 0 || g.ActiveId == id || g.ActiveIdIsFocusedOnly) && IsMouseHoveringRect(bb);
return hovered;
if ((g.ActiveId == 0 || g.ActiveId == id || g.ActiveIdIsFocusedOnly) && IsMouseHoveringRect(bb))
{
if (!(g.FocusedWindow->Flags & ImGuiWindowFlags_Popup) || g.FocusedWindow == g.HoveredRootWindow)
{
return true;
}
}
}
}
return false;
Expand Down Expand Up @@ -6999,10 +7004,10 @@ static bool ItemAdd(const ImRect& bb, const ImGuiID* id)
// Matching the behavior of IsHovered() but ignore if ActiveId==window->MoveID (we clicked on the window background)
// So that clicking on items with no active id such as Text() still returns true with IsItemHovered()
window->DC.LastItemHoveredRect = true;
window->DC.LastItemHoveredAndUsable = false;
if (g.ActiveId == 0 || (id && g.ActiveId == *id) || g.ActiveIdIsFocusedOnly || (g.ActiveId == window->MoveID))
window->DC.LastItemHoveredAndUsable = true;
else
window->DC.LastItemHoveredAndUsable = false;
if (!(g.FocusedWindow->Flags & ImGuiWindowFlags_Popup) || g.FocusedWindow == window)
window->DC.LastItemHoveredAndUsable = true;
}
else
{
Expand Down

0 comments on commit ac2da57

Please sign in to comment.