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.
| 2897 | |
| 2898 | // 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. |
| 2899 | void ImGui::EndFrame() |
| 2900 | { |
| 2901 | ImGuiContext& g = *GImGui; |
| 2902 | IM_ASSERT(g.Initialized); // Forgot to call ImGui::NewFrame() |
| 2903 | if (g.FrameCountEnded == g.FrameCount) // Don't process EndFrame() multiple times. |
| 2904 | return; |
| 2905 | |
| 2906 | // Notify OS when our Input Method Editor cursor has moved (e.g. CJK inputs using Microsoft IME) |
| 2907 | if (g.IO.ImeSetInputScreenPosFn && ImLengthSqr(g.OsImePosRequest - g.OsImePosSet) > 0.0001f) |
| 2908 | { |
| 2909 | g.IO.ImeSetInputScreenPosFn((int)g.OsImePosRequest.x, (int)g.OsImePosRequest.y); |
| 2910 | g.OsImePosSet = g.OsImePosRequest; |
| 2911 | } |
| 2912 | |
| 2913 | // Hide implicit "Debug" window if it hasn't been used |
| 2914 | IM_ASSERT(g.CurrentWindowStack.Size == 1); // Mismatched Begin()/End() calls |
| 2915 | if (g.CurrentWindow && !g.CurrentWindow->WriteAccessed) |
| 2916 | g.CurrentWindow->Active = false; |
| 2917 | ImGui::End(); |
| 2918 | |
| 2919 | if (g.ActiveId == 0 && g.HoveredId == 0) |
| 2920 | { |
| 2921 | if (!g.NavWindow || !g.NavWindow->Appearing) // Unless we just made a window/popup appear |
| 2922 | { |
| 2923 | // Click to focus window and start moving (after we're done with all our widgets) |
| 2924 | if (g.IO.MouseClicked[0]) |
| 2925 | { |
| 2926 | if (g.HoveredRootWindow != NULL) |
| 2927 | { |
| 2928 | FocusWindow(g.HoveredWindow); |
| 2929 | if (!(g.HoveredWindow->Flags & ImGuiWindowFlags_NoMove) && !(g.HoveredRootWindow->Flags & ImGuiWindowFlags_NoMove)) |
| 2930 | { |
| 2931 | g.MovingWindow = g.HoveredWindow; |
| 2932 | g.MovingWindowMoveId = g.MovingWindow->MoveId; |
| 2933 | SetActiveID(g.MovingWindowMoveId, g.HoveredRootWindow); |
| 2934 | g.ActiveIdClickOffset = g.IO.MousePos - g.MovingWindow->RootWindow->Pos; |
| 2935 | } |
| 2936 | } |
| 2937 | else if (g.NavWindow != NULL && GetFrontMostModalRootWindow() == NULL) |
| 2938 | { |
| 2939 | // Clicking on void disable focus |
| 2940 | FocusWindow(NULL); |
| 2941 | } |
| 2942 | } |
| 2943 | |
| 2944 | // With right mouse button we close popups without changing focus |
| 2945 | // (The left mouse button path calls FocusWindow which will lead NewFrame->CloseInactivePopups to trigger) |
| 2946 | if (g.IO.MouseClicked[1]) |
| 2947 | { |
| 2948 | // Find the top-most window between HoveredWindow and the front most Modal Window. |
| 2949 | // This is where we can trim the popup stack. |
| 2950 | ImGuiWindow* modal = GetFrontMostModalRootWindow(); |
| 2951 | bool hovered_window_above_modal = false; |
| 2952 | if (modal == NULL) |
| 2953 | hovered_window_above_modal = true; |
| 2954 | for (int i = g.Windows.Size - 1; i >= 0 && hovered_window_above_modal == false; i--) |
| 2955 | { |
| 2956 | ImGuiWindow* window = g.Windows[i]; |
nothing calls this directly
no test coverage detected