Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions host/apple/Sources/ExactKit/NativeTaskTimers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ extension ExactSession {
func deliverNativeTimer() {
guard state != .destroyed, clock == nil, !ExactEnv.agentFreezes, !applying, !ownerInFlight,
let timer = taskTimers.take() else { return }
followOffset()
if ExactSession.asyncFills {
advanceInFlight = true
let captured = generation
Expand Down
1 change: 1 addition & 0 deletions host/apple/Sources/ExactKit/PageFacts.swift
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ extension ExactSession {
/// notification, in the same turn.
func tellPage() {
guard booted, state != .destroyed else { return }
if clock == nil { followOffset() }
#if canImport(UIKit)
// Out of the foreground, a press hands nothing on (PressHandoffIOS).
if view?.window?.windowScene?.activationState != .foregroundActive { presenter.supersedePress() }
Expand Down
5 changes: 4 additions & 1 deletion host/apple/Sources/ExactKit/Session.swift
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,10 @@ public final class ExactSession {
apply(batch)
}
presenter.onClose = { [unowned self] id in apply(runtime.dialogClose(id, now: now())) }
presenter.onPress = { [unowned self] id in applyInput(runtime.press(id, held: presenter.pressHeld, at: presenter.pressPoint, now: now())) }
presenter.onPress = { [unowned self] id in
if clock == nil { followOffset() }
applyInput(runtime.press(id, held: presenter.pressHeld, at: presenter.pressPoint, now: now()))
}
// A text field's `input` and `change` carry the selection the edit
// left, its `select` the one the person or a script made (x2apps
// codeedit #2, `FieldSelections`).
Expand Down
9 changes: 6 additions & 3 deletions host/apple/Sources/ExactKit/SessionTime.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,14 @@ extension ExactSession {
/// runner's own threshold). The date moves when the clock is set, and
/// through a sleep, since the session's clock (`CACurrentMediaTime`,
/// `mach_absolute_time`) stops while the system sleeps and the date does
/// not. Runs before each advance and frame; `dateChanged` runs it on a
/// system notice.
/// not. Runs before each advance, frame, press, native timer and page
/// notice, and again after a refused `setTime`; `dateChanged` runs it on
/// a system notice.
func followOffset() {
guard let date = dateMoved() else { return }
apply(runtime.setTime(epochAtZero: date.epoch, utcOffset: date.offset))
let batch = runtime.setTime(epochAtZero: date.epoch, utcOffset: date.offset)
apply(batch)
if batch.busy || batch.held { (toldEpoch, offsetHeld) = (nil, nil) }
}
/// `followOffset`'s date, nil when neither moved. `offsetHeld` is the
/// zone the offset was read in and when to read it again: until then, in
Expand Down
Loading