Collapses runs of motion into one sample per presented frame while leaving button transitions untouched and in order. More...
#include <pointer_coalescer.hpp>
Public Member Functions | |
| std::vector< PointerSample > | submit (const PointerSample &sample) |
| Feed one raw sample. | |
| std::vector< PointerSample > | flush_frame () |
| Call once per PRESENTED frame. | |
| bool | has_pending () const |
| True when motion is held and waiting for a flush. | |
| const std::vector< Point > & | pending_path () const |
| Positions merged into the currently-held motion, oldest first, with the surviving position last. | |
| std::size_t | last_merged_count () const |
| Raw motion samples discarded by the most recent flush or transition — the samples that would have been dispatched without coalescing, minus the one that survived. | |
| std::size_t | total_merged () const |
| Total motion samples dropped since construction. Diagnostics only. | |
| void | reset () |
| Drop any held motion without dispatching it. | |
Collapses runs of motion into one sample per presented frame while leaving button transitions untouched and in order.
Ownership of timing sits with the caller: submit returns what must be dispatched immediately, and flush_frame is called once per presented frame. There is no timer and no clock here.
| std::vector< PointerSample > pulp::view::PointerCoalescer::flush_frame | ( | ) |
Call once per PRESENTED frame.
Returns at most one motion sample, carrying the newest position and the merged path.
|
inline |
True when motion is held and waiting for a flush.
|
inline |
Raw motion samples discarded by the most recent flush or transition — the samples that would have been dispatched without coalescing, minus the one that survived.
Diagnostics only.
|
inline |
Positions merged into the currently-held motion, oldest first, with the surviving position last.
Empty once flushed.
| void pulp::view::PointerCoalescer::reset | ( | ) |
Drop any held motion without dispatching it.
For a host tearing down a window mid-gesture, where the target may already be gone.
| std::vector< PointerSample > pulp::view::PointerCoalescer::submit | ( | const PointerSample & | sample | ) |
Feed one raw sample.
Returns the samples the caller must dispatch RIGHT NOW, in order:
Flushing held motion ahead of a transition is what keeps a gesture's end from arriving before its last movement, and it is why a release can never swallow the motion that preceded it. Transitions dispatch immediately rather than waiting for the frame because a click deferred to the next presented frame is a click delayed by a whole frame — 370ms on the build that motivated this, which would trade a drag problem for a click problem.
|
inline |
Total motion samples dropped since construction. Diagnostics only.