Gesture, Ui, project: Crafter.Graphics at 364d210, whose pointer and touch events carry their time

The pinned library dropped the compositor's time of every pointer and
touch event, so the app dated them by its own clock at dispatch. Events
queued while the main loop was busy — a List importing a backlog, each
Import an fdatasync — all carried the time the loop came back: a swipe's
backlog read as a few milliseconds' travel and flung the list to its far
end, and a press whose down and up both waited out a stall had them at
one time, a tap where the user held — on a Failed bubble a Retry, an SMS
the user did not ask for. Crafter.Graphics 364d210 keeps the time on the
window (lastInputTime, set before the event fires), one commit on the
master of 2026-11-02, which added the library's review configuration and
no code.

The gesture detector now gets each event's own time, unwrapped past the
wrap at 2^32 into one running clock (an event stamped 0, which the
compositor's time reads for one millisecond in 2^32, gets the host's
clock), and the long-press timer's expiry is the host's elapsed since
the press put on that clock, so a press and its release keep their
distance however late the loop dispatches them — and a release or a move
the detector sees past the long-press time with no timer fired is the
long press itself, at the press, where the press can be one, since the
hold is measured on the events' clock (tests/Gesture pins both). The pin
moves from 3f646ec; the contracts this app relies on are unchanged by
the two commits between.
This commit is contained in:
Jorijn van der Graaf 2026-11-02 16:09:33 +01:00
commit e6b343985d
Signed by: jorijnvdgraaf
GPG key ID: 2937E59CDCC1BCFB
4 changed files with 55 additions and 6 deletions

View file

@ -58,7 +58,13 @@ int main() {
g.Feed(PointerPhase::Down, { 0, 0 }, 5000);
g.Feed(PointerPhase::Cancel, { 0, 0 }, 5010);
Check(!g.Pressed() && g.Feed(PointerPhase::Up, { 0, 0 }, 5020).kind == Kind::None, "a cancel forgets the press");
Check(g.Feed(PointerPhase::Down, { 5, 5 }, 6000).kind == Kind::None && g.Feed(PointerPhase::Up, { 5, 5 }, 6600).kind == Kind::Release, "a long press released without the timer is a release");
g.Feed(PointerPhase::Down, { 5, 5 }, 6000);
const GestureEvent late = g.Feed(PointerPhase::Up, { 5, 5 }, 6600);
Check(late.kind == Kind::LongPress && late.at == Point{ 5, 5 }, "a release past the long-press time with no timer fired — the press and its release dispatched together behind a stall — is the long press, at the press");
g.Feed(PointerPhase::Down, { 5, 5 }, 7000);
const GestureEvent stalled = g.Feed(PointerPhase::Move, { 40, 40 }, 7600);
Check(stalled.kind == Kind::LongPress && stalled.at == Point{ 5, 5 }, "a move past the long-press time with no timer fired is the long press first, at the press: the finger was held that long before it moved");
Check(g.Feed(PointerPhase::Up, { 40, 40 }, 7700).kind == Kind::Release, "and its release a plain release, no drag");
// A press on what has no long press, the host's word before the Down:
// held as long, it is still a tap at its release.