enum FrameScheduler
Swift
enum FrameScheduler
When the frame loop should next wake up.
Replaces the caret's special case in the run loop. A Bool cannot express
this: two things animating at once, and whichever finishes first clears the
flag for both. Storing the earliest requested instant composes — a spring
asks for ~16ms, a caret for 500ms, a delayed tooltip for 800ms, and the loop
sleeps until the soonest of them.
Sources/LavaUI/State.swift:348
Properties
static var hasPendingWake: Bool { get }
Not documented.
Sources/LavaUI/State.swift:370
Methods
static func now() -> Double
Not documented.
Sources/LavaUI/State.swift:351
static func requestRedraw(in seconds: Double)
Requests a frame no later than seconds from now.
requestWake alone is not enough for anything that comes due on its
own. It unparks the loop, but present emits nothing while the window
is clean, so the loop wakes, finds no work and parks again — and code
that decides at paint time ("has the pointer rested here long enough
yet?") never gets asked again. That is invisible for an animation,
which dirties the window from its own tick, and fatal for a delay: the
pointer stopping is the whole gesture, so nothing else is coming to
wake it. Use this whenever the deadline itself is the event.
Sources/LavaUI/State.swift:387
static func requestWake(in seconds: Double)
Requests a wake no later than seconds from now. Earliest wins.
Sources/LavaUI/State.swift:356
static func serviceRedraw()
Marks the owed frame dirty once it is due. Called once per loop iteration, after the wait.
A wake that arrives early — unrelated input, an agent, a D-Bus pump —
re-arms the wake rather than dropping it, because the one that was
asked for has already been consumed by timeoutUntilNextWake.
Sources/LavaUI/State.swift:399
static func timeoutUntilNextWake() -> Double
Seconds the loop may block for: negative means "until input arrives". Consumes the request, so a repeating animation must ask again each frame.
Sources/LavaUI/State.swift:364