This is normally called by Render(). You may want to call it directly if you want to avoid calling Render() but the gain will be very minimal.
| 4765 | |
| 4766 | // This is normally called by Render(). You may want to call it directly if you want to avoid calling Render() but the gain will be very minimal. |
| 4767 | void ImGui::EndFrame() |
| 4768 | { |
| 4769 | ImGuiContext& g = *GImGui; |
| 4770 | IM_ASSERT(g.Initialized); |
| 4771 | |
| 4772 | // Don't process EndFrame() multiple times. |
| 4773 | if (g.FrameCountEnded == g.FrameCount) |
| 4774 | return; |
| 4775 | IM_ASSERT(g.WithinFrameScope && "Forgot to call ImGui::NewFrame()?"); |
| 4776 | |
| 4777 | CallContextHooks(&g, ImGuiContextHookType_EndFramePre); |
| 4778 | |
| 4779 | ErrorCheckEndFrameSanityChecks(); |
| 4780 | |
| 4781 | // Notify Platform/OS when our Input Method Editor cursor has moved (e.g. CJK inputs using Microsoft IME) |
| 4782 | if (g.IO.SetPlatformImeDataFn && memcmp(&g.PlatformImeData, &g.PlatformImeDataPrev, sizeof(ImGuiPlatformImeData)) != 0) |
| 4783 | g.IO.SetPlatformImeDataFn(GetMainViewport(), &g.PlatformImeData); |
| 4784 | |
| 4785 | // Hide implicit/fallback "Debug" window if it hasn't been used |
| 4786 | g.WithinFrameScopeWithImplicitWindow = false; |
| 4787 | if (g.CurrentWindow && !g.CurrentWindow->WriteAccessed) |
| 4788 | g.CurrentWindow->Active = false; |
| 4789 | End(); |
| 4790 | |
| 4791 | // Update navigation: CTRL+Tab, wrap-around requests |
| 4792 | NavEndFrame(); |
| 4793 | |
| 4794 | // Drag and Drop: Elapse payload (if delivered, or if source stops being submitted) |
| 4795 | if (g.DragDropActive) |
| 4796 | { |
| 4797 | bool is_delivered = g.DragDropPayload.Delivery; |
| 4798 | bool is_elapsed = (g.DragDropPayload.DataFrameCount + 1 < g.FrameCount) && ((g.DragDropSourceFlags & ImGuiDragDropFlags_SourceAutoExpirePayload) || !IsMouseDown(g.DragDropMouseButton)); |
| 4799 | if (is_delivered || is_elapsed) |
| 4800 | ClearDragDrop(); |
| 4801 | } |
| 4802 | |
| 4803 | // Drag and Drop: Fallback for source tooltip. This is not ideal but better than nothing. |
| 4804 | if (g.DragDropActive && g.DragDropSourceFrameCount < g.FrameCount && !(g.DragDropSourceFlags & ImGuiDragDropFlags_SourceNoPreviewTooltip)) |
| 4805 | { |
| 4806 | g.DragDropWithinSource = true; |
| 4807 | SetTooltip("..."); |
| 4808 | g.DragDropWithinSource = false; |
| 4809 | } |
| 4810 | |
| 4811 | // End frame |
| 4812 | g.WithinFrameScope = false; |
| 4813 | g.FrameCountEnded = g.FrameCount; |
| 4814 | |
| 4815 | // Initiate moving window + handle left-click and right-click focus |
| 4816 | UpdateMouseMovingWindowEndFrame(); |
| 4817 | |
| 4818 | // Sort the window list so that all child windows are after their parent |
| 4819 | // We cannot do that on FocusWindow() because children may not exist yet |
| 4820 | g.WindowsTempSortBuffer.resize(0); |
| 4821 | g.WindowsTempSortBuffer.reserve(g.Windows.Size); |
| 4822 | for (int i = 0; i != g.Windows.Size; i++) |
| 4823 | { |
| 4824 | ImGuiWindow* window = g.Windows[i]; |
nothing calls this directly
no test coverage detected