Fixed hovering of child windows / combo boxes that extend beyond the root window limits.

This commit is contained in:
ocornut 2015-01-04 22:07:37 +00:00
parent 3fe669f547
commit 4905ec46f1

View File

@ -215,7 +215,6 @@
- columns: declare column set (each column: fixed size, %, fill, distribute default size among fills)
- columns: columns header to act as button (~sort op) and allow resize/reorder
- columns: user specify columns size
- combo: overlap test beyond parent window bounding box is broken (used to work)
- combo: turn child handling code into pop up helper
- list selection, concept of a selectable "block" (that can be multiple widgets)
- menubar, menus
@ -1557,7 +1556,11 @@ void ImGui::NewFrame()
SaveSettings();
}
// Find the window we are hovering. Child windows can extend beyond the limit of their parent so we need to derive HoveredRootWindow from HoveredWindow
g.HoveredWindow = FindHoveredWindow(g.IO.MousePos, false);
if (g.HoveredWindow && (g.HoveredWindow->Flags & ImGuiWindowFlags_ChildWindow))
g.HoveredRootWindow = g.HoveredWindow->RootWindow;
else
g.HoveredRootWindow = FindHoveredWindow(g.IO.MousePos, true);
// Are we using inputs? Tell user so they can capture/discard them.
@ -1603,11 +1606,13 @@ void ImGui::NewFrame()
}
// Mark all windows as not visible
// Clear root windows at this point.
for (size_t i = 0; i != g.Windows.size(); i++)
{
ImGuiWindow* window = g.Windows[i];
window->Visible = false;
window->Accessed = false;
window->RootWindow = NULL;
}
// No window should be open at the beginning of the frame.
@ -2705,7 +2710,7 @@ void ImGui::End()
ImGui::LogFinish();
// Pop
window->RootWindow = NULL;
// NB: we don't clear 'window->RootWindow' yet, it will be used then cleared in NewFrame()
g.CurrentWindowStack.pop_back();
g.CurrentWindow = g.CurrentWindowStack.empty() ? NULL : g.CurrentWindowStack.back();
}