Fix an iOS issue where depth would be incorrect on first frame of fade-in on wake; also refine the keyboard input dialog

This commit is contained in:
James Babcock committed 2026-10-25 15:59:45 -07:00
1 parent 22f869d31c
commit 361b514f9a
21 files changed
+546 -138

No files matched your search

+5 -22
View File
@@ -124,12 +124,10 @@ export type DashboardSnapshot = {
activeTextEditorToggleValue: boolean;
activeTextEditorToggleVisible: boolean;
/**
* The keyboard dialog is up on the glasses (opened by the phone's keyboard
* button): the phone shows its typing panel, with a send button per
* destination in the glasses menu's row order.
* The keyboard dialog is open (opened by the phone's keyboard button): the
* phone shows its typing panel, driven by keyboardInputSession.
*/
keyboardInputActive: boolean;
keyboardInputTargets: ReadonlyArray<{ id: string; label: string }>;
evenAppConflictMessage: string;
evenAppConflictWarningVisible: boolean;
firmwareWarningMessage: string;
@@ -1122,7 +1120,6 @@ class DashboardController {
activeTextEditorToggleValue: this.activeTextEditorToggle?.setting.get() ?? false,
activeTextEditorToggleVisible: this.activeTextEditorToggle !== null,
keyboardInputActive: this.keyboardInput !== null,
keyboardInputTargets: this.keyboardInput?.targets ?? [],
evenAppConflictMessage: this.evenAppConflictMessage,
evenAppConflictWarningVisible: this.evenAppConflictMessage.length > 0,
firmwareWarningMessage: this.firmwareWarningMessage,
@@ -1321,23 +1318,9 @@ class DashboardController {
shell.startKeyboardInput();
}
/** The phone's typing panel changed: mirror the text on the glasses. */
setKeyboardInputText(text: string): void {
shell.noteUserActivity();
this.keyboardInput?.setText(text);
}
/** Send to one destination, or (no id: the IME's send key) the one highlighted on the glasses. */
sendKeyboardInput(targetId?: string): void {
if (targetId) {
this.keyboardInput?.sendTo(targetId);
} else {
this.keyboardInput?.send();
}
}
discardKeyboardInput(): void {
this.keyboardInput?.discard();
/** The open keyboard dialog, for the phone's typing panel (KeyboardInputViewModel). */
get keyboardInputSession(): KeyboardInputSession | null {
return this.keyboardInput;
}
setActiveTextEditorToggleValue(value: boolean): void {
+23 -4
View File
@@ -131,6 +131,8 @@ export class IosPreviewController {
private clockMinute = -1
private shellRenderInProgress = false
private shellRenderQueued = false
/** The shell woke; the next shell render unblanks the compositor after submitting. */
private unblankAfterShellRender = false
private nextFrameId = 1
private nextWorkerFrame = 0
private inputQueue: Promise<void> = Promise.resolve()
@@ -199,6 +201,9 @@ export class IosPreviewController {
send: () => { if (this.active && !this.glassesLocked) session.send() },
sendTo: id => { if (this.active && !this.glassesLocked) session.sendTo(id) },
discard: () => session.discard(),
get visibility() { return session.visibility },
setVisibility: visibility => { if (this.active && !this.glassesLocked) session.setVisibility(visibility) },
get history() { return session.history },
} : null),
prepareVoiceCapture: () => this.prepareVoiceCapture(),
getScreenTimeoutMs: () => null,
@@ -211,7 +216,12 @@ export class IosPreviewController {
},
onScreenStateChanged: on => {
if (on) this.glance.dismiss()
void this.display?.setScreenBlanked(!on).catch(error => this.fail(error))
// A wake unblanks only once the next shell render has staged an awake
// scene: unblanking composites the retained one, painted while asleep
// with no chrome and depth 0, and that first frame is the one the
// brightness fade-in starts on.
this.unblankAfterShellRender = on
if (!on) void this.display?.setScreenBlanked(true).catch(error => this.fail(error))
this.requestShellRender()
},
})
@@ -521,10 +531,19 @@ export class IosPreviewController {
await this.displayReady
const display = this.display
if (!display) return
const startedAt = Date.now()
const bytes = shell.paintScene()
// Taken with the paint, so a render that painted before the wake can't unblank.
const unblank = this.unblankAfterShellRender
this.unblankAfterShellRender = false
const frameId = this.allocateFrameId()
await display.submitShellScene(bytes, Date.now() - startedAt, frameId)
try {
const startedAt = Date.now()
const bytes = shell.paintScene()
await display.submitShellScene(bytes, Date.now() - startedAt, frameId)
} finally {
// Even if the render failed, so the screen doesn't stay dark; not if it
// went back to sleep meanwhile (that sleep re-blanked).
if (unblank && shell.isScreenOn()) await display.setScreenBlanked(false)
}
// Backpressure: the next shell render waits for this one to reach the
// glasses (the preview target resolves immediately; nothing transmits).
await display.waitForFrameFinished(frameId, FRAME_TRANSMIT_BACKPRESSURE_TIMEOUT_MS)