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.
| 5999 | |
| 6000 | // 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. |
| 6001 | void ImGui::EndFrame() |
| 6002 | { |
| 6003 | ImGuiContext& g = *GImGui; |
| 6004 | IM_ASSERT(g.Initialized); |
| 6005 | |
| 6006 | // Don't process EndFrame() multiple times. |
| 6007 | if (g.FrameCountEnded == g.FrameCount) |
| 6008 | return; |
| 6009 | IM_ASSERT_USER_ERROR_RET(g.WithinFrameScope, "Forgot to call ImGui::NewFrame()?"); |
| 6010 | |
| 6011 | CallContextHooks(&g, ImGuiContextHookType_EndFramePre); |
| 6012 | |
| 6013 | // [EXPERIMENTAL] Recover from errors |
| 6014 | if (g.IO.ConfigErrorRecovery) |
| 6015 | ErrorRecoveryTryToRecoverState(&g.StackSizesInNewFrame); |
| 6016 | ErrorCheckEndFrameSanityChecks(); |
| 6017 | ErrorCheckEndFrameFinalizeErrorTooltip(); |
| 6018 | |
| 6019 | // Notify Platform/OS when our Input Method Editor cursor has moved (e.g. CJK inputs using Microsoft IME) |
| 6020 | ImGuiPlatformImeData* ime_data = &g.PlatformImeData; |
| 6021 | if (g.PlatformIO.Platform_SetImeDataFn != NULL && memcmp(ime_data, &g.PlatformImeDataPrev, sizeof(ImGuiPlatformImeData)) != 0) |
| 6022 | { |
| 6023 | IM_ASSERT(ime_data->ViewportId == IMGUI_VIEWPORT_DEFAULT_ID); // master branch |
| 6024 | ImGuiViewport* viewport = GetMainViewport(); |
| 6025 | IMGUI_DEBUG_LOG_IO("[io] Calling Platform_SetImeDataFn(): WantVisible: %d, InputPos (%.2f,%.2f) for Viewport 0x%08X\n", ime_data->WantVisible, ime_data->InputPos.x, ime_data->InputPos.y, viewport->ID); |
| 6026 | g.PlatformIO.Platform_SetImeDataFn(&g, viewport, ime_data); |
| 6027 | } |
| 6028 | g.WantTextInputNextFrame = ime_data->WantTextInput ? 1 : 0; |
| 6029 | |
| 6030 | // Hide and unfocus implicit/fallback "Debug" window if it hasn't been used |
| 6031 | g.WithinFrameScopeWithImplicitWindow = false; |
| 6032 | if (g.CurrentWindow && g.CurrentWindow->IsFallbackWindow && g.CurrentWindow->WriteAccessed == false) |
| 6033 | { |
| 6034 | g.CurrentWindow->Active = false; |
| 6035 | if (g.NavWindow && g.NavWindow->RootWindow == g.CurrentWindow) |
| 6036 | FocusWindow(NULL); |
| 6037 | } |
| 6038 | End(); |
| 6039 | |
| 6040 | // Update navigation: Ctrl+Tab, wrap-around requests |
| 6041 | NavEndFrame(); |
| 6042 | |
| 6043 | // Drag and Drop: Elapse payload (if delivered, or if source stops being submitted) |
| 6044 | if (g.DragDropActive) |
| 6045 | { |
| 6046 | bool is_delivered = g.DragDropPayload.Delivery; |
| 6047 | bool is_elapsed = (g.DragDropSourceFrameCount + 1 < g.FrameCount) && ((g.DragDropSourceFlags & ImGuiDragDropFlags_PayloadAutoExpire) || g.DragDropMouseButton == -1 || !IsMouseDown(g.DragDropMouseButton)); |
| 6048 | if (is_delivered || is_elapsed) |
| 6049 | ClearDragDrop(); |
| 6050 | } |
| 6051 | |
| 6052 | // Drag and Drop: Fallback for missing source tooltip. This is not ideal but better than nothing. |
| 6053 | // If you want to handle source item disappearing: instead of submitting your description tooltip |
| 6054 | // in the BeginDragDropSource() block of the dragged item, you can submit them from a safe single spot |
| 6055 | // (e.g. end of your item loop, or before EndFrame) by reading payload data. |
| 6056 | // In the typical case, the contents of drag tooltip should be possible to infer solely from payload data. |
| 6057 | if (g.DragDropActive && g.DragDropSourceFrameCount + 1 < g.FrameCount && !(g.DragDropSourceFlags & ImGuiDragDropFlags_SourceNoPreviewTooltip)) |
| 6058 | { |
nothing calls this directly
no test coverage detected