diff --git a/App_Resources/Android/src/main/java/com/faceclaw/app/g2protocol/BleProtocol.java b/App_Resources/Android/src/main/java/com/faceclaw/app/g2protocol/BleProtocol.java index b5660a5b..351336b1 100644 --- a/App_Resources/Android/src/main/java/com/faceclaw/app/g2protocol/BleProtocol.java +++ b/App_Resources/Android/src/main/java/com/faceclaw/app/g2protocol/BleProtocol.java @@ -104,6 +104,8 @@ public class BleProtocol { public static final int EVENT_IMU_DATA_REPORT = 8; public static final int EVENT_RING_LONG_PRESS = 9; public static final int EVENT_RING_LONG_PRESS_RELEASE = 10; + // CFW extension: G2 2.2.9 tap-then-hold gesture forwarded to the phone. + public static final int EVENT_SHORT_THEN_LONG_PRESS = 11; public static final int EVENT_SOURCE_GLASSES_R = 1; public static final int EVENT_SOURCE_RING = 2; diff --git a/app/g2/events.ts b/app/g2/events.ts index 139c261e..877dd901 100644 --- a/app/g2/events.ts +++ b/app/g2/events.ts @@ -69,6 +69,8 @@ export const OsEventTypeList = { IMU_DATA_REPORT: 8, RING_LONG_PRESS_EVENT: 9, RING_LONG_PRESS_RELEASE_EVENT: 10, + /** CFW extension: the 2.2.9 tap-then-hold Menu gesture. */ + SHORT_THEN_LONG_PRESS_EVENT: 11, } as const; export const OsEventTypeName: Record = { @@ -83,4 +85,5 @@ export const OsEventTypeName: Record = { 8: "IMU_DATA_REPORT", 9: "RING_LONG_PRESS_EVENT", 10: "RING_LONG_PRESS_RELEASE_EVENT", + 11: "SHORT_THEN_LONG_PRESS_EVENT", }; diff --git a/app/ui/gestures.ts b/app/ui/gestures.ts index 810d14a7..c6662683 100644 --- a/app/ui/gestures.ts +++ b/app/ui/gestures.ts @@ -25,6 +25,8 @@ export type InputEventPayload = | { type: "scroll-down"; source?: InputSource } | { type: "long-press"; source: InputSource } | { type: "long-press-release"; source: InputSource } + /** G2 2.2.9 tap-then-hold gesture, reserved for the shell system menu. */ + | { type: "short-then-long-press"; source: InputSource } /** * Spatial (four-way) input, which only a watch can produce: the ring's * scroll is a one-dimensional cursor, these are directions. Components with diff --git a/app/ui/shell/shell.ts b/app/ui/shell/shell.ts index 564fe45a..a030fc06 100644 --- a/app/ui/shell/shell.ts +++ b/app/ui/shell/shell.ts @@ -61,7 +61,8 @@ import { * the sidebar it focuses the window first); by convention apps answer it with * a window menu that ends in Voice input / Close window. Holding the press * past the escape threshold opens the shell's own escape menu, so the shell - * keeps working when a window's handler hangs. + * keeps working when a window's handler hangs. The 2.2.9 tap-then-hold gesture + * opens that shell menu immediately. */ export type ShellWindow = { @@ -631,6 +632,16 @@ class Shell { return { shell: false, window: false }; } + // The 2.2.9 tap-then-hold gesture is a direct, shell-owned escape hatch. + // Unlike an ordinary long-press it never reaches the app or starts the + // fallback timer: it opens the same system menu that an extended hold + // would eventually open. Its later generic release is consumed while the + // shell overlay is active and therefore cannot leak into the app. + if (event.type === "short-then-long-press") { + this.openEscapeMenu(); + return { shell: true, window: false }; + } + // Long-press goes to the foreground window (from the sidebar it focuses // the window first); apps conventionally answer it with their window // menu. The escape timer runs regardless of what the app does with it: @@ -1141,9 +1152,10 @@ class Shell { } /** - * The held-long-press safeguard menu. Shell-owned and shell-drawn (never - * the app's), so an unresponsive app can always be closed. It opens over - * whatever the app did with the long-press, including its own menu. + * The system/escape menu. Shell-owned and shell-drawn (never the app's), so + * an unresponsive app can always be closed. It opens after an extended hold + * or immediately for tap-then-hold, over whatever the app did with an earlier + * ordinary long-press, including opening its own menu. */ private openEscapeMenu(): void { if (!this.screenOn || this.activeVoiceLayer || !this.stack.isAtBase()) return; @@ -1254,6 +1266,8 @@ function rawInputEventToPayload(event: RawInputEvent): InputEventPayload { return { type: "long-press", source: eventSourceToString(event.eventSource) }; } else if (event.eventType === OsEventTypeList.RING_LONG_PRESS_RELEASE_EVENT) { return { type: "long-press-release", source: eventSourceToString(event.eventSource) }; + } else if (event.eventType === OsEventTypeList.SHORT_THEN_LONG_PRESS_EVENT) { + return { type: "short-then-long-press", source: eventSourceToString(event.eventSource) }; } } else if (event.kind === "watch-gesture") { // Synthetic, from the Wear OS remote (app/g2/wear-remote.ts); the glasses @@ -1325,6 +1339,8 @@ export function inputEventToString(event: InputEvent): string { return `Long press from ${event.source}`; case "long-press-release": return `Long press release from ${event.source}`; + case "short-then-long-press": + return `Short then long press from ${event.source}`; case "swipe-left": return `Swipe left from ${event.source}`; case "swipe-right":