NewFrame: Allow MovedWindow setting the ImGuiWindowFlags_NoInputs after moving has started in order to be able to detect windows below it, which is useful for e.g. docking mechanisms.

This commit is contained in:
omar
2017-10-25 22:04:31 +02:00
parent a6edd10ee6
commit 3656f2c769
2 changed files with 6 additions and 3 deletions

View File

@ -2361,8 +2361,11 @@ void ImGui::NewFrame()
SaveIniSettingsToDisk(g.IO.IniFilename);
}
// 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 = g.MovingWindow ? g.MovingWindow : FindHoveredWindow(g.IO.MousePos);
// Find the window we are hovering
// - Child windows can extend beyond the limit of their parent so we need to derive HoveredRootWindow from HoveredWindow.
// - When moving a window we can skip the search, which also conveniently bypasses the fact that window->WindowRectClipped is lagging as this point.
// - We also support the moved window toggling the NoInputs flag after moving has started in order to be able to detect windows below it, which is useful for e.g. docking mechanisms.
g.HoveredWindow = (g.MovingWindow && !(g.MovingWindow->Flags & ImGuiWindowFlags_NoInputs)) ? g.MovingWindow : FindHoveredWindow(g.IO.MousePos);
g.HoveredRootWindow = g.HoveredWindow ? g.HoveredWindow->RootWindow : NULL;
if (ImGuiWindow* modal_window = GetFrontMostModalRootWindow())