Refactor EndFrame() code that process focusing window with left mouse button. This commit should be no-op.

This commit is contained in:
omar 2017-10-20 13:07:57 +02:00
parent 2a32a2e662
commit 5f7299e15a

View File

@ -2771,10 +2771,12 @@ void ImGui::EndFrame()
g.CurrentWindow->Active = false; g.CurrentWindow->Active = false;
ImGui::End(); ImGui::End();
// Click to focus window and start moving (after we're done with all our widgets) if (g.ActiveId == 0 && g.HoveredId == 0)
if (g.ActiveId == 0 && g.HoveredId == 0 && g.IO.MouseClicked[0])
{ {
if (!(g.NavWindow && !g.NavWindow->WasActive && g.NavWindow->Active)) // Unless we just made a popup appear if (!g.NavWindow || g.NavWindow->WasActive || !g.NavWindow->Active) // Unless we just made a popup appear
{
// Click to focus window and start moving (after we're done with all our widgets)
if (g.IO.MouseClicked[0])
{ {
if (g.HoveredRootWindow != NULL) if (g.HoveredRootWindow != NULL)
{ {
@ -2793,6 +2795,7 @@ void ImGui::EndFrame()
} }
} }
} }
}
// Sort the window list so that all child windows are after their parent // Sort the window list so that all child windows are after their parent
// We cannot do that on FocusWindow() because childs may not exist yet // We cannot do that on FocusWindow() because childs may not exist yet