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.
| 4176 | |
| 4177 | // 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. |
| 4178 | void ImGui::EndFrame() |
| 4179 | { |
| 4180 | ImGuiContext& g = *GImGui; |
| 4181 | IM_ASSERT(g.Initialized); |
| 4182 | if (g.FrameCountEnded == g.FrameCount) // Don't process EndFrame() multiple times. |
| 4183 | return; |
| 4184 | IM_ASSERT(g.WithinFrameScope && "Forgot to call ImGui::NewFrame()?"); |
| 4185 | |
| 4186 | // Notify OS when our Input Method Editor cursor has moved (e.g. CJK inputs using Microsoft IME) |
| 4187 | if (g.IO.ImeSetInputScreenPosFn && (g.PlatformImeLastPos.x == FLT_MAX || ImLengthSqr(g.PlatformImeLastPos - g.PlatformImePos) > 0.0001f)) |
| 4188 | { |
| 4189 | g.IO.ImeSetInputScreenPosFn((int)g.PlatformImePos.x, (int)g.PlatformImePos.y); |
| 4190 | g.PlatformImeLastPos = g.PlatformImePos; |
| 4191 | } |
| 4192 | |
| 4193 | ErrorCheckEndFrame(); |
| 4194 | |
| 4195 | // Hide implicit/fallback "Debug" window if it hasn't been used |
| 4196 | g.WithinFrameScopeWithImplicitWindow = false; |
| 4197 | if (g.CurrentWindow && !g.CurrentWindow->WriteAccessed) |
| 4198 | g.CurrentWindow->Active = false; |
| 4199 | End(); |
| 4200 | |
| 4201 | // Show CTRL+TAB list window |
| 4202 | if (g.NavWindowingTarget != NULL) |
| 4203 | NavUpdateWindowingOverlay(); |
| 4204 | |
| 4205 | // Drag and Drop: Elapse payload (if delivered, or if source stops being submitted) |
| 4206 | if (g.DragDropActive) |
| 4207 | { |
| 4208 | bool is_delivered = g.DragDropPayload.Delivery; |
| 4209 | bool is_elapsed = (g.DragDropPayload.DataFrameCount + 1 < g.FrameCount) && ((g.DragDropSourceFlags & ImGuiDragDropFlags_SourceAutoExpirePayload) || !IsMouseDown(g.DragDropMouseButton)); |
| 4210 | if (is_delivered || is_elapsed) |
| 4211 | ClearDragDrop(); |
| 4212 | } |
| 4213 | |
| 4214 | // Drag and Drop: Fallback for source tooltip. This is not ideal but better than nothing. |
| 4215 | if (g.DragDropActive && g.DragDropSourceFrameCount < g.FrameCount) |
| 4216 | { |
| 4217 | g.DragDropWithinSourceOrTarget = true; |
| 4218 | SetTooltip("..."); |
| 4219 | g.DragDropWithinSourceOrTarget = false; |
| 4220 | } |
| 4221 | |
| 4222 | // End frame |
| 4223 | g.WithinFrameScope = false; |
| 4224 | g.FrameCountEnded = g.FrameCount; |
| 4225 | |
| 4226 | // Initiate moving window + handle left-click and right-click focus |
| 4227 | UpdateMouseMovingWindowEndFrame(); |
| 4228 | |
| 4229 | // Sort the window list so that all child windows are after their parent |
| 4230 | // We cannot do that on FocusWindow() because childs may not exist yet |
| 4231 | g.WindowsTempSortBuffer.resize(0); |
| 4232 | g.WindowsTempSortBuffer.reserve(g.Windows.Size); |
| 4233 | for (int i = 0; i != g.Windows.Size; i++) |
| 4234 | { |
| 4235 | ImGuiWindow* window = g.Windows[i]; |
no test coverage detected