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.
| 4963 | |
| 4964 | // 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. |
| 4965 | void ImGui::EndFrame() |
| 4966 | { |
| 4967 | ImGuiContext& g = *GImGui; |
| 4968 | IM_ASSERT(g.Initialized); |
| 4969 | |
| 4970 | // Don't process EndFrame() multiple times. |
| 4971 | if (g.FrameCountEnded == g.FrameCount) |
| 4972 | return; |
| 4973 | IM_ASSERT(g.WithinFrameScope && "Forgot to call ImGui::NewFrame()?"); |
| 4974 | |
| 4975 | CallContextHooks(&g, ImGuiContextHookType_EndFramePre); |
| 4976 | |
| 4977 | ErrorCheckEndFrameSanityChecks(); |
| 4978 | |
| 4979 | // Notify Platform/OS when our Input Method Editor cursor has moved (e.g. CJK inputs using Microsoft IME) |
| 4980 | ImGuiPlatformImeData* ime_data = &g.PlatformImeData; |
| 4981 | if (g.IO.SetPlatformImeDataFn && memcmp(ime_data, &g.PlatformImeDataPrev, sizeof(ImGuiPlatformImeData)) != 0) |
| 4982 | { |
| 4983 | IMGUI_DEBUG_LOG_IO("[io] Calling io.SetPlatformImeDataFn(): WantVisible: %d, InputPos (%.2f,%.2f)\n", ime_data->WantVisible, ime_data->InputPos.x, ime_data->InputPos.y); |
| 4984 | ImGuiViewport* viewport = GetMainViewport(); |
| 4985 | #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS |
| 4986 | if (viewport->PlatformHandleRaw == NULL && g.IO.ImeWindowHandle != NULL) |
| 4987 | { |
| 4988 | viewport->PlatformHandleRaw = g.IO.ImeWindowHandle; |
| 4989 | g.IO.SetPlatformImeDataFn(viewport, ime_data); |
| 4990 | viewport->PlatformHandleRaw = NULL; |
| 4991 | } |
| 4992 | else |
| 4993 | #endif |
| 4994 | { |
| 4995 | g.IO.SetPlatformImeDataFn(viewport, ime_data); |
| 4996 | } |
| 4997 | } |
| 4998 | |
| 4999 | // Hide implicit/fallback "Debug" window if it hasn't been used |
| 5000 | g.WithinFrameScopeWithImplicitWindow = false; |
| 5001 | if (g.CurrentWindow && !g.CurrentWindow->WriteAccessed) |
| 5002 | g.CurrentWindow->Active = false; |
| 5003 | End(); |
| 5004 | |
| 5005 | // Update navigation: CTRL+Tab, wrap-around requests |
| 5006 | NavEndFrame(); |
| 5007 | |
| 5008 | // Drag and Drop: Elapse payload (if delivered, or if source stops being submitted) |
| 5009 | if (g.DragDropActive) |
| 5010 | { |
| 5011 | bool is_delivered = g.DragDropPayload.Delivery; |
| 5012 | bool is_elapsed = (g.DragDropPayload.DataFrameCount + 1 < g.FrameCount) && ((g.DragDropSourceFlags & ImGuiDragDropFlags_SourceAutoExpirePayload) || !IsMouseDown(g.DragDropMouseButton)); |
| 5013 | if (is_delivered || is_elapsed) |
| 5014 | ClearDragDrop(); |
| 5015 | } |
| 5016 | |
| 5017 | // Drag and Drop: Fallback for source tooltip. This is not ideal but better than nothing. |
| 5018 | if (g.DragDropActive && g.DragDropSourceFrameCount < g.FrameCount && !(g.DragDropSourceFlags & ImGuiDragDropFlags_SourceNoPreviewTooltip)) |
| 5019 | { |
| 5020 | g.DragDropWithinSource = true; |
| 5021 | SetTooltip("..."); |
| 5022 | g.DragDropWithinSource = false; |
nothing calls this directly
no test coverage detected