MCPcopy Create free account
hub / github.com/Aegel5/SimpleSwitcher / EndFrame

Method EndFrame

imgui_tiny_app/imgui/imgui.cpp:6228–6337  ·  view source on GitHub ↗

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.

Source from the content-addressed store, hash-verified

6226
6227// 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.
6228void ImGui::EndFrame()
6229{
6230 ImGuiContext& g = *GImGui;
6231 IM_ASSERT(g.Initialized);
6232
6233 // Don't process EndFrame() multiple times.
6234 if (g.FrameCountEnded == g.FrameCount)
6235 return;
6236 IM_ASSERT_USER_ERROR_RET(g.WithinFrameScope, "Forgot to call ImGui::NewFrame()?");
6237
6238 CallContextHooks(&g, ImGuiContextHookType_EndFramePre);
6239
6240 // [EXPERIMENTAL] Recover from errors
6241 if (g.IO.ConfigErrorRecovery)
6242 ErrorRecoveryTryToRecoverState(&g.StackSizesInNewFrame);
6243 ErrorCheckEndFrameSanityChecks();
6244 ErrorCheckEndFrameFinalizeErrorTooltip();
6245
6246 // Notify Platform/OS when our Input Method Editor cursor has moved (e.g. CJK inputs using Microsoft IME)
6247 ImGuiPlatformImeData* ime_data = &g.PlatformImeData;
6248 if (g.PlatformIO.Platform_SetImeDataFn != NULL && memcmp(ime_data, &g.PlatformImeDataPrev, sizeof(ImGuiPlatformImeData)) != 0)
6249 {
6250 ImGuiViewport* viewport = FindViewportByID(ime_data->ViewportId);
6251 if (viewport == NULL)
6252 viewport = GetMainViewport();
6253 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);
6254 g.PlatformIO.Platform_SetImeDataFn(&g, viewport, ime_data);
6255 }
6256 g.WantTextInputNextFrame = ime_data->WantTextInput ? 1 : 0;
6257
6258 // Hide and unfocus implicit/fallback "Debug" window if it hasn't been used
6259 g.WithinFrameScopeWithImplicitWindow = false;
6260 if (g.CurrentWindow && g.CurrentWindow->IsFallbackWindow && g.CurrentWindow->WriteAccessed == false)
6261 {
6262 g.CurrentWindow->Active = false;
6263 if (g.NavWindow && g.NavWindow->RootWindow == g.CurrentWindow)
6264 FocusWindow(NULL);
6265 }
6266 End();
6267
6268 // Update navigation: Ctrl+Tab, wrap-around requests
6269 NavEndFrame();
6270
6271 // Update docking
6272 DockContextEndFrame(&g);
6273
6274 SetCurrentViewport(NULL, NULL);
6275
6276 // Drag and Drop: Elapse payload (if delivered, or if source stops being submitted)
6277 if (g.DragDropActive)
6278 {
6279 bool is_delivered = g.DragDropPayload.Delivery;
6280 bool is_elapsed = (g.DragDropSourceFrameCount + 1 < g.FrameCount) && ((g.DragDropSourceFlags & ImGuiDragDropFlags_PayloadAutoExpire) || g.DragDropMouseButton == -1 || !IsMouseDown(g.DragDropMouseButton));
6281 if (is_delivered || is_elapsed)
6282 ClearDragDrop();
6283 }
6284
6285 // Drag and Drop: Fallback for missing source tooltip. This is not ideal but better than nothing.

Callers

nothing calls this directly

Calls 4

AddWindowToSortBufferFunction · 0.85
resizeMethod · 0.45
reserveMethod · 0.45
swapMethod · 0.45

Tested by

no test coverage detected