Move and rename DashboardInputEvent->InputEvent

This commit is contained in:
James Babcock committed 2026-08-30 13:02:44 -07:00
1 parent 3e8be93833
commit 80d688dd4e
51 files changed
+299 -361

No files matched your search

+3 -3
View File
@@ -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";
+9 -30
View File
@@ -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;