Add touch-down event to simulated and watch inputs

This commit is contained in:
James Babcock committed 2026-09-28 02:34:08 -07:00
1 parent 45d2ece0d2
commit 2052e268b0
19 files changed
+191 -35

No files matched your search

+12
View File
@@ -1838,6 +1838,8 @@ class DashboardController {
* test buttons, the watch). "long-press" is a complete short hold;
* "long-press-start" / "long-press-release" let a source with a real
* finger-down/finger-up (the watch) hold for as long as the user does.
* Such a source also sends "ring-press" at each finger-down, as the ring
* does before it knows which gesture the touch will become.
*/
async injectSyntheticRingInput(kind: WearRemoteInputKind, origin: SyntheticInputOrigin = "ring"): Promise<void> {
// Match the ring while the display is dark: a double-click wakes it
@@ -2831,6 +2833,7 @@ class DashboardController {
private buildSyntheticRingInput(
kind:
| "ring-press"
| "click"
| "double-click"
| "scroll-up"
@@ -2879,6 +2882,15 @@ class DashboardController {
systemExitReasonCode: 0,
frameId,
};
case "ring-press":
return {
kind: "sys-event",
containerName: "",
eventType: OsEventTypeList.RING_PRESS_EVENT,
eventSource,
systemExitReasonCode: 0,
frameId,
};
case "long-press":
return {
kind: "sys-event",
+3 -1
View File
@@ -490,10 +490,12 @@ export class IosPreviewController {
gesture(gesture: PhoneGesture, origin: 'watch' | 'ring' | 'mirror', nx = 0, ny = 0): void {
this.inputQueue = this.inputQueue.then(async () => {
if (!this.active) return
// A mirror tap may land on a hit target rather than being a gesture.
if (gesture === 'press' && origin === 'mirror') return
if (gesture === 'tap' && origin === 'mirror' && shell.isScreenOn() && !this.glassesLocked) {
await this.mirrorTap(nx, ny)
} else {
let type: string = ({ tap: 'click', 'double-tap': 'double-click' } as Record<string, string>)[gesture] ?? gesture
let type: string = ({ press: 'ring-press', tap: 'click', 'double-tap': 'double-click' } as Record<string, string>)[gesture] ?? gesture
if (origin === 'ring' && type.startsWith('swipe-')) {
if (type === 'swipe-left' || type === 'swipe-right') return
type = type === 'swipe-up' ? 'scroll-up' : 'scroll-down'
+12
View File
@@ -43,6 +43,8 @@ import { FACECLAW_VERSION } from "../version";
export const WEAR_PROTOCOL_VERSION = 1;
export type WearRemoteInputKind =
/** Touch-down at the start of any pad gesture; arrives on its own path (see handleMessage). */
| "ring-press"
| "click"
| "double-click"
| "scroll-up"
@@ -309,6 +311,16 @@ export class WearRemote {
this.setWatchBattery(valid ? battery : null, valid ? message.payload.charging === true : null);
return;
}
if (message.path === WEAR_PATHS.press) {
// Touch-down ahead of the gesture that follows it. Fire-and-forget like
// the battery (no seq, never acked): wherever that gesture would be
// refused, the press is dropped silently and the gesture's ack says why.
const phase = this.host.getState().phase;
if (watchRemoteEnabledSetting.get() && (phase === "connected" || phase === "charging")) {
await this.host.injectInput("ring-press");
}
return;
}
if (!watchRemoteEnabledSetting.get()) {
ack(false, "Watch control is turned off in Faceclaw's Settings > Watch.");
return;