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:366
Properties
static var hasPendingWake: Bool { get }
Whether some wake-up has been requested and not yet consumed.
Sources/LavaUI/State.swift:390
Methods
static func now() -> Double
Seconds since boot, on a monotonic clock. The time base for every deadline here.
Sources/LavaUI/State.swift:370
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:407
static func requestWake(in seconds: Double)
Requests a wake no later than seconds from now. Earliest wins.
Sources/LavaUI/State.swift:375
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:419
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:383