imgui: Mouse spamming wheel events causing input queue to never catch up (was: Can I make imgui consume all the input events when ImGuiIO::ConfigInputTrickleEventQueue is on?)
Version/Branch of Dear ImGui:
Version: 1.88 Branch: master
My Question:
Context: I have a mouse that can generate ~100 WM_MOUSEWHEEL events every second for 15secs when flicked hard. I use ImGuiIO::AddMousePosEvent(); ImGuiIO::AddMouseWheelEvent(); to pass all these events and imgui becomes very unresponsive until the events calm down. I tracked the problem down to ImGuiIO::ConfigInputTrickleEventQueue being true by default. If I turn it off there is no unresponsiveness. Similarly turning off vsync (so ImGui::NewFrame()/ImGui::Render() loop runs as fast as possible) also helps.
My question: Is there a way to make imgui consume all the input in the same frame (and update all the control datastructures multiple times until all the events are consumed) when ImGuiIO::ConfigInputTrickleEventQueue is on? I like the idea of ImGuiIO::ConfigInputTrickleEventQueue flag so I don’t want to turn it off, but I also like to flick my mouse wheel.
Thanks
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 19 (8 by maintainers)
Moving around the mouse/window while wheeling was an example to illustrate the problem of event flooding. A more realistic example would be scrolling to the end of a long list of input fields from top of the window and hit submit button that is at the very bottom. That doesn’t require moving the mouse that much while scrolling. What happens today (if I use the fast mouse wheel) is that button is hit a couple of seconds after I click the mouse button. Everything eventually works but experience isn’t great when mouse wheel events are firing that often. Turning
io.ConfigInputTrickleEventQueueoff improves the experience greatly but as I mentioned in the very first post, I’d like to keep it on in order to not stomp on events I care about (e.g. repeated presses during low fps situations).What is a spinner widget? I searched for
spinin imgui_demo.cpp but I don’t have any hits.That’s fair. If you think rest of the idea is valuable, priority can be a user input instead of a library default.
It isn’t necessarily an obscure mouse https://www.amazon.com/Logitech-M500-Corded-Mouse-Hyper-Fast/dp/B002B3YCQM
Hi, I’m very sorry for the late reply.
My intention for creating this issue was to look for something I can personally do myself, not change something for everyone, unless the change is trivial. I understand what I described could be heavy for general use.
I expect UI to stay interactive just like the file explorer or chrome browser do when “long” wheeling happens (e.g. when I click on a button during wheeling, button still works just like it normally does).
I use DearImGui for simple debugging ui, so I don’t want imgui to lose io events (by keeping
io.ConfigInputTrickleEventQueueon) and I want it to perform reasonably when flooded with wheel events (admittedly, flooding due to wheel events is something I can prevent through my behavior).Approach 1 sounds reasonable to me. I imagine categorizing events into high (mouse/keyboard button press) and low priority (mouse pos/wheel) events and making sure high priority events are handled by merging/skipping over low priority events during event queue flooding could work in this case.
Please find the logs at https://gist.github.com/esert/5ec32d1dbf3be812795f15aa2216f58c
Thanks
PS: In the very last commit under
Tools>DebugLogI have added a[X] IO checkboxallowing to visualize input events and how they are trickled. This is equivalent to what I asked you to enable, but it is now always on.