qml: decrease input lag by activating event filtering after the first event
Currently, the events are filtered in the volume and seek bar to reduce CPU utilization and stuttering. This works by delaying processing until the next event loop processing cycle (see Qt.callLater()
).
However, by doing this we also introduce input lag because even though the intention with filtering is to filter a rapid burst of events (such as, using high precision scrolling or mouse press & move), if there is only one event to process (such as, just clicking a place to set new position) it is also delayed until the next event loop processing cycle.
Here, I intend to not delay the first event. Since it is not possible to know if there are more events coming, I used a timer approach that enables delaying upcoming events after the first event until human moment passes. Any event passed to the handler will re-start the timer, so only after human moment passes since the last event the next event will be immediately processed (not delayed).
Request review @chub.