forked from Blendman974/faceclaw
Move and rename DashboardInputEvent->InputEvent
This commit is contained in:
1 parent
3e8be93833
commit
80d688dd4e
51 files changed
+299
-361
No files matched your search
@@ -1,10 +1,10 @@
|
||||
import { G2_LENS_WIDTH, GrayImage } from "../../graphics/image";
|
||||
import { type BdfFont } from "../../graphics/bdffont";
|
||||
import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { GESTURE_DOUBLE_CLICK } from "../gestures";
|
||||
import { GESTURE_DOUBLE_CLICK, type InputEvent } from "../gestures";
|
||||
import { drawSelectionHighlight } from "../menu";
|
||||
import { listRowHeight } from "../metrics";
|
||||
import { Layer, type DashboardInputEvent, type LayerActions, type LayerContext } from "../layers";
|
||||
import { Layer, type LayerActions, type LayerContext } from "../layers";
|
||||
import { wrapText, truncateText } from "../../graphics/textwrap";
|
||||
import { MIN_WINDOW_HEIGHT, minWindowTop } from "./geometry";
|
||||
|
||||
@@ -134,7 +134,7 @@ export class AssistantLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent, _ctx: LayerContext): void {
|
||||
handleInput(event: InputEvent, _ctx: LayerContext): void {
|
||||
if (this.phase === "thinking") {
|
||||
if (event.type === "double-click") {
|
||||
this.callbacks.onCancel();
|
||||
|
||||
@@ -2,7 +2,8 @@ import { GrayImage } from "../../graphics/image";
|
||||
import { type Plane } from "../../graphics/plane";
|
||||
import * as frameTimings from "../../native/frame-timings";
|
||||
import { beginRenderPass, endRenderPass } from "../../util/render-freshness";
|
||||
import { DashboardInputEvent, Layer, LayerActions, LayerContext, LayerStack, PaintBelow } from "../layers";
|
||||
import { InputEvent } from "../gestures";
|
||||
import { Layer, LayerActions, LayerContext, LayerStack, PaintBelow } from "../layers";
|
||||
import { type MenuItem } from "../menu";
|
||||
import { WindowMenuLayer } from "../window-menu";
|
||||
import { windowIcon } from "./chrome-layer";
|
||||
@@ -249,7 +250,7 @@ export class YieldAtRootLayer implements Layer {
|
||||
return this.inner.paint(ctx, paintBelow);
|
||||
}
|
||||
|
||||
async handleInput(event: DashboardInputEvent, ctx: LayerContext): Promise<void> {
|
||||
async handleInput(event: InputEvent, ctx: LayerContext): Promise<void> {
|
||||
if (event.type === "double-click") {
|
||||
shell.yieldFocusToSidebar();
|
||||
return;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { GrayImage } from "../../graphics/image";
|
||||
import { flattenPlanes } from "../../graphics/plane";
|
||||
import { DashboardInputEvent, Layer, LayerActions, LayerContext, LayerStack, PaintBelow } from "../layers";
|
||||
import { InputEvent } from "../gestures";
|
||||
import { Layer, LayerActions, LayerContext, LayerStack, PaintBelow } from "../layers";
|
||||
import { appViewportRect, appViewportSize, SHELL_OPAQUE_BLACK } from "./geometry";
|
||||
|
||||
// The modal covers most of the min-height app viewport, leaving a little of
|
||||
@@ -59,7 +60,7 @@ export class ShellModalLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
async handleInput(event: DashboardInputEvent, _ctx: LayerContext): Promise<void> {
|
||||
async handleInput(event: InputEvent, _ctx: LayerContext): Promise<void> {
|
||||
await this.stack.handleInput(event);
|
||||
}
|
||||
}
|
||||
+16
-14
@@ -4,16 +4,14 @@ import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { EvenAIStatus, EventSourceType, OsEventTypeList, WatchGestureType } from "../../g2/events";
|
||||
import type { RawInputEvent } from "../../native/faceclaw-communicator";
|
||||
import {
|
||||
DashboardInputEvent,
|
||||
directionalFallback,
|
||||
InputEvent,
|
||||
type InputEventPayload,
|
||||
type InputSource,
|
||||
isDirectionalInput,
|
||||
Layer,
|
||||
LayerActions,
|
||||
LayerContext,
|
||||
LayerStack,
|
||||
noopLayerActions,
|
||||
} from "../layers";
|
||||
makeInputEvent,
|
||||
} from "../gestures";
|
||||
import { Layer, LayerActions, LayerContext, LayerStack, noopLayerActions } from "../layers";
|
||||
import { MenuLayer, type MenuItem } from "../menu";
|
||||
import { VoiceInputLayer, type VoiceSendTarget } from "./voice-input";
|
||||
import { voiceActivity } from "./voice-activity";
|
||||
@@ -92,7 +90,7 @@ export type ShellWindow = {
|
||||
* tracking) passes to the window: it must eventually reach a frame submit
|
||||
* or a finishFrame call.
|
||||
*/
|
||||
handleInput: (event: DashboardInputEvent, frameId: number) => Promise<void> | void;
|
||||
handleInput: (event: InputEvent, frameId: number) => Promise<void> | void;
|
||||
/** Repaint and resubmit this window's surface. */
|
||||
requestRender: () => void;
|
||||
/**
|
||||
@@ -213,7 +211,7 @@ class ShellAlertLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent, _ctx: LayerContext): void {
|
||||
handleInput(event: InputEvent, _ctx: LayerContext): void {
|
||||
if (event.type === "click" || event.type === "double-click") {
|
||||
this.clearTimer();
|
||||
this.onDismiss();
|
||||
@@ -548,7 +546,7 @@ class Shell {
|
||||
return this.stack.paint();
|
||||
}
|
||||
|
||||
async receiveInput(event: DashboardInputEvent, frameId = 0): Promise<ShellInputOutcome> {
|
||||
async receiveInput(event: InputEvent, frameId = 0): Promise<ShellInputOutcome> {
|
||||
// The stock lifecycle has already interpreted the physical double tap as
|
||||
// "wake". Keep that directionality if delivery is delayed or duplicated.
|
||||
if (event.type === "display-wake") {
|
||||
@@ -698,7 +696,7 @@ class Shell {
|
||||
return this.screenOn && this.foregroundWindow()?.windowId === windowId;
|
||||
}
|
||||
|
||||
private handleSidebarInput(event: DashboardInputEvent): ShellInputOutcome {
|
||||
private handleSidebarInput(event: InputEvent): ShellInputOutcome {
|
||||
switch (event.type) {
|
||||
case "double-click":
|
||||
// A double-tap at the root (the app switcher selected) turns the
|
||||
@@ -1147,7 +1145,11 @@ function formatAssistantTime(date: Date): string {
|
||||
return `${day}, ${hours}:${minutes} ${meridiem}`;
|
||||
}
|
||||
|
||||
export function rawInputEventToInputEvent(event: RawInputEvent): DashboardInputEvent {
|
||||
export function rawInputEventToInputEvent(event: RawInputEvent): InputEvent {
|
||||
return makeInputEvent(rawInputEventToPayload(event));
|
||||
}
|
||||
|
||||
function rawInputEventToPayload(event: RawInputEvent): InputEventPayload {
|
||||
if (event.kind === "sys-event") {
|
||||
if (event.eventType === OsEventTypeList.CLICK_EVENT) {
|
||||
return {
|
||||
@@ -1210,7 +1212,7 @@ export function rawInputEventToInputEvent(event: RawInputEvent): DashboardInputE
|
||||
}
|
||||
|
||||
/** Scroll events only carry a source when it is the watch (the stock ones never needed one). */
|
||||
function scrollEvent(type: "scroll-up" | "scroll-down", eventSource: number): DashboardInputEvent {
|
||||
function scrollEvent(type: "scroll-up" | "scroll-down", eventSource: number): InputEventPayload {
|
||||
return eventSource === EventSourceType.TOUCH_EVENT_FROM_WATCH ? { type, source: "watch" } : { type };
|
||||
}
|
||||
|
||||
@@ -1227,7 +1229,7 @@ function eventSourceToString(eventSource: number): InputSource {
|
||||
return "ring";
|
||||
}
|
||||
|
||||
export function inputEventToString(event: DashboardInputEvent): string {
|
||||
export function inputEventToString(event: InputEvent): string {
|
||||
switch (event.type) {
|
||||
case "click":
|
||||
return `Click from ${event.source}`;
|
||||
|
||||
@@ -3,7 +3,8 @@ import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { wrapText } from "../../graphics/textwrap";
|
||||
import { clamp } from "../../util/numeric-util";
|
||||
import type { ToolDebugEntry } from "../../assistant/tool-registry";
|
||||
import { DashboardInputEvent, Layer, LayerContext, PaintBelow } from "../layers";
|
||||
import { InputEvent } from "../gestures";
|
||||
import { Layer, LayerContext, PaintBelow } from "../layers";
|
||||
import { MenuLayer, drawListScrollbar, type MenuItem } from "../menu";
|
||||
import { MIN_WINDOW_HEIGHT, minWindowTop, sidebarWidth, TOP_BAR_HEIGHT } from "./geometry";
|
||||
import { lineStep } from "../metrics";
|
||||
@@ -139,7 +140,7 @@ class ToolDetailLayer implements Layer {
|
||||
return lines;
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent, ctx: LayerContext): void {
|
||||
handleInput(event: InputEvent, ctx: LayerContext): void {
|
||||
switch (event.type) {
|
||||
case "scroll-up":
|
||||
this.scrollRow = Math.max(0, this.scrollRow - 1);
|
||||
|
||||
@@ -5,10 +5,10 @@ import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { voiceControlBridge, type VoiceTranscriptEvent } from "../../native/voice-control";
|
||||
import { refineDictation, type AnthropicStreamHandle } from "../../native/anthropic";
|
||||
import { anthropicApiKeySetting } from "../dashboard-settings";
|
||||
import { GESTURE_CLICK, GESTURE_DOUBLE_CLICK, gestureHints } from "../gestures";
|
||||
import { GESTURE_CLICK, GESTURE_DOUBLE_CLICK, gestureHints, type InputEvent } from "../gestures";
|
||||
import { drawSelectionHighlight } from "../menu";
|
||||
import { listRowHeight } from "../metrics";
|
||||
import { Layer, type DashboardInputEvent, type LayerActions, type LayerContext } from "../layers";
|
||||
import { Layer, type LayerActions, type LayerContext } from "../layers";
|
||||
import { MIN_WINDOW_HEIGHT, minWindowTop } from "./geometry";
|
||||
|
||||
const DIALOG_X = 40;
|
||||
@@ -273,7 +273,7 @@ export class VoiceInputLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent, _ctx: LayerContext): void {
|
||||
handleInput(event: InputEvent, _ctx: LayerContext): void {
|
||||
switch (this.phase) {
|
||||
case "capturing":
|
||||
if (event.type === "double-click") {
|
||||
@@ -300,7 +300,7 @@ export class VoiceInputLayer implements Layer {
|
||||
}
|
||||
}
|
||||
|
||||
private handleMenuInput(event: DashboardInputEvent): void {
|
||||
private handleMenuInput(event: InputEvent): void {
|
||||
const rowCount = this.menuRows().length;
|
||||
switch (event.type) {
|
||||
case "scroll-up":
|
||||
|
||||
Reference in new issue
Block a user