Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::view::PointerCoalescer Class Reference

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.

Detailed Description

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.

Member Function Documentation

◆ flush_frame()

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.

◆ has_pending()

bool pulp::view::PointerCoalescer::has_pending ( ) const
inline

True when motion is held and waiting for a flush.

◆ last_merged_count()

std::size_t pulp::view::PointerCoalescer::last_merged_count ( ) const
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.

◆ pending_path()

const std::vector< Point > & pulp::view::PointerCoalescer::pending_path ( ) const
inline

Positions merged into the currently-held motion, oldest first, with the surviving position last.

Empty once flushed.

◆ reset()

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.

◆ submit()

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:

  • motion -> empty. It is held until the next flush_frame.
  • press / release / anything not motion -> the held motion first (if any), then the transition itself.

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.

◆ total_merged()

std::size_t pulp::view::PointerCoalescer::total_merged ( ) const
inline

Total motion samples dropped since construction. Diagnostics only.


The documentation for this class was generated from the following file: