From 0444588cca15dd08bd61060fb474637f1360d207 Mon Sep 17 00:00:00 2001 From: bbbradsmith Date: Thu, 6 Jul 2023 18:54:35 -0400 Subject: [PATCH] ImGui trickle is critical for MouseButton, Key and Text events, otherwise fast (but sparse) inputs can be lost. This should not cause performance problems for high-poll-rate mouse devices. --- extern/imgui_patched/imgui.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/extern/imgui_patched/imgui.cpp b/extern/imgui_patched/imgui.cpp index 90dc211f3..b670b2ad8 100644 --- a/extern/imgui_patched/imgui.cpp +++ b/extern/imgui_patched/imgui.cpp @@ -9522,6 +9522,8 @@ void ImGui::UpdateInputEvents(bool trickle_fast_inputs) } else if (e->Type == ImGuiInputEventType_MouseButton) { + bool trickle_fast_inputs = true; // forcing trickle for MouseButton event + // Trickling Rule: Stop processing queued events if we got multiple action on the same button const ImGuiMouseButton button = e->MouseButton.Button; IM_ASSERT(button >= 0 && button < ImGuiMouseButton_COUNT); @@ -9549,6 +9551,8 @@ void ImGui::UpdateInputEvents(bool trickle_fast_inputs) } else if (e->Type == ImGuiInputEventType_Key) { + bool trickle_fast_inputs = true; // forcing trickle for Key event + // Trickling Rule: Stop processing queued events if we got multiple action on the same button ImGuiKey key = e->Key.Key; IM_ASSERT(key != ImGuiKey_None); @@ -9570,6 +9574,8 @@ void ImGui::UpdateInputEvents(bool trickle_fast_inputs) } else if (e->Type == ImGuiInputEventType_Text) { + bool trickle_fast_inputs = true; // forcing trickle for Text event + // Trickling Rule: Stop processing queued events if keys/mouse have been interacted with if (trickle_fast_inputs && ((key_changed && trickle_interleaved_keys_and_text) || mouse_button_changed != 0 || mouse_moved || mouse_wheeled)) break;