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
@@ -14,7 +14,6 @@ import { prepareFrameDraws } from "../../graphics/glyph-wire";
|
||||
import { getFont } from "../../graphics/bdffont";
|
||||
import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import * as frameTimings from "../../native/frame-timings";
|
||||
import type { DashboardInputEvent } from "../../ui/layers";
|
||||
import { buildSoundSequencePayload, type Step } from "../../ui/sound-effects";
|
||||
import { defaultWindowMenuItems, WindowMenu } from "../../ui/window-menu";
|
||||
import type { WorkerAppMessage, WorkerAppReply } from "../../ui/shell/worker-window";
|
||||
@@ -23,6 +22,7 @@ import {
|
||||
GESTURE_DOUBLE_CLICK,
|
||||
GESTURE_LONG_PRESS,
|
||||
GESTURE_SCROLL,
|
||||
type InputEvent,
|
||||
} from "../../ui/gestures";
|
||||
|
||||
declare const global: any;
|
||||
@@ -213,7 +213,7 @@ global.onmessage = (event: { data: WorkerAppMessage }) => {
|
||||
// Marks the main-thread -> worker hop, which is otherwise an
|
||||
// unexplained gap inside the shell's handle-input span.
|
||||
frameTimings.logFrame(message.frameId, `input received in ${message.windowId} worker`);
|
||||
handleInput(window, message.event as DashboardInputEvent, message.frameId);
|
||||
handleInput(window, message.event as InputEvent, message.frameId);
|
||||
break;
|
||||
}
|
||||
case "render": {
|
||||
@@ -302,7 +302,7 @@ function windowMenu(window: BlocksWindow): WindowMenu {
|
||||
return window.menu;
|
||||
}
|
||||
|
||||
function handleInput(window: BlocksWindow, event: DashboardInputEvent, frameId: number): void {
|
||||
function handleInput(window: BlocksWindow, event: InputEvent, frameId: number): void {
|
||||
// An open window menu owns all input (it closes itself via pop).
|
||||
if (window.menu?.isOpen()) {
|
||||
window.menu
|
||||
@@ -319,7 +319,7 @@ function handleInput(window: BlocksWindow, event: DashboardInputEvent, frameId:
|
||||
}
|
||||
}
|
||||
|
||||
function handlePlayingInput(window: BlocksWindow, event: DashboardInputEvent, frameId: number): void {
|
||||
function handlePlayingInput(window: BlocksWindow, event: InputEvent, frameId: number): void {
|
||||
switch (event.type) {
|
||||
case "scroll-up":
|
||||
tryMove(window, -1, 0);
|
||||
@@ -346,7 +346,7 @@ function handlePlayingInput(window: BlocksWindow, event: DashboardInputEvent, fr
|
||||
}
|
||||
|
||||
/** Input while paused or game over. */
|
||||
function handleIdleInput(window: BlocksWindow, event: DashboardInputEvent, frameId: number): void {
|
||||
function handleIdleInput(window: BlocksWindow, event: InputEvent, frameId: number): void {
|
||||
switch (event.type) {
|
||||
case "click":
|
||||
if (window.phase === "game-over") resetGame(window);
|
||||
|
||||
@@ -11,31 +11,16 @@ import { GrayImage, type UiFont } from "../../graphics/image";
|
||||
import { getDefaultLargeFont, getDefaultMediumFont, getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { wrapText, truncateText } from "../../graphics/textwrap";
|
||||
import { lineStep } from "../../ui/metrics";
|
||||
import { gestureHints, GESTURE_CLICK, GESTURE_DOUBLE_CLICK, GESTURE_SCROLL } from "../../ui/gestures";
|
||||
import { type DashboardInputEvent, type Layer, type LayerActions, type LayerContext } from "../../ui/layers";
|
||||
import { GESTURE_CLICK, GESTURE_DOUBLE_CLICK, GESTURE_SCROLL, gestureHints, type InputEvent } from "../../ui/gestures";
|
||||
import { type Layer, type LayerActions, type LayerContext } from "../../ui/layers";
|
||||
import { ConfigSettingBoolean, ConfigSettingEnum } from "../../ui/dashboard-settings";
|
||||
import { shell } from "../../ui/shell/shell";
|
||||
import { voiceControlBridge, type VoiceTranscriptEvent } from "../../native/voice-control";
|
||||
import { type MathBranchOutcome, MathCoordinator } from "./math/coordinator";
|
||||
import {
|
||||
type LongRunOffer,
|
||||
type LongRunProgress,
|
||||
offerGlassesPrompt,
|
||||
progressText,
|
||||
} from "./math/workload";
|
||||
import { type LongRunOffer, type LongRunProgress, offerGlassesPrompt, progressText } from "./math/workload";
|
||||
import { plain } from "./math/text-renderer";
|
||||
import { drawGraph } from "./calculator-graph";
|
||||
import {
|
||||
type CalculatorListening,
|
||||
type CalculatorMode,
|
||||
CALCULATOR_MODES,
|
||||
cycleMode,
|
||||
isDictationCancellation,
|
||||
isWorthAnswering,
|
||||
listeningLabel,
|
||||
modeCommand,
|
||||
modeLabel,
|
||||
} from "./calculator-commands";
|
||||
import { type CalculatorListening, type CalculatorMode, CALCULATOR_MODES, cycleMode, isDictationCancellation, isWorthAnswering, listeningLabel, modeCommand, modeLabel } from "./calculator-commands";
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Settings
|
||||
@@ -314,7 +299,7 @@ export class CalculatorLayer implements Layer {
|
||||
this.submit(text);
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent, _ctx: LayerContext): void {
|
||||
handleInput(event: InputEvent, _ctx: LayerContext): void {
|
||||
switch (event.type) {
|
||||
case "scroll-up":
|
||||
case "scroll-down": {
|
||||
|
||||
@@ -4,9 +4,9 @@ import { wrapText, truncateText } from "../../graphics/textwrap";
|
||||
import { clamp } from "../../util/numeric-util";
|
||||
import { readUpcomingEvents, type CalendarEvent } from "../../native/calendar";
|
||||
import { timeFormatSetting } from "../../ui/dashboard-settings";
|
||||
import { GESTURE_CLICK } from "../../ui/gestures";
|
||||
import { GESTURE_CLICK, type InputEvent } from "../../ui/gestures";
|
||||
import { hasCalendarPermission } from "../../g2/android-permissions";
|
||||
import { type DashboardInputEvent, type Layer, type LayerContext } from "../../ui/layers";
|
||||
import { type Layer, type LayerContext } from "../../ui/layers";
|
||||
import { lineStep } from "../../ui/metrics";
|
||||
|
||||
// Title position, shared with the other list apps (terminal, notifications).
|
||||
@@ -85,7 +85,7 @@ export class CalendarLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent): void {
|
||||
handleInput(event: InputEvent): void {
|
||||
if (!hasCalendarPermission()) {
|
||||
// Any tap on the prompt re-triggers the phone-side permission request.
|
||||
if (event.type === "click") this.requestPermission();
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
import { GrayImage } from "../../graphics/image";
|
||||
import { getDefaultMediumFont, getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { wrapText } from "../../graphics/textwrap";
|
||||
import { type DashboardInputEvent, type Layer, type LayerContext } from "../../ui/layers";
|
||||
import { type InputEvent } from "../../ui/gestures";
|
||||
import { type Layer, type LayerContext } from "../../ui/layers";
|
||||
import { lineStep } from "../../ui/metrics";
|
||||
import { screenCenterInViewportX } from "../../ui/shell/geometry";
|
||||
import {
|
||||
@@ -75,7 +76,7 @@ export class CompassCalibrationLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent, ctx: LayerContext): void {
|
||||
handleInput(event: InputEvent, ctx: LayerContext): void {
|
||||
if (event.type === "scroll-up") {
|
||||
this.adjust(1);
|
||||
} else if (event.type === "scroll-down") {
|
||||
|
||||
@@ -9,7 +9,8 @@ import {
|
||||
type CompassEvent,
|
||||
} from "../../native/compass";
|
||||
import { wrapText } from "../../graphics/textwrap";
|
||||
import { type DashboardInputEvent, type Layer, type LayerContext } from "../../ui/layers";
|
||||
import { type InputEvent } from "../../ui/gestures";
|
||||
import { type Layer, type LayerContext } from "../../ui/layers";
|
||||
import { lineStep } from "../../ui/metrics";
|
||||
import { screenCenterInViewportX } from "../../ui/shell/geometry";
|
||||
import {
|
||||
@@ -205,7 +206,7 @@ class CompassLayer implements Layer {
|
||||
// A tap opens calibration from either state: it is the affordance the
|
||||
// "Uncalibrated" prompt advertises, and re-calibrating is a normal thing to
|
||||
// want once the glasses have been taken off and put back on.
|
||||
handleInput(event: DashboardInputEvent, ctx: LayerContext): void {
|
||||
handleInput(event: InputEvent, ctx: LayerContext): void {
|
||||
if (event.type === "click") this.openCalibration(ctx);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@ import { getDefaultMediumFont, getDefaultSmallFont } from "../../graphics/ui-fon
|
||||
import { GrayImage } from "../../graphics/image";
|
||||
import { clamp } from "../../util/numeric-util";
|
||||
import { addImuListener, imuSourceLabel, setImuReportEnabled, type ImuReading } from "../../native/imu";
|
||||
import { GESTURE_DOUBLE_CLICK } from "../../ui/gestures";
|
||||
import { Layer, type DashboardInputEvent, type LayerContext } from "../../ui/layers";
|
||||
import { GESTURE_DOUBLE_CLICK, type InputEvent } from "../../ui/gestures";
|
||||
import { Layer, type LayerContext } from "../../ui/layers";
|
||||
import { shell } from "../../ui/shell/shell";
|
||||
|
||||
// IMU report pace. This is NOT a literal Hz — the firmware only accepts the
|
||||
@@ -119,7 +119,7 @@ export class AccelerometerDemoLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
async handleInput(event: DashboardInputEvent, ctx: LayerContext): Promise<void> {
|
||||
async handleInput(event: InputEvent, ctx: LayerContext): Promise<void> {
|
||||
if (event.type === "double-click") {
|
||||
ctx.stack.pop();
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { GrayImage } from "../../graphics/image";
|
||||
import { clamp } from "../../util/numeric-util";
|
||||
import { Layer, type DashboardInputEvent, type LayerActions, type LayerContext } from "../../ui/layers";
|
||||
import { GESTURE_CLICK, GESTURE_DOUBLE_CLICK, GESTURE_SCROLL } from "../../ui/gestures";
|
||||
import { Layer, type LayerActions, type LayerContext } from "../../ui/layers";
|
||||
import { GESTURE_CLICK, GESTURE_DOUBLE_CLICK, GESTURE_SCROLL, type InputEvent } from "../../ui/gestures";
|
||||
import { drawSelectionHighlight, scrollToKeepSelectionVisible } from "../../ui/menu";
|
||||
import { tightRowHeight } from "../../ui/metrics";
|
||||
import {
|
||||
@@ -61,7 +61,7 @@ export class BuzzerDemoLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
async handleInput(event: DashboardInputEvent, ctx: LayerContext): Promise<void> {
|
||||
async handleInput(event: InputEvent, ctx: LayerContext): Promise<void> {
|
||||
switch (event.type) {
|
||||
case "scroll-up":
|
||||
this.selectedIndex = Math.max(0, this.selectedIndex - 1);
|
||||
|
||||
@@ -3,8 +3,8 @@ import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { wrapText } from "../../graphics/textwrap";
|
||||
import { type AppContext } from "../app-definition";
|
||||
import { isLoadableAppUrl, openEvenHubUrl } from "../evenhub";
|
||||
import { GESTURE_CLICK, GESTURE_DOUBLE_CLICK } from "../../ui/gestures";
|
||||
import { Layer, type DashboardInputEvent, type LayerContext } from "../../ui/layers";
|
||||
import { GESTURE_CLICK, GESTURE_DOUBLE_CLICK, type InputEvent } from "../../ui/gestures";
|
||||
import { Layer, type LayerContext } from "../../ui/layers";
|
||||
import { lineStep } from "../../ui/metrics";
|
||||
import { developerAppUrlSetting } from "../../ui/dashboard-settings";
|
||||
import { isQrScannerAvailable, scanQrCode } from "../../native/qr-scan";
|
||||
@@ -76,7 +76,7 @@ export class LoadAppFromUrlLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent, ctx: LayerContext): void {
|
||||
handleInput(event: InputEvent, ctx: LayerContext): void {
|
||||
switch (event.type) {
|
||||
case "click":
|
||||
void this.launch(ctx);
|
||||
@@ -153,7 +153,7 @@ export class LoadAppFromQrLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent, ctx: LayerContext): void {
|
||||
handleInput(event: InputEvent, ctx: LayerContext): void {
|
||||
switch (event.type) {
|
||||
case "click":
|
||||
if (!this.busy && isQrScannerAvailable()) {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { GrayImage } from "../../graphics/image";
|
||||
import { clamp } from "../../util/numeric-util";
|
||||
import { GESTURE_DOUBLE_CLICK } from "../../ui/gestures";
|
||||
import { Layer, type DashboardInputEvent, type LayerContext } from "../../ui/layers";
|
||||
import { GESTURE_DOUBLE_CLICK, type InputEvent } from "../../ui/gestures";
|
||||
import { Layer, type LayerContext } from "../../ui/layers";
|
||||
import { shell } from "../../ui/shell/shell";
|
||||
|
||||
declare const com: any;
|
||||
@@ -110,7 +110,7 @@ export class ResourceUsageLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent, ctx: LayerContext): void {
|
||||
handleInput(event: InputEvent, ctx: LayerContext): void {
|
||||
if (event.type === "double-click") {
|
||||
ctx.stack.pop();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { GrayImage } from "../../graphics/image";
|
||||
import { Layer, type DashboardInputEvent, type LayerContext } from "../../ui/layers";
|
||||
import { type InputEvent } from "../../ui/gestures";
|
||||
import { Layer, type LayerContext } from "../../ui/layers";
|
||||
import { drawListScrollbar } from "../../ui/menu";
|
||||
|
||||
const COLOR_VALUE_COUNT = 256;
|
||||
@@ -49,7 +50,7 @@ export class ScreenTestLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { GrayImage } from "../../graphics/image";
|
||||
import { truncateText } from "../../graphics/textwrap";
|
||||
import { Layer, type DashboardInputEvent, type LayerContext, type PaintBelow } from "../../ui/layers";
|
||||
import { type InputEvent } from "../../ui/gestures";
|
||||
import { Layer, type LayerContext, type PaintBelow } from "../../ui/layers";
|
||||
import { drawSelectionHighlight } from "../../ui/menu";
|
||||
import { LIST_ROW_TEXT_INSET, lineStep, listRowHeight } from "../../ui/metrics";
|
||||
|
||||
@@ -79,7 +80,7 @@ export class EvenHubApiKeyDialogLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent, ctx: LayerContext): void {
|
||||
handleInput(event: InputEvent, ctx: LayerContext): void {
|
||||
switch (event.type) {
|
||||
case "scroll-up":
|
||||
case "scroll-down":
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
*/
|
||||
import { GrayImage } from "../../graphics/image";
|
||||
import { EVENHUB_SCREEN_WIDTH } from "./compositor";
|
||||
import { type DashboardInputEvent, type Layer, type LayerContext } from "../../ui/layers";
|
||||
import { type InputEvent } from "../../ui/gestures";
|
||||
import { type Layer, type LayerContext } from "../../ui/layers";
|
||||
import {
|
||||
createInProcessWindow,
|
||||
type InProcessAppOptions,
|
||||
@@ -33,7 +34,7 @@ class EvenHubAppLayer implements Layer {
|
||||
return this.session.paint(size, ctx.stack.isFocused());
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent): void {
|
||||
handleInput(event: InputEvent): void {
|
||||
// Everything goes to the app; long-press never reaches here (the window
|
||||
// menu intercepts it), which is the guaranteed way out since EvenHub
|
||||
// apps own double-click.
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { GrayImage } from "../../graphics/image";
|
||||
import { truncateText } from "../../graphics/textwrap";
|
||||
import { Layer, type DashboardInputEvent, type LayerContext, type PaintBelow } from "../../ui/layers";
|
||||
import { type InputEvent } from "../../ui/gestures";
|
||||
import { Layer, type LayerContext, type PaintBelow } from "../../ui/layers";
|
||||
import { drawSelectionHighlight } from "../../ui/menu";
|
||||
import { permissionDetail, permissionLabel, type EvenHubPermission } from "./permissions";
|
||||
import { openPrivacyPolicyOnPhone } from "./privacy-policy";
|
||||
@@ -89,7 +90,7 @@ export class EvenHubPermissionDialogLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent, ctx: LayerContext): void {
|
||||
handleInput(event: InputEvent, ctx: LayerContext): void {
|
||||
const actions = this.actions();
|
||||
switch (event.type) {
|
||||
case "scroll-up":
|
||||
|
||||
@@ -20,7 +20,8 @@
|
||||
import { ApplicationSettings } from "@nativescript/core";
|
||||
import { GrayImage } from "../../graphics/image";
|
||||
import { EvenHubFont } from "../../graphics/evenhub-font";
|
||||
import { type DashboardInputEvent, type InputSource, type Layer } from "../../ui/layers";
|
||||
import { type InputEvent, type InputSource } from "../../ui/gestures";
|
||||
import { type Layer } from "../../ui/layers";
|
||||
import {
|
||||
anthropicApiKeySetting,
|
||||
elevenLabsApiKeySetting,
|
||||
@@ -425,7 +426,7 @@ export class EvenHubSession implements EvenHubMicClient, EvenHubImuClient, EvenH
|
||||
* fields elided the way protobuf JSON elides them; list selection moves
|
||||
* locally with events only for clicks and boundary scrolls.
|
||||
*/
|
||||
handleGesture(event: DashboardInputEvent): void {
|
||||
handleGesture(event: InputEvent): void {
|
||||
if (!this.page) return;
|
||||
const capture = this.page ? eventCaptureContainer(this.page) : undefined;
|
||||
switch (event.type) {
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { GrayImage } from "../../graphics/image";
|
||||
import { truncateText, wrapText } from "../../graphics/textwrap";
|
||||
import { type DashboardInputEvent, type Layer, type LayerContext } from "../../ui/layers";
|
||||
import { type InputEvent } from "../../ui/gestures";
|
||||
import { type Layer, type LayerContext } from "../../ui/layers";
|
||||
import { drawSelectionHighlight } from "../../ui/menu";
|
||||
import { TextViewerLayer } from "../files/text-viewer";
|
||||
import { evenHubApi, type EvenHubStoreApp } from "./even-api";
|
||||
@@ -109,7 +110,7 @@ export class EvenHubStoreDetailLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
async handleInput(event: DashboardInputEvent, ctx: LayerContext): Promise<void> {
|
||||
async handleInput(event: InputEvent, ctx: LayerContext): Promise<void> {
|
||||
if (event.type === "double-click") {
|
||||
if (!this.working) ctx.stack.pop();
|
||||
return;
|
||||
|
||||
@@ -2,30 +2,12 @@ import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { GrayImage, type UiFont } from "../../graphics/image";
|
||||
import { truncateText, wrapText } from "../../graphics/textwrap";
|
||||
import { clamp } from "../../util/numeric-util";
|
||||
import { GESTURE_CLICK } from "../../ui/gestures";
|
||||
import { type DashboardInputEvent, type Layer, type LayerActions, type LayerContext } from "../../ui/layers";
|
||||
import {
|
||||
drawListScrollbar,
|
||||
drawSelectionHighlight,
|
||||
scrollToKeepSelectionVisible,
|
||||
type MenuItem,
|
||||
} from "../../ui/menu";
|
||||
import { GESTURE_CLICK, type InputEvent } from "../../ui/gestures";
|
||||
import { type Layer, type LayerActions, type LayerContext } from "../../ui/layers";
|
||||
import { drawListScrollbar, drawSelectionHighlight, scrollToKeepSelectionVisible, type MenuItem } from "../../ui/menu";
|
||||
import { shell } from "../../ui/shell/shell";
|
||||
import {
|
||||
evenHubApi,
|
||||
EvenHubAuthenticationError,
|
||||
isEvenHubStoreConfigured,
|
||||
type EvenHubStoreApp,
|
||||
} from "./even-api";
|
||||
import {
|
||||
clearEvenHubLoginForm,
|
||||
clearEvenHubSession,
|
||||
clearTransientEvenHubSession,
|
||||
evenHubLoginEmailSetting,
|
||||
evenHubLoginPasswordSetting,
|
||||
evenHubRememberMeSetting,
|
||||
resetEvenHubLoginForm,
|
||||
} from "./credentials";
|
||||
import { evenHubApi, EvenHubAuthenticationError, isEvenHubStoreConfigured, type EvenHubStoreApp } from "./even-api";
|
||||
import { clearEvenHubLoginForm, clearEvenHubSession, clearTransientEvenHubSession, evenHubLoginEmailSetting, evenHubLoginPasswordSetting, evenHubRememberMeSetting, resetEvenHubLoginForm } from "./credentials";
|
||||
import { EvenHubStoreDetailLayer } from "./store-detail-layer";
|
||||
import { lineStep } from "../../ui/metrics";
|
||||
|
||||
@@ -122,7 +104,7 @@ export class EvenHubStoreLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
async handleInput(event: DashboardInputEvent, ctx: LayerContext): Promise<void> {
|
||||
async handleInput(event: InputEvent, ctx: LayerContext): Promise<void> {
|
||||
if (this.showingLogin) {
|
||||
if (event.type === "click" && !this.loading) {
|
||||
this.openCredentialEditor(ctx);
|
||||
|
||||
@@ -15,7 +15,8 @@ import {
|
||||
statPath,
|
||||
type DirectoryEntry,
|
||||
} from "../../native/file-access";
|
||||
import { Layer, type DashboardInputEvent, type LayerContext } from "../../ui/layers";
|
||||
import { type InputEvent } from "../../ui/gestures";
|
||||
import { Layer, type LayerContext } from "../../ui/layers";
|
||||
|
||||
const LIST_X = 20;
|
||||
|
||||
@@ -231,7 +232,7 @@ export class FileBrowserLayer implements Layer {
|
||||
}
|
||||
}
|
||||
|
||||
async handleInput(event: DashboardInputEvent, ctx: LayerContext): Promise<void> {
|
||||
async handleInput(event: InputEvent, ctx: LayerContext): Promise<void> {
|
||||
if (filesViewModeSetting.get() === "list") {
|
||||
await this.handleListInput(event, ctx);
|
||||
} else {
|
||||
@@ -239,7 +240,7 @@ export class FileBrowserLayer implements Layer {
|
||||
}
|
||||
}
|
||||
|
||||
private async handleListInput(event: DashboardInputEvent, ctx: LayerContext): Promise<void> {
|
||||
private async handleListInput(event: InputEvent, ctx: LayerContext): Promise<void> {
|
||||
const rows = this.flatRows();
|
||||
switch (event.type) {
|
||||
case "scroll-up":
|
||||
@@ -261,7 +262,7 @@ export class FileBrowserLayer implements Layer {
|
||||
}
|
||||
}
|
||||
|
||||
private async handleIconsInput(event: DashboardInputEvent, ctx: LayerContext): Promise<void> {
|
||||
private async handleIconsInput(event: InputEvent, ctx: LayerContext): Promise<void> {
|
||||
const rows = this.flatRows();
|
||||
const iconRows = buildIconRows(rows);
|
||||
this.selectedRow = clamp(this.selectedRow, 0, Math.max(0, iconRows.length - 1));
|
||||
|
||||
@@ -2,8 +2,8 @@ import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { GrayImage } from "../../graphics/image";
|
||||
import { wrapText } from "../../graphics/textwrap";
|
||||
import type { DirectoryEntry } from "../../native/file-access";
|
||||
import { GESTURE_DOUBLE_CLICK } from "../../ui/gestures";
|
||||
import { Layer, type DashboardInputEvent, type LayerContext, type PaintBelow } from "../../ui/layers";
|
||||
import { GESTURE_DOUBLE_CLICK, type InputEvent } from "../../ui/gestures";
|
||||
import { Layer, type LayerContext, type PaintBelow } from "../../ui/layers";
|
||||
import { drawSelectionHighlight } from "../../ui/menu";
|
||||
import { LIST_ROW_TEXT_INSET, lineStep, listRowHeight } from "../../ui/metrics";
|
||||
|
||||
@@ -81,7 +81,7 @@ export class FileInfoDialogLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
async handleInput(event: DashboardInputEvent, ctx: LayerContext): Promise<void> {
|
||||
async handleInput(event: InputEvent, ctx: LayerContext): Promise<void> {
|
||||
switch (event.type) {
|
||||
case "scroll-up":
|
||||
if (this.actions.length) {
|
||||
|
||||
@@ -1,20 +1,9 @@
|
||||
import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { GrayImage } from "../../graphics/image";
|
||||
import { truncateText } from "../../graphics/textwrap";
|
||||
import {
|
||||
canLoadFontFile,
|
||||
fontFileDisplayName,
|
||||
fontFileMetrics,
|
||||
renderFontFileText,
|
||||
renderFontFileWrapped,
|
||||
} from "../../native/font-files";
|
||||
import {
|
||||
GESTURE_CLICK,
|
||||
GESTURE_DOUBLE_CLICK,
|
||||
GESTURE_SCROLL,
|
||||
gestureHints,
|
||||
} from "../../ui/gestures";
|
||||
import { Layer, type DashboardInputEvent, type LayerContext } from "../../ui/layers";
|
||||
import { canLoadFontFile, fontFileDisplayName, fontFileMetrics, renderFontFileText, renderFontFileWrapped } from "../../native/font-files";
|
||||
import { GESTURE_CLICK, GESTURE_DOUBLE_CLICK, GESTURE_SCROLL, gestureHints, type InputEvent } from "../../ui/gestures";
|
||||
import { Layer, type LayerContext } from "../../ui/layers";
|
||||
|
||||
const MARGIN_X = 18;
|
||||
const TITLE_Y = 8;
|
||||
@@ -126,7 +115,7 @@ export class FontPreviewerLayer implements Layer {
|
||||
return out;
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent, ctx: LayerContext): void {
|
||||
handleInput(event: InputEvent, ctx: LayerContext): void {
|
||||
switch (event.type) {
|
||||
case "scroll-up":
|
||||
this.setSizeIndex(this.sizeIndex + 1);
|
||||
|
||||
@@ -3,8 +3,8 @@ import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { truncateText } from "../../graphics/textwrap";
|
||||
import { GrayImage } from "../../graphics/image";
|
||||
import { loadImageFileAsGray } from "../../native/image-files";
|
||||
import { GESTURE_DOUBLE_CLICK } from "../../ui/gestures";
|
||||
import { Layer, type DashboardInputEvent, type LayerContext } from "../../ui/layers";
|
||||
import { GESTURE_DOUBLE_CLICK, type InputEvent } from "../../ui/gestures";
|
||||
import { Layer, type LayerContext } from "../../ui/layers";
|
||||
|
||||
const MARGIN_X = 18;
|
||||
const TITLE_Y = 8;
|
||||
@@ -50,7 +50,7 @@ export class ImageViewerLayer implements Layer {
|
||||
return out;
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent, ctx: LayerContext): void {
|
||||
handleInput(event: InputEvent, ctx: LayerContext): void {
|
||||
if (event.type === "double-click") {
|
||||
ctx.stack.pop();
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@ import { wrapText, truncateText } from "../../graphics/textwrap";
|
||||
import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { TtfFont } from "../../graphics/ttf-font";
|
||||
import { GrayImage, type UiFont } from "../../graphics/image";
|
||||
import { Layer, type DashboardInputEvent, type LayerContext } from "../../ui/layers";
|
||||
import { type InputEvent } from "../../ui/gestures";
|
||||
import { Layer, type LayerContext } from "../../ui/layers";
|
||||
|
||||
const MARGIN_X = 18;
|
||||
const TITLE_Y = 16;
|
||||
@@ -58,7 +59,7 @@ export class TextViewerLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent, ctx: LayerContext): void {
|
||||
handleInput(event: InputEvent, ctx: LayerContext): void {
|
||||
switch (event.type) {
|
||||
case "scroll-down":
|
||||
this.scrollBy(this.pageStep());
|
||||
|
||||
@@ -18,12 +18,11 @@ import { prepareFrameDraws } from "../../graphics/glyph-wire";
|
||||
import { getFont } from "../../graphics/bdffont";
|
||||
import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import * as frameTimings from "../../native/frame-timings";
|
||||
import type { DashboardInputEvent } from "../../ui/layers";
|
||||
import { buildSoundSequencePayload, type Step } from "../../ui/sound-effects";
|
||||
import { defaultWindowMenuItems, WindowMenu } from "../../ui/window-menu";
|
||||
import type { MenuItem } from "../../ui/menu";
|
||||
import type { WorkerAppMessage, WorkerAppReply } from "../../ui/shell/worker-window";
|
||||
import { GESTURE_CLICK, GESTURE_DOUBLE_CLICK, GESTURE_LONG_PRESS } from "../../ui/gestures";
|
||||
import { GESTURE_CLICK, GESTURE_DOUBLE_CLICK, GESTURE_LONG_PRESS, type InputEvent } from "../../ui/gestures";
|
||||
|
||||
declare const global: any;
|
||||
declare const com: any;
|
||||
@@ -168,7 +167,7 @@ global.onmessage = (event: { data: WorkerAppMessage }) => {
|
||||
// Marks the main-thread -> worker hop, which is otherwise an
|
||||
// unexplained gap inside the shell's handle-input span.
|
||||
frameTimings.logFrame(message.frameId, `input received in ${message.windowId} worker`);
|
||||
handleInput(window, message.event as DashboardInputEvent, message.frameId);
|
||||
handleInput(window, message.event as InputEvent, message.frameId);
|
||||
break;
|
||||
}
|
||||
case "render": {
|
||||
@@ -256,7 +255,7 @@ function windowMenu(window: FreecellWindow): WindowMenu {
|
||||
return window.menu;
|
||||
}
|
||||
|
||||
function handleInput(window: FreecellWindow, event: DashboardInputEvent, frameId: number): void {
|
||||
function handleInput(window: FreecellWindow, event: InputEvent, frameId: number): void {
|
||||
// An open window menu owns all input (it closes itself via pop).
|
||||
if (window.menu?.isOpen()) {
|
||||
window.menu
|
||||
@@ -273,7 +272,7 @@ function handleInput(window: FreecellWindow, event: DashboardInputEvent, frameId
|
||||
}
|
||||
}
|
||||
|
||||
function handlePlayingInput(window: FreecellWindow, event: DashboardInputEvent, frameId: number): void {
|
||||
function handlePlayingInput(window: FreecellWindow, event: InputEvent, frameId: number): void {
|
||||
switch (event.type) {
|
||||
case "scroll-up":
|
||||
window.cursor = (window.cursor + LOC_COUNT - 1) % LOC_COUNT;
|
||||
@@ -312,7 +311,7 @@ function handlePlayingInput(window: FreecellWindow, event: DashboardInputEvent,
|
||||
renderAndSubmit(window, frameId);
|
||||
}
|
||||
|
||||
function handleWonInput(window: FreecellWindow, event: DashboardInputEvent, frameId: number): void {
|
||||
function handleWonInput(window: FreecellWindow, event: InputEvent, frameId: number): void {
|
||||
switch (event.type) {
|
||||
case "click":
|
||||
newGame(window, false);
|
||||
|
||||
@@ -5,7 +5,8 @@ import { GrayImage } from "../../graphics/image";
|
||||
import { type Plane } from "../../graphics/plane";
|
||||
import { renderIcon, type IconName } from "../../graphics/icons";
|
||||
import { clamp } from "../../util/numeric-util";
|
||||
import { DashboardInputEvent, isWatchInput, Layer, LayerActions, LayerContext } from "../../ui/layers";
|
||||
import { InputEvent, isWatchInput } from "../../ui/gestures";
|
||||
import { Layer, LayerActions, LayerContext } from "../../ui/layers";
|
||||
import { drawSelectionHighlight, MenuLayer, scrollToKeepSelectionVisible, type MenuItem } from "../../ui/menu";
|
||||
import { iconGridMinRowHeight } from "../../ui/metrics";
|
||||
import { WINDOW_MENU_LAYOUT } from "../../ui/window-menu";
|
||||
@@ -313,7 +314,7 @@ class LauncherGridLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
async handleInput(event: DashboardInputEvent, ctx: LayerContext): Promise<void> {
|
||||
async handleInput(event: InputEvent, ctx: LayerContext): Promise<void> {
|
||||
if (isWatchInput(event)) {
|
||||
await this.handleWatchInput(event, ctx);
|
||||
return;
|
||||
@@ -378,7 +379,7 @@ class LauncherGridLayer implements Layer {
|
||||
* Row mode is restored on the way out so a ring user finds the grid as
|
||||
* they left it.
|
||||
*/
|
||||
private async handleWatchInput(event: DashboardInputEvent, ctx: LayerContext): Promise<void> {
|
||||
private async handleWatchInput(event: InputEvent, ctx: LayerContext): Promise<void> {
|
||||
const entries = this.entries();
|
||||
const rows = this.rowCount(entries.length);
|
||||
if (this.mode === "row") {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { GrayImage, type UiFont } from "../../graphics/image";
|
||||
import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { lineStep } from "../../ui/metrics";
|
||||
import { GESTURE_DOUBLE_CLICK, GESTURE_SCROLL } from "../../ui/gestures";
|
||||
import { Layer, type DashboardInputEvent, type LayerContext } from "../../ui/layers";
|
||||
import { GESTURE_DOUBLE_CLICK, GESTURE_SCROLL, type InputEvent } from "../../ui/gestures";
|
||||
import { Layer, type LayerContext } from "../../ui/layers";
|
||||
import { micSession, type CaptionLine, type MicSessionState } from "./mic-session";
|
||||
|
||||
/**
|
||||
@@ -97,7 +97,7 @@ export class CaptionsLayer implements Layer {
|
||||
return rows;
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent, ctx: LayerContext): void {
|
||||
handleInput(event: InputEvent, ctx: LayerContext): void {
|
||||
switch (event.type) {
|
||||
case "scroll-up":
|
||||
this.scrollback += 1;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { GrayImage } from "../../graphics/image";
|
||||
import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { GESTURE_DOUBLE_CLICK } from "../../ui/gestures";
|
||||
import { Layer, type DashboardInputEvent, type LayerContext } from "../../ui/layers";
|
||||
import { GESTURE_DOUBLE_CLICK, type InputEvent } from "../../ui/gestures";
|
||||
import { Layer, type LayerContext } from "../../ui/layers";
|
||||
import { micSession, type MicSessionState } from "./mic-session";
|
||||
|
||||
/**
|
||||
@@ -67,7 +67,7 @@ export class LevelsLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent, ctx: LayerContext): void {
|
||||
handleInput(event: InputEvent, ctx: LayerContext): void {
|
||||
if (event.type === "double-click") {
|
||||
ctx.stack.pop();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { GrayImage } from "../../graphics/image";
|
||||
import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { GESTURE_CLICK, GESTURE_DOUBLE_CLICK, GESTURE_SCROLL } from "../../ui/gestures";
|
||||
import { Layer, type DashboardInputEvent, type LayerContext } from "../../ui/layers";
|
||||
import { GESTURE_CLICK, GESTURE_DOUBLE_CLICK, GESTURE_SCROLL, type InputEvent } from "../../ui/gestures";
|
||||
import { Layer, type LayerContext } from "../../ui/layers";
|
||||
import { micSession, type MicSessionState } from "./mic-session";
|
||||
import { dotBrightness } from "./radar-dots";
|
||||
|
||||
@@ -175,7 +175,7 @@ export class RadarLayer implements Layer {
|
||||
return normalize(worldDeg - state.headingDeg);
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent, ctx: LayerContext): void {
|
||||
handleInput(event: InputEvent, ctx: LayerContext): void {
|
||||
switch (event.type) {
|
||||
case "scroll-up":
|
||||
micSession.setBeamWorldDeg(this.state.beamWorldDeg - 15);
|
||||
|
||||
@@ -18,7 +18,6 @@ import { prepareFrameDraws } from "../../graphics/glyph-wire";
|
||||
import { getFont } from "../../graphics/bdffont";
|
||||
import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import * as frameTimings from "../../native/frame-timings";
|
||||
import type { DashboardInputEvent } from "../../ui/layers";
|
||||
import { buildSoundSequencePayload, type Step } from "../../ui/sound-effects";
|
||||
import { defaultWindowMenuItems, WindowMenu } from "../../ui/window-menu";
|
||||
import type { WorkerAppMessage, WorkerAppReply } from "../../ui/shell/worker-window";
|
||||
@@ -27,6 +26,7 @@ import {
|
||||
GESTURE_DOUBLE_CLICK,
|
||||
GESTURE_LONG_PRESS,
|
||||
GESTURE_SCROLL,
|
||||
type InputEvent,
|
||||
} from "../../ui/gestures";
|
||||
import { clamp } from "../../util/numeric-util";
|
||||
|
||||
@@ -178,7 +178,7 @@ global.onmessage = (event: { data: WorkerAppMessage }) => {
|
||||
// Marks the main-thread -> worker hop, which is otherwise an
|
||||
// unexplained gap inside the shell's handle-input span.
|
||||
frameTimings.logFrame(message.frameId, `input received in ${message.windowId} worker`);
|
||||
handleInput(window, message.event as DashboardInputEvent, message.frameId);
|
||||
handleInput(window, message.event as InputEvent, message.frameId);
|
||||
break;
|
||||
}
|
||||
case "render": {
|
||||
@@ -282,7 +282,7 @@ function windowMenu(window: MinesweeperWindow): WindowMenu {
|
||||
return window.menu;
|
||||
}
|
||||
|
||||
function handleInput(window: MinesweeperWindow, event: DashboardInputEvent, frameId: number): void {
|
||||
function handleInput(window: MinesweeperWindow, event: InputEvent, frameId: number): void {
|
||||
// An open window menu owns all input (it closes itself via pop).
|
||||
if (window.menu?.isOpen()) {
|
||||
window.menu
|
||||
@@ -299,7 +299,7 @@ function handleInput(window: MinesweeperWindow, event: DashboardInputEvent, fram
|
||||
}
|
||||
}
|
||||
|
||||
function handlePlayingInput(window: MinesweeperWindow, event: DashboardInputEvent, frameId: number): void {
|
||||
function handlePlayingInput(window: MinesweeperWindow, event: InputEvent, frameId: number): void {
|
||||
const rowMode = window.selectMode === "row";
|
||||
switch (event.type) {
|
||||
case "scroll-up":
|
||||
@@ -347,7 +347,7 @@ function handlePlayingInput(window: MinesweeperWindow, event: DashboardInputEven
|
||||
}
|
||||
|
||||
/** Input while paused, won, or lost. */
|
||||
function handleIdleInput(window: MinesweeperWindow, event: DashboardInputEvent, frameId: number): void {
|
||||
function handleIdleInput(window: MinesweeperWindow, event: InputEvent, frameId: number): void {
|
||||
switch (event.type) {
|
||||
case "click":
|
||||
if (window.phase === "paused") {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { GrayImage, type UiFont } from "../../graphics/image";
|
||||
import { clamp } from "../../util/numeric-util";
|
||||
import { GESTURE_CLICK, GESTURE_DOUBLE_CLICK, GESTURE_SCROLL } from "../../ui/gestures";
|
||||
import { GESTURE_CLICK, GESTURE_DOUBLE_CLICK, GESTURE_SCROLL, type InputEvent } from "../../ui/gestures";
|
||||
import {
|
||||
MenuLayer,
|
||||
drawListScrollbar,
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
type MediaBrowseItem,
|
||||
type MediaBrowserApp,
|
||||
} from "../../native/media-browser";
|
||||
import { Layer, type DashboardInputEvent, type LayerContext } from "../../ui/layers";
|
||||
import { Layer, type LayerContext } from "../../ui/layers";
|
||||
|
||||
/** Header: title line + path line (34px at the 12px bitmap default). */
|
||||
function headerHeight(font: UiFont): number {
|
||||
@@ -152,7 +152,7 @@ export class MediaBrowseLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
async handleInput(event: DashboardInputEvent, ctx: LayerContext): Promise<void> {
|
||||
async handleInput(event: InputEvent, ctx: LayerContext): Promise<void> {
|
||||
if (this.phase === "failed") {
|
||||
if (event.type === "click") {
|
||||
this.phase = "idle";
|
||||
|
||||
@@ -2,35 +2,14 @@ import { getDefaultMediumFont, getDefaultSmallFont } from "../../graphics/ui-fon
|
||||
import { GrayImage } from "../../graphics/image";
|
||||
import { wrapText, truncateText } from "../../graphics/textwrap";
|
||||
import { clamp } from "../../util/numeric-util";
|
||||
import {
|
||||
GESTURE_CLICK,
|
||||
GESTURE_DOUBLE_CLICK,
|
||||
GESTURE_SCROLL_DOWN,
|
||||
GESTURE_SCROLL_UP,
|
||||
} from "../../ui/gestures";
|
||||
import { directionalFallback, GESTURE_CLICK, GESTURE_DOUBLE_CLICK, GESTURE_SCROLL_DOWN, GESTURE_SCROLL_UP, type InputEvent, isDirectionalInput } from "../../ui/gestures";
|
||||
import { MenuLayer, drawSelectionHighlight, drawSubmenuIndicator } from "../../ui/menu";
|
||||
import { lineStep, tightRowHeight } from "../../ui/metrics";
|
||||
import {
|
||||
mediaControllerBridge,
|
||||
type MediaControllerState,
|
||||
type MediaQueueItem,
|
||||
} from "../../native/media-controller";
|
||||
import { mediaControllerBridge, type MediaControllerState, type MediaQueueItem } from "../../native/media-controller";
|
||||
import { mediaBrowserBridge, type MediaBrowserApp } from "../../native/media-browser";
|
||||
import { MediaBrowseLayer } from "./media-browse";
|
||||
import {
|
||||
directionalFallback,
|
||||
isDirectionalInput,
|
||||
Layer,
|
||||
type DashboardInputEvent,
|
||||
type LayerContext,
|
||||
type PaintBelow,
|
||||
} from "../../ui/layers";
|
||||
import {
|
||||
createInProcessWindow,
|
||||
YieldAtRootLayer,
|
||||
type InProcessAppOptions,
|
||||
type InProcessWindow,
|
||||
} from "../../ui/shell/in-process-window";
|
||||
import { Layer, type LayerContext, type PaintBelow } from "../../ui/layers";
|
||||
import { createInProcessWindow, YieldAtRootLayer, type InProcessAppOptions, type InProcessWindow } from "../../ui/shell/in-process-window";
|
||||
|
||||
export const MUSIC_WINDOW_ID = "music";
|
||||
export const MUSIC_SURFACE_ID = "window:music";
|
||||
@@ -217,7 +196,7 @@ class MusicAppLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
async handleInput(event: DashboardInputEvent, ctx: LayerContext): Promise<void> {
|
||||
async handleInput(event: InputEvent, ctx: LayerContext): Promise<void> {
|
||||
if (event.type === "double-click" && this.focusColumn === "playlist") {
|
||||
this.focusColumn = "actions";
|
||||
this.selectedActionIndex = PLAYLIST_ACTION_INDEX;
|
||||
@@ -253,9 +232,9 @@ class MusicAppLayer implements Layer {
|
||||
if (media.canSkipPrevious) await mediaControllerBridge.skipPrevious();
|
||||
return;
|
||||
case "swipe-up":
|
||||
return this.handleInput({ type: "scroll-up" }, ctx);
|
||||
return this.handleInput({ type: "scroll-up", timestampMs: event.timestampMs }, ctx);
|
||||
case "swipe-down":
|
||||
return this.handleInput({ type: "scroll-down" }, ctx);
|
||||
return this.handleInput({ type: "scroll-down", timestampMs: event.timestampMs }, ctx);
|
||||
case "scroll-up":
|
||||
if (this.focusColumn === "playlist") {
|
||||
this.selectedQueueIndex = Math.max(0, this.selectedQueueIndex - 1);
|
||||
@@ -442,7 +421,7 @@ class VolumeModalLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent, ctx: LayerContext): void {
|
||||
handleInput(event: InputEvent, ctx: LayerContext): void {
|
||||
if (event.type === "scroll-up") {
|
||||
this.adjust(2);
|
||||
} else if (event.type === "scroll-down") {
|
||||
@@ -471,7 +450,7 @@ class MusicRootLayer implements Layer {
|
||||
return this.yieldAtRoot.paint(ctx, paintBelow);
|
||||
}
|
||||
|
||||
async handleInput(event: DashboardInputEvent, ctx: LayerContext): Promise<void> {
|
||||
async handleInput(event: InputEvent, ctx: LayerContext): Promise<void> {
|
||||
if (event.type === "double-click" && this.music.isPlaylistFocused()) {
|
||||
await this.music.handleInput(event, ctx);
|
||||
return;
|
||||
|
||||
@@ -13,11 +13,10 @@ import { prepareFrameDraws } from "../../graphics/glyph-wire";
|
||||
import { getFont } from "../../graphics/bdffont";
|
||||
import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import * as frameTimings from "../../native/frame-timings";
|
||||
import type { DashboardInputEvent } from "../../ui/layers";
|
||||
import { defaultWindowMenuItems, WindowMenu } from "../../ui/window-menu";
|
||||
import type { WorkerAppMessage, WorkerAppReply } from "../../ui/shell/worker-window";
|
||||
import type { ToolSpec, ToolResult } from "../../assistant/tool-registry";
|
||||
import { GESTURE_CLICK, GESTURE_DOUBLE_CLICK, GESTURE_SCROLL } from "../../ui/gestures";
|
||||
import { GESTURE_CLICK, GESTURE_DOUBLE_CLICK, GESTURE_SCROLL, type InputEvent } from "../../ui/gestures";
|
||||
import { LocationTracker, type TrackedLocation } from "../../native/location-tracker";
|
||||
import {
|
||||
fetchRoute,
|
||||
@@ -178,7 +177,7 @@ global.onmessage = (event: { data: WorkerAppMessage }) => {
|
||||
// Marks the main-thread -> worker hop, which is otherwise an
|
||||
// unexplained gap inside the shell's handle-input span.
|
||||
frameTimings.logFrame(message.frameId, `input received in ${message.windowId} worker`);
|
||||
handleInput(window, message.event as DashboardInputEvent, message.frameId);
|
||||
handleInput(window, message.event as InputEvent, message.frameId);
|
||||
break;
|
||||
case "text-input":
|
||||
// Voice input / typed text sets a destination directly.
|
||||
@@ -614,7 +613,7 @@ function windowMenu(win: NavWindow): WindowMenu {
|
||||
return win.menu;
|
||||
}
|
||||
|
||||
function handleInput(win: NavWindow, event: DashboardInputEvent, frameId: number): void {
|
||||
function handleInput(win: NavWindow, event: InputEvent, frameId: number): void {
|
||||
if (win.menu?.isOpen()) {
|
||||
win.menu
|
||||
.handleInput(event)
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { getDefaultLargeFont, getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { GrayImage, type UiFont } from "../../graphics/image";
|
||||
import { truncateText } from "../../graphics/textwrap";
|
||||
import { DashboardInputEvent, Layer, LayerContext } from "../../ui/layers";
|
||||
import { InputEvent } from "../../ui/gestures";
|
||||
import { Layer, LayerContext } from "../../ui/layers";
|
||||
import { nightscoutBridge, type NightscoutState } from "../../native/nightscout-bridge";
|
||||
import {
|
||||
isNightscoutSettingsConfigured,
|
||||
@@ -361,7 +362,7 @@ export class NightscoutLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
async handleInput(event: DashboardInputEvent, ctx: LayerContext): Promise<void> {
|
||||
async handleInput(event: InputEvent, ctx: LayerContext): Promise<void> {
|
||||
// The menu lives on the window's long-press menu (see nightscoutMenuItems);
|
||||
// double-click at the app root is handled by the yield wrapper.
|
||||
if (event.type === "double-click") {
|
||||
|
||||
@@ -25,7 +25,6 @@ import { getFont } from "../../graphics/bdffont";
|
||||
import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import * as frameTimings from "../../native/frame-timings";
|
||||
import { getStringSetting, setStringSetting } from "../../native/settings-store";
|
||||
import type { DashboardInputEvent } from "../../ui/layers";
|
||||
import { buildSoundSequencePayload, type Step } from "../../ui/sound-effects";
|
||||
import { defaultWindowMenuItems, WindowMenu } from "../../ui/window-menu";
|
||||
import type { WorkerAppMessage, WorkerAppReply } from "../../ui/shell/worker-window";
|
||||
@@ -34,6 +33,7 @@ import {
|
||||
GESTURE_DOUBLE_CLICK,
|
||||
GESTURE_LONG_PRESS,
|
||||
GESTURE_SCROLL,
|
||||
type InputEvent,
|
||||
} from "../../ui/gestures";
|
||||
import { clamp } from "../../util/numeric-util";
|
||||
|
||||
@@ -349,7 +349,7 @@ global.onmessage = (event: { data: WorkerAppMessage }) => {
|
||||
// Marks the main-thread -> worker hop, which is otherwise an
|
||||
// unexplained gap inside the shell's handle-input span.
|
||||
frameTimings.logFrame(message.frameId, `input received in ${message.windowId} worker`);
|
||||
handleInput(window, message.event as DashboardInputEvent, message.frameId);
|
||||
handleInput(window, message.event as InputEvent, message.frameId);
|
||||
break;
|
||||
}
|
||||
case "render": {
|
||||
@@ -467,7 +467,7 @@ function windowMenu(window: PinballWindow): WindowMenu {
|
||||
return window.menu;
|
||||
}
|
||||
|
||||
function handleInput(window: PinballWindow, event: DashboardInputEvent, frameId: number): void {
|
||||
function handleInput(window: PinballWindow, event: InputEvent, frameId: number): void {
|
||||
// An open window menu owns all input (it closes itself via pop).
|
||||
if (window.menu?.isOpen()) {
|
||||
window.menu
|
||||
@@ -484,7 +484,7 @@ function handleInput(window: PinballWindow, event: DashboardInputEvent, frameId:
|
||||
}
|
||||
}
|
||||
|
||||
function handlePlayingInput(window: PinballWindow, event: DashboardInputEvent, frameId: number): void {
|
||||
function handlePlayingInput(window: PinballWindow, event: InputEvent, frameId: number): void {
|
||||
const ready = window.ballState === "ready";
|
||||
switch (event.type) {
|
||||
case "scroll-up":
|
||||
@@ -530,7 +530,7 @@ function handlePlayingInput(window: PinballWindow, event: DashboardInputEvent, f
|
||||
}
|
||||
|
||||
/** Input while paused or game over. */
|
||||
function handleIdleInput(window: PinballWindow, event: DashboardInputEvent, frameId: number): void {
|
||||
function handleIdleInput(window: PinballWindow, event: InputEvent, frameId: number): void {
|
||||
switch (event.type) {
|
||||
case "click":
|
||||
if (window.phase === "game-over") resetGame(window);
|
||||
|
||||
@@ -12,12 +12,11 @@ import { prepareFrameDraws } from "../../graphics/glyph-wire";
|
||||
import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { truncateText, wrapText } from "../../graphics/textwrap";
|
||||
import * as frameTimings from "../../native/frame-timings";
|
||||
import type { DashboardInputEvent } from "../../ui/layers";
|
||||
import type { MenuItem } from "../../ui/menu";
|
||||
import { defaultWindowMenuItems, WindowMenu } from "../../ui/window-menu";
|
||||
import type { WorkerAppMessage, WorkerAppReply } from "../../ui/shell/worker-window";
|
||||
import type { ToolResult, ToolSpec } from "../../assistant/tool-registry";
|
||||
import { GESTURE_CLICK } from "../../ui/gestures";
|
||||
import { GESTURE_CLICK, type InputEvent } from "../../ui/gestures";
|
||||
import { DocumentView } from "../../ui/document/document-view";
|
||||
import { docNodePageLink, type DocNode } from "../../ui/document/document-model";
|
||||
import {
|
||||
@@ -173,7 +172,7 @@ global.onmessage = (event: { data: WorkerAppMessage }) => {
|
||||
// Marks the main-thread -> worker hop, which is otherwise an
|
||||
// unexplained gap inside the shell's handle-input span.
|
||||
frameTimings.logFrame(message.frameId, `input received in ${message.windowId} worker`);
|
||||
handleInput(window, message.event as DashboardInputEvent, message.frameId);
|
||||
handleInput(window, message.event as InputEvent, message.frameId);
|
||||
break;
|
||||
case "text-input":
|
||||
// Voice input / typed text becomes a new todo on the shown page.
|
||||
@@ -342,7 +341,7 @@ function menuItems(win: RoamWindow): MenuItem[] {
|
||||
return [...items, ...defaultWindowMenuItems(win.windowId, post)];
|
||||
}
|
||||
|
||||
function handleInput(win: RoamWindow, event: DashboardInputEvent, frameId: number): void {
|
||||
function handleInput(win: RoamWindow, event: InputEvent, frameId: number): void {
|
||||
if (win.menu?.isOpen()) {
|
||||
win.menu
|
||||
.handleInput(event)
|
||||
|
||||
@@ -38,38 +38,14 @@ import { getDefaultSmallFont, getTerminalFontConfig } from "../../graphics/ui-fo
|
||||
import { truncateText } from "../../graphics/textwrap";
|
||||
import { TERMINAL_ICON_GLYPHS } from "../../graphics/icons";
|
||||
import * as frameTimings from "../../native/frame-timings";
|
||||
import { GESTURE_DOUBLE_CLICK } from "../../ui/gestures";
|
||||
import {
|
||||
G2MirrorClient,
|
||||
type G2MirrorClientOptions,
|
||||
type G2MirrorSession,
|
||||
type G2MirrorState,
|
||||
} from "../../native/g2mirror-client";
|
||||
import { GESTURE_DOUBLE_CLICK, type InputEvent } from "../../ui/gestures";
|
||||
import { G2MirrorClient, type G2MirrorClientOptions, type G2MirrorSession, type G2MirrorState } from "../../native/g2mirror-client";
|
||||
import { onSettingsStoreChanged } from "../../native/settings-store";
|
||||
import { clamp } from "../../util/numeric-util";
|
||||
import {
|
||||
terminalAutoReconnectSetting,
|
||||
terminalLaunchPresetsSetting,
|
||||
terminalNewConnectionSetting,
|
||||
terminalWakeOnBellSetting,
|
||||
} from "../../ui/dashboard-settings";
|
||||
import {
|
||||
connectionDisplayName,
|
||||
loadConnections,
|
||||
parseConnectionString,
|
||||
saveConnections,
|
||||
TERMINAL_CONNECTIONS_KEY,
|
||||
updateConnection,
|
||||
type TerminalConnection,
|
||||
} from "./connections";
|
||||
import { terminalAutoReconnectSetting, terminalLaunchPresetsSetting, terminalNewConnectionSetting, terminalWakeOnBellSetting } from "../../ui/dashboard-settings";
|
||||
import { connectionDisplayName, loadConnections, parseConnectionString, saveConnections, TERMINAL_CONNECTIONS_KEY, updateConnection, type TerminalConnection } from "./connections";
|
||||
import { TerminalEmulator } from "./terminal-emulator";
|
||||
import type { DashboardInputEvent } from "../../ui/layers";
|
||||
import {
|
||||
drawListScrollbar,
|
||||
drawSelectionHighlight,
|
||||
scrollToKeepSelectionVisible,
|
||||
type MenuItem,
|
||||
} from "../../ui/menu";
|
||||
import { drawListScrollbar, drawSelectionHighlight, scrollToKeepSelectionVisible, type MenuItem } from "../../ui/menu";
|
||||
import { lineStep, listRowHeight } from "../../ui/metrics";
|
||||
import { defaultWindowMenuItems, WindowMenu } from "../../ui/window-menu";
|
||||
import { appViewportSize } from "../../ui/shell/geometry";
|
||||
@@ -324,7 +300,7 @@ global.onmessage = (event: { data: WorkerAppMessage }) => {
|
||||
// Marks the main-thread -> worker hop, which is otherwise an
|
||||
// unexplained gap inside the shell's handle-input span.
|
||||
frameTimings.logFrame(message.frameId, `input received in ${message.windowId} worker`);
|
||||
handleInput(window, message.event as DashboardInputEvent, message.frameId);
|
||||
handleInput(window, message.event as InputEvent, message.frameId);
|
||||
break;
|
||||
}
|
||||
case "text-input": {
|
||||
@@ -925,7 +901,7 @@ function windowMenuItems(window: TerminalWindow): MenuItem[] {
|
||||
return items;
|
||||
}
|
||||
|
||||
function handleInput(window: TerminalWindow, event: DashboardInputEvent, frameId: number): void {
|
||||
function handleInput(window: TerminalWindow, event: InputEvent, frameId: number): void {
|
||||
if (window.kind === "view") activeViewId = window.windowId;
|
||||
// An open window menu owns all input (it closes itself via pop).
|
||||
if (window.menu?.isOpen()) {
|
||||
@@ -1281,7 +1257,7 @@ function clampHubSelection(window: HubWindow, items: HubItem[]): void {
|
||||
window.selectedIndex = index;
|
||||
}
|
||||
|
||||
function handleHubInput(window: HubWindow, event: DashboardInputEvent, frameId: number): void {
|
||||
function handleHubInput(window: HubWindow, event: InputEvent, frameId: number): void {
|
||||
if (window.mode === "add") {
|
||||
if (event.type === "click") {
|
||||
saveAddConnection(window);
|
||||
|
||||
@@ -15,15 +15,10 @@ import {
|
||||
fireTimerNotification,
|
||||
scheduleTimerNotification,
|
||||
} from "../../native/timer-notifications";
|
||||
import type { DashboardInputEvent } from "../../ui/layers";
|
||||
import { defaultWindowMenuItems, WindowMenu } from "../../ui/window-menu";
|
||||
import type { WorkerAppMessage, WorkerAppReply } from "../../ui/shell/worker-window";
|
||||
import type { ToolResult, ToolSpec } from "../../assistant/tool-registry";
|
||||
import {
|
||||
GESTURE_CLICK,
|
||||
GESTURE_DOUBLE_CLICK,
|
||||
GESTURE_SCROLL,
|
||||
} from "../../ui/gestures";
|
||||
import { GESTURE_CLICK, GESTURE_DOUBLE_CLICK, GESTURE_SCROLL, type InputEvent } from "../../ui/gestures";
|
||||
import { clamp } from "../../util/numeric-util";
|
||||
|
||||
declare const global: any;
|
||||
@@ -165,7 +160,7 @@ global.onmessage = (event: { data: WorkerAppMessage }) => {
|
||||
// Marks the main-thread -> worker hop, which is otherwise an
|
||||
// unexplained gap inside the shell's handle-input span.
|
||||
frameTimings.logFrame(message.frameId, `input received in ${message.windowId} worker`);
|
||||
handleInput(window, message.event as DashboardInputEvent, message.frameId);
|
||||
handleInput(window, message.event as InputEvent, message.frameId);
|
||||
break;
|
||||
}
|
||||
case "render": {
|
||||
@@ -302,7 +297,7 @@ function windowMenu(window: TimerWindow): WindowMenu {
|
||||
return window.menu;
|
||||
}
|
||||
|
||||
function handleInput(window: TimerWindow, event: DashboardInputEvent, frameId: number): void {
|
||||
function handleInput(window: TimerWindow, event: InputEvent, frameId: number): void {
|
||||
// An open window menu owns all input (it closes itself via pop).
|
||||
if (window.menu?.isOpen()) {
|
||||
window.menu
|
||||
@@ -338,7 +333,7 @@ function handleInput(window: TimerWindow, event: DashboardInputEvent, frameId: n
|
||||
}
|
||||
}
|
||||
|
||||
function handleStopwatchInput(window: TimerWindow, event: DashboardInputEvent, frameId: number): void {
|
||||
function handleStopwatchInput(window: TimerWindow, event: InputEvent, frameId: number): void {
|
||||
if (event.type === "scroll-up" || event.type === "scroll-down") {
|
||||
const delta = event.type === "scroll-down" ? 1 : -1;
|
||||
window.stopwatchAction = clamp(window.stopwatchAction + delta, 0, 2);
|
||||
@@ -368,7 +363,7 @@ function handleStopwatchInput(window: TimerWindow, event: DashboardInputEvent, f
|
||||
renderAndSubmit(window, frameId);
|
||||
}
|
||||
|
||||
function handleTimersInput(window: TimerWindow, event: DashboardInputEvent, frameId: number): void {
|
||||
function handleTimersInput(window: TimerWindow, event: InputEvent, frameId: number): void {
|
||||
syncExpiredTimers();
|
||||
const itemCount = timers.length + 2; // Stopwatch navigation + New timer + timers.
|
||||
if (event.type === "scroll-up" || event.type === "scroll-down") {
|
||||
@@ -395,7 +390,7 @@ function handleTimersInput(window: TimerWindow, event: DashboardInputEvent, fram
|
||||
renderAndSubmit(window, frameId);
|
||||
}
|
||||
|
||||
function handleEditorInput(window: TimerWindow, event: DashboardInputEvent, frameId: number): void {
|
||||
function handleEditorInput(window: TimerWindow, event: InputEvent, frameId: number): void {
|
||||
if (event.type === "scroll-up" || event.type === "scroll-down") {
|
||||
const delta = event.type === "scroll-up" ? 1 : -1;
|
||||
if (window.editorField === 0) {
|
||||
|
||||
@@ -3,14 +3,14 @@ import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { lineStep } from "../../ui/metrics";
|
||||
import { writeTextToDownloads } from "../../native/file-access";
|
||||
import { voiceControlBridge, type VoiceTranscriptEvent } from "../../native/voice-control";
|
||||
import { Layer, type DashboardInputEvent, type LayerContext } from "../../ui/layers";
|
||||
import { Layer, type LayerContext } from "../../ui/layers";
|
||||
|
||||
/**
|
||||
* Live transcription view. Continuous mic capture is owned by the app wrapper
|
||||
* (createTranscribeAppWindow); this layer accumulates the transcript, shows
|
||||
* it, and saves it to Downloads on click.
|
||||
*/
|
||||
import { GESTURE_CLICK, GESTURE_DOUBLE_CLICK } from "../../ui/gestures";
|
||||
import { GESTURE_CLICK, GESTURE_DOUBLE_CLICK, type InputEvent } from "../../ui/gestures";
|
||||
export class TranscribeLayer implements Layer {
|
||||
private status = "Listening...";
|
||||
// Finalized utterances, plus the live (replace-semantics) partial appended
|
||||
@@ -56,7 +56,7 @@ export class TranscribeLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent, ctx: LayerContext): void {
|
||||
handleInput(event: InputEvent, ctx: LayerContext): void {
|
||||
if (event.type === "click") {
|
||||
this.saveTranscript();
|
||||
ctx.actions.requestRender();
|
||||
|
||||
@@ -3,8 +3,8 @@ import { GrayImage, type UiFont } from "../../graphics/image";
|
||||
import { wrapText, truncateText } from "../../graphics/textwrap";
|
||||
import { clamp } from "../../util/numeric-util";
|
||||
import { type ForecastPeriod, type WeatherState } from "../../native/weather";
|
||||
import { GESTURE_CLICK } from "../../ui/gestures";
|
||||
import { type DashboardInputEvent, type Layer, type LayerContext } from "../../ui/layers";
|
||||
import { GESTURE_CLICK, type InputEvent } from "../../ui/gestures";
|
||||
import { type Layer, type LayerContext } from "../../ui/layers";
|
||||
import { drawSelectionHighlight, scrollToKeepSelectionVisible } from "../../ui/menu";
|
||||
import { lineStep, tightRowHeight } from "../../ui/metrics";
|
||||
|
||||
@@ -70,7 +70,7 @@ export class WeatherLayer implements Layer {
|
||||
return image;
|
||||
}
|
||||
|
||||
handleInput(event: DashboardInputEvent): void {
|
||||
handleInput(event: InputEvent): void {
|
||||
const weather = this.state();
|
||||
if (event.type === "click") {
|
||||
// Refresh on the forecast view lives in the long-press menu; a tap
|
||||
|
||||
Reference in new issue
Block a user