Rebase firmware on 2.3.0, fixing issue with lost ring input events

This commit is contained in:
James Babcock committed 2026-09-19 17:19:21 -07:00
1 parent 8ceecb6393
commit b972cd7682
21 files changed
+790 -156

No files matched your search

+21 -1
View File
@@ -2,6 +2,7 @@ import { G2_LENS_HEIGHT, G2_LENS_WIDTH, GrayImage } from "../../graphics/image";
import { singlePlane, type Plane } from "../../graphics/plane";
import { getDefaultSmallFont } from "../../graphics/ui-fonts";
import { EvenAIStatus, EventSourceType, OsEventTypeList, WatchGestureType } from "../../g2/events";
import { notifyInputListeners } from "../input-monitor";
import type { RawInputEvent } from "../../native/faceclaw-communicator";
import {
directionalFallback,
@@ -708,6 +709,7 @@ class Shell {
}
async receiveInput(event: InputEvent, frameId = 0): Promise<ShellInputOutcome> {
notifyInputListeners(event);
try {
return await this.routeInput(event, frameId);
} finally {
@@ -718,6 +720,16 @@ class Shell {
}
private async routeInput(event: InputEvent, frameId: number): Promise<ShellInputOutcome> {
// Touch-down supplements gestures. It must not wake the screen, operate
// menus, or cancel the hold-to-escape timer. Apps can opt into it later.
if (event.type === "ring-press") {
const window = this.foregroundWindow();
if (this.screenOn && this.focus === "window" && this.stack.isAtBase() && window) {
await window.handleInput(event, frameId);
return { shell: false, window: true };
}
return { shell: false, window: false };
}
const previous = this.lastInput;
this.lastInput = event;
// A visible window may paint a source-dependent indicator (see
@@ -1545,7 +1557,13 @@ export function rawInputEventToInputEvent(event: RawInputEvent): InputEvent {
function rawInputEventToPayload(event: RawInputEvent): InputEventPayload {
if (event.kind === "sys-event") {
if (event.eventType === OsEventTypeList.CLICK_EVENT) {
if (event.eventType === OsEventTypeList.RING_PRESS_EVENT &&
(event.eventSource === EventSourceType.TOUCH_EVENT_FORM_DUMMY_NULL ||
event.eventSource === EventSourceType.TOUCH_EVENT_FROM_RING)) {
// The firmware emits this dedicated ID only for full raw source 4.
// Its stock sender leaves the source unspecified for extension 14.
return { type: "ring-press", source: "ring" };
} else if (event.eventType === OsEventTypeList.CLICK_EVENT) {
return {
type: "click",
source: eventSourceToString(event.eventSource),
@@ -1627,6 +1645,8 @@ function eventSourceToString(eventSource: number): InputSource {
export function inputEventToString(event: InputEvent): string {
switch (event.type) {
case "ring-press":
return "Ring press";
case "click":
return `Click from ${event.source}`;
case "double-click":