Inputs, Viewports: fix UpdateViewportsNewFrame() running before UpdateInputEvents(), leading to MouseViewport lagging by a frame on transitions. (#5837, #4921)

Will merge the swap in master.
This commit is contained in:
cfillion
2022-10-29 20:19:47 -04:00
committed by ocornut
parent 375ae5dce4
commit ced92d9c52
2 changed files with 8 additions and 4 deletions

View File

@@ -4666,6 +4666,11 @@ void ImGui::NewFrame()
g.FramerateSecPerFrameCount = ImMin(g.FramerateSecPerFrameCount + 1, IM_ARRAYSIZE(g.FramerateSecPerFrame));
g.IO.Framerate = (g.FramerateSecPerFrameAccum > 0.0f) ? (1.0f / (g.FramerateSecPerFrameAccum / (float)g.FramerateSecPerFrameCount)) : FLT_MAX;
// Process input queue (trickle as many events as possible), turn events into writes to IO structure
g.InputEventsTrail.resize(0);
UpdateInputEvents(g.IO.ConfigInputTrickleEventQueue);
// Update viewports (after processing input queue, so io.MouseHoveredViewport is set)
UpdateViewportsNewFrame();
// Setup current font and draw list shared data
@@ -4788,10 +4793,6 @@ void ImGui::NewFrame()
//if (g.IO.AppFocusLost)
// ClosePopupsExceptModals();
// Process input queue (trickle as many events as possible)
g.InputEventsTrail.resize(0);
UpdateInputEvents(g.IO.ConfigInputTrickleEventQueue);
// Update keyboard input state
UpdateKeyboardInputs();