diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 0b26634ec..084829928 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -418,6 +418,9 @@ Docking+Viewports Branch: - Docking: Fixed incorrect focus highlight on docking node when focusing empty central node or a child window which was manually injected into a dockspace window. - Docking, Modal: Fixed a crash when opening popup from a parent which is being docked on the same frame. (#5401) +- Viewports: Fixed an issue where MouseViewport was lagging by a frame when using 1.87 Input Queue. + A common side-effect would be that when releasing a window drag the underlying window would highlight + for a frame. (#5837, #4921) [@cfillion] - Viewports: Fixed translating a host viewport from briefly altering the size of AlwaysAutoResize windows. (#5057) - Viewports: Fixed main viewport size not matching ImDrawData::DisplaySize for one frame during resize when multi-viewports are disabled. (#4900) diff --git a/imgui.cpp b/imgui.cpp index 350f3e20c..ccf96b0c6 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -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();