mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-11-21 04:46:06 -08:00
fix(overlay): keep forwarding mpv keys after a Yomitan popup closes (#332)
Decide whether the Yomitan popup is open from the popup host in the DOM instead of the cached yomitanPopupVisible flag, which can lag a close and kept input.conf keys from reaching mpv. Keep the imported mpv key list in place while a refresh is in flight, so a key pressed right after the overlay regains focus is not dropped. A failed reload still clears the list. At --log-level debug, log why the overlay kept an mpv-bound key (config-loading, modal, lookup-popup, interactive-target or no-imported-bindings) over a validated IPC channel. Refs #331
This commit is contained in:
1 parent
0c1865f4a6
commit
0ae70b4ab2
14 files changed
+227
-23
No files matched your search
@@ -0,0 +1,6 @@
|
||||
type: fixed
|
||||
area: overlay
|
||||
|
||||
- mpv keys from `input.conf` (for example arrow keys bound to `sub-seek`) are no longer sent to a Yomitan popup that has already closed. The overlay decided whether the popup was open from a cached flag that could lag behind a close.
|
||||
- mpv keys no longer get dropped while the overlay reloads mpv's bindings after it regains focus.
|
||||
- With `--log-level debug`, the log names why the overlay kept an mpv-bound key instead of forwarding it.
|
||||
@@ -190,6 +190,10 @@ Another app or your desktop already uses `Alt+Shift+Y` (Yomitan settings). Free
|
||||
|
||||
Overlay shortcuts only work while the overlay has focus. Click the overlay, or press `Alt+Shift+O` with mpv or the overlay focused.
|
||||
|
||||
## An mpv key does nothing over the overlay
|
||||
|
||||
Keys from `input.conf` reach mpv through the overlay only in some cases (see [automatic mpv bindings](/shortcuts#automatic-mpv-bindings)). Run with `--log-level debug` and press the key: an `Overlay kept an mpv-bound key` line names the reason. To make a key work everywhere, add it to [`keybindings`](/configuration#keybindings) instead.
|
||||
|
||||
## Update checks
|
||||
|
||||
**"Update check failed"**: GitHub could not be reached. Check your connection and retry from the tray menu or with `subminer -u`.
|
||||
|
||||
@@ -40,10 +40,14 @@ import {
|
||||
parseSessionActionDispatchRequest,
|
||||
parseSubtitlePosition,
|
||||
parseSubsyncManualRunRequest,
|
||||
parseUnforwardedMpvKeyReport,
|
||||
parseYoutubePickerResolveRequest,
|
||||
} from '../../shared/ipc/validators';
|
||||
import { createLogger } from '../../logger';
|
||||
import { applyOverlayClickThrough } from './overlay-click-through';
|
||||
|
||||
const overlayInputLogger = createLogger('overlay:input');
|
||||
|
||||
const { ipcMain } = electron;
|
||||
|
||||
export interface IpcServiceDeps {
|
||||
@@ -640,6 +644,12 @@ export function registerIpcHandlers(deps: IpcServiceDeps, ipc: IpcMainRegistrar
|
||||
},
|
||||
);
|
||||
|
||||
// Shows, at --log-level debug, why an mpv input.conf key never reached mpv.
|
||||
ipc.on(IPC_CHANNELS.command.reportUnforwardedMpvKey, (_event: unknown, payload: unknown) => {
|
||||
const report = parseUnforwardedMpvKeyReport(payload);
|
||||
if (report) overlayInputLogger.debug('Overlay kept an mpv-bound key', report);
|
||||
});
|
||||
|
||||
ipc.on(IPC_CHANNELS.command.recordYomitanLookup, (_event: unknown, payload: unknown) => {
|
||||
try {
|
||||
deps.recordSubtitleMiningContext?.(parseSubtitleMiningContext(payload));
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
import { clipboard, contextBridge, ipcRenderer, IpcRendererEvent, webUtils } from 'electron';
|
||||
import { resolveOverlayLayerFromArgv } from './preload-args';
|
||||
import { createIpcListenerFactories } from './preload-ipc-listeners';
|
||||
import type { UnforwardedMpvKeyReport } from './types/session-bindings';
|
||||
import {
|
||||
DICTIONARY_EXTERNAL_LINK_CHANNEL,
|
||||
parseDictionaryExternalUrl,
|
||||
@@ -329,6 +330,10 @@ const electronAPI: ElectronAPI = {
|
||||
ipcRenderer.send(IPC_CHANNELS.command.recordYomitanLookup, context ?? null);
|
||||
},
|
||||
|
||||
reportUnforwardedMpvKey: (report: UnforwardedMpvKeyReport) => {
|
||||
ipcRenderer.send(IPC_CHANNELS.command.reportUnforwardedMpvKey, report);
|
||||
},
|
||||
|
||||
getSubtitlePosition: (): Promise<SubtitlePosition | null> =>
|
||||
ipcRenderer.invoke(IPC_CHANNELS.request.getSubtitlePosition),
|
||||
saveSubtitlePosition: (position: SubtitlePosition) => {
|
||||
|
||||
@@ -150,6 +150,7 @@ function installKeyboardTestGlobals() {
|
||||
let markActiveVideoWatchedCalls = 0;
|
||||
let statsToggleOverlayCalls = 0;
|
||||
const openedModalNotifications: string[] = [];
|
||||
const unforwardedMpvKeys: Array<{ key: string; reason: string }> = [];
|
||||
let selectionClearCount = 0;
|
||||
let selectionAddCount = 0;
|
||||
let mutationRecordsTaken = 0;
|
||||
@@ -252,6 +253,9 @@ function installKeyboardTestGlobals() {
|
||||
sendMpvCommand: (command: Array<string | number>) => {
|
||||
mpvCommands.push(command);
|
||||
},
|
||||
reportUnforwardedMpvKey: (report: { key: string; reason: string }) => {
|
||||
unforwardedMpvKeys.push(report);
|
||||
},
|
||||
dispatchSessionAction: async (actionId: string, payload?: unknown) => {
|
||||
sessionActions.push({ actionId, payload });
|
||||
},
|
||||
@@ -518,6 +522,7 @@ function installKeyboardTestGlobals() {
|
||||
markActiveVideoWatchedCalls: () => markActiveVideoWatchedCalls,
|
||||
statsToggleOverlayCalls: () => statsToggleOverlayCalls,
|
||||
openedModalNotifications,
|
||||
unforwardedMpvKeys,
|
||||
getPlaybackPaused: async () => playbackPausedResponse,
|
||||
setPlaybackPausedResponse: (value: boolean | null) => {
|
||||
playbackPausedResponse = value;
|
||||
@@ -2570,6 +2575,27 @@ test('discovered mpv keys only run after SubMiner controls and stay out of sessi
|
||||
}
|
||||
});
|
||||
|
||||
test('imported mpv keys forward once the popup closes, even if the cached popup flag lags', async () => {
|
||||
const { handlers, testGlobals, ctx } = createKeyboardHandlerHarness();
|
||||
try {
|
||||
testGlobals.setGetMpvInputBindings(async () => ({ keys: ['r'], blockedKeys: [] }));
|
||||
await handlers.setupMpvInputForwarding();
|
||||
await wait(0);
|
||||
testGlobals.setPopupVisible(true);
|
||||
testGlobals.dispatchKeydown({ key: 'r', code: 'KeyR' });
|
||||
assert.deepEqual(testGlobals.mpvCommands, []);
|
||||
assert.deepEqual(testGlobals.unforwardedMpvKeys, [{ key: 'r', reason: 'lookup-popup' }]);
|
||||
|
||||
// #331: the popup closed, but a late popup event left the cached flag set.
|
||||
testGlobals.setPopupVisible(false);
|
||||
ctx.state.yomitanPopupVisible = true;
|
||||
testGlobals.dispatchKeydown({ key: 'r', code: 'KeyR' });
|
||||
assert.deepEqual(testGlobals.mpvCommands, [['keydown', 'r']]);
|
||||
} finally {
|
||||
testGlobals.restore();
|
||||
}
|
||||
});
|
||||
|
||||
test('stalled mpv discovery does not delay configured overlay controls', async () => {
|
||||
const { handlers, testGlobals } = createKeyboardHandlerHarness();
|
||||
try {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { CompiledSessionBinding, PrimarySubMode, ShortcutsConfig } from '../../types';
|
||||
import type { MpvKeyForwardBlock } from '../../types/session-bindings';
|
||||
import type { RendererContext } from '../context';
|
||||
import { createMpvInputForwarding } from './mpv-input-forwarding';
|
||||
import { MPV_MOUSE_BUTTON_BY_BUTTON, wheelEventToMpvWheel } from '../../shared/mpv-input-bindings';
|
||||
@@ -141,14 +142,24 @@ export function createKeyboardHandlers(
|
||||
// Imported mpv bindings only run when no SubMiner UI could be the input's target.
|
||||
// The subtitle sidebar is a side panel over playback, so only input inside it (a
|
||||
// `.modal` target) stays with SubMiner.
|
||||
// Why imported mpv input must stay in the overlay right now, or null when it may forward.
|
||||
// SubMiner's own keybindings never pass through here.
|
||||
function getMpvForwardBlock(target: EventTarget | null): MpvKeyForwardBlock | null {
|
||||
if (!keyboardConfigLoaded) return 'config-loading';
|
||||
if (ctx.state.playlistBrowserModalOpen || ctx.state.youtubePickerModalOpen) return 'modal';
|
||||
if (isLookupPopupOpen(ctx.state, document)) return 'lookup-popup';
|
||||
if (isInteractiveTarget(target)) return 'interactive-target';
|
||||
return null;
|
||||
}
|
||||
|
||||
function canForwardToMpv(target: EventTarget | null): boolean {
|
||||
return (
|
||||
keyboardConfigLoaded &&
|
||||
!ctx.state.playlistBrowserModalOpen &&
|
||||
!ctx.state.youtubePickerModalOpen &&
|
||||
!isLookupPopupOpen(ctx.state, document) &&
|
||||
!isInteractiveTarget(target)
|
||||
);
|
||||
return getMpvForwardBlock(target) === null;
|
||||
}
|
||||
|
||||
// Debug breadcrumb for "my mpv key does nothing": the main process logs it at debug level.
|
||||
function reportUnforwardedMpvKey(e: KeyboardEvent, reason: MpvKeyForwardBlock): void {
|
||||
const report = importedMpvBindings.unforwardedReport(e, reason);
|
||||
if (report) window.electronAPI.reportUnforwardedMpvKey(report);
|
||||
}
|
||||
|
||||
// Scrolling over subtitles still reaches mpv; only scrollable overlay UI keeps the wheel.
|
||||
@@ -1403,6 +1414,7 @@ export function createKeyboardHandlers(
|
||||
|
||||
if (isLookupPopupOpen(ctx.state, document)) {
|
||||
if (handleYomitanPopupKeybind(e)) {
|
||||
reportUnforwardedMpvKey(e, 'lookup-popup');
|
||||
e.preventDefault();
|
||||
return;
|
||||
}
|
||||
@@ -1469,7 +1481,13 @@ export function createKeyboardHandlers(
|
||||
e.preventDefault();
|
||||
return;
|
||||
}
|
||||
if (canForwardToMpv(e.target)) importedMpvBindings.keydown(e);
|
||||
const forwardBlock = getMpvForwardBlock(e.target);
|
||||
if (forwardBlock) {
|
||||
reportUnforwardedMpvKey(e, forwardBlock);
|
||||
} else if (!importedMpvBindings.keydown(e)) {
|
||||
// Reports only while nothing is imported; an unbound key is not worth a line.
|
||||
reportUnforwardedMpvKey(e, 'no-imported-bindings');
|
||||
}
|
||||
});
|
||||
|
||||
document.addEventListener('mousedown', (e: MouseEvent) => {
|
||||
|
||||
@@ -175,3 +175,50 @@ test('focus loss releases held keys and failed refresh clears stale bindings', a
|
||||
await forwarding.refresh();
|
||||
assert.equal(forwarding.keydown(keyEvent()), false);
|
||||
});
|
||||
|
||||
test('a reload keeps forwarding the current keys until it settles', async () => {
|
||||
let resolveReload: (snapshot: MpvInputBindingsSnapshot) => void = () => {};
|
||||
let loads = 0;
|
||||
const forwarding = createMpvInputForwarding({
|
||||
load: () => {
|
||||
loads += 1;
|
||||
if (loads === 1) return Promise.resolve({ keys: ['r'], blockedKeys: [] });
|
||||
return new Promise((resolve) => {
|
||||
resolveReload = resolve;
|
||||
});
|
||||
},
|
||||
send: () => {},
|
||||
});
|
||||
await forwarding.refresh();
|
||||
const reload = forwarding.refresh();
|
||||
assert.equal(forwarding.keydown(keyEvent()), true);
|
||||
forwarding.keyup(keyEvent());
|
||||
resolveReload({ keys: ['t'], blockedKeys: [] });
|
||||
await reload;
|
||||
assert.equal(forwarding.keydown(keyEvent()), false);
|
||||
assert.equal(forwarding.keydown(keyEvent({ key: 't', code: 'KeyT' })), true);
|
||||
});
|
||||
|
||||
test('unforwarded reports name keys mpv binds, or any key while nothing is imported', async () => {
|
||||
let snapshot: MpvInputBindingsSnapshot = { keys: [], blockedKeys: [] };
|
||||
const forwarding = createMpvInputForwarding({ load: async () => snapshot, send: () => {} });
|
||||
await forwarding.refresh();
|
||||
assert.deepEqual(forwarding.unforwardedReport(keyEvent(), 'lookup-popup'), {
|
||||
key: 'r',
|
||||
reason: 'no-imported-bindings',
|
||||
});
|
||||
assert.equal(
|
||||
forwarding.unforwardedReport(keyEvent({ key: 'Shift', code: 'ShiftLeft' }), 'lookup-popup'),
|
||||
null,
|
||||
);
|
||||
|
||||
snapshot = { keys: ['r', 't'], blockedKeys: [{ code: 'KeyT', modifiers: [] }] };
|
||||
await forwarding.refresh();
|
||||
assert.deepEqual(forwarding.unforwardedReport(keyEvent(), 'interactive-target'), {
|
||||
key: 'r',
|
||||
reason: 'interactive-target',
|
||||
});
|
||||
assert.equal(forwarding.unforwardedReport(keyEvent(), 'no-imported-bindings'), null);
|
||||
assert.equal(forwarding.unforwardedReport(keyEvent({ key: 't', code: 'KeyT' }), 'modal'), null);
|
||||
assert.equal(forwarding.unforwardedReport(keyEvent({ key: 'z', code: 'KeyZ' }), 'modal'), null);
|
||||
});
|
||||
@@ -4,7 +4,13 @@ import {
|
||||
normalizeMpvInputKey,
|
||||
wheelEventToMpvWheel,
|
||||
} from '../../shared/mpv-input-bindings';
|
||||
import type { MpvInputBindingsSnapshot } from '../../types/session-bindings';
|
||||
import type {
|
||||
MpvInputBindingsSnapshot,
|
||||
MpvKeyForwardBlock,
|
||||
UnforwardedMpvKeyReport,
|
||||
} from '../../types/session-bindings';
|
||||
|
||||
const MODIFIER_ONLY_KEYS = new Set(['Shift', 'Control', 'Alt', 'Meta', 'AltGraph']);
|
||||
|
||||
type ModifierState = Pick<KeyboardEvent, 'ctrlKey' | 'altKey' | 'shiftKey' | 'metaKey'>;
|
||||
type ForwardedKeyEvent = Parameters<typeof keyboardEventToMpvKey>[0] &
|
||||
@@ -31,25 +37,26 @@ export function createMpvInputForwarding(deps: {
|
||||
heldKeys.clear();
|
||||
}
|
||||
|
||||
// Every window focus refreshes, so the current list keeps forwarding until the reload
|
||||
// settles; a key pressed mid-reload would otherwise be dropped.
|
||||
function refresh(): Promise<void> {
|
||||
if (disposed) return Promise.resolve();
|
||||
generation += 1;
|
||||
keys.clear();
|
||||
blockedKeys = [];
|
||||
releaseAll();
|
||||
if (pending) return pending;
|
||||
pending = (async () => {
|
||||
let requestedGeneration: number;
|
||||
do {
|
||||
requestedGeneration = generation;
|
||||
let snapshot: MpvInputBindingsSnapshot | null = null;
|
||||
try {
|
||||
const snapshot = await deps.load();
|
||||
if (!disposed && requestedGeneration === generation) {
|
||||
keys = new Set(snapshot.keys);
|
||||
blockedKeys = snapshot.blockedKeys;
|
||||
}
|
||||
snapshot = await deps.load();
|
||||
} catch {
|
||||
// Discovery is optional. Keep the existing overlay controls available.
|
||||
// Discovery is optional: SubMiner's own bindings keep working without it.
|
||||
}
|
||||
if (!disposed && requestedGeneration === generation) {
|
||||
keys = new Set(snapshot?.keys ?? []);
|
||||
blockedKeys = snapshot?.blockedKeys ?? [];
|
||||
}
|
||||
} while (!disposed && requestedGeneration !== generation);
|
||||
})().finally(() => {
|
||||
@@ -98,6 +105,23 @@ export function createMpvInputForwarding(deps: {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* The debug report for a key the overlay kept from mpv, or null when mpv does not bind
|
||||
* it. With nothing imported yet, every nameable key is reported as such.
|
||||
*/
|
||||
function unforwardedReport(
|
||||
event: ForwardedKeyEvent,
|
||||
reason: MpvKeyForwardBlock,
|
||||
): UnforwardedMpvKeyReport | null {
|
||||
if (disposed || event.repeat || MODIFIER_ONLY_KEYS.has(event.key)) return null;
|
||||
const key = keyboardEventToMpvKey(event);
|
||||
if (!key) return null;
|
||||
if (keys.size === 0) return { key, reason: 'no-imported-bindings' };
|
||||
if (reason === 'no-imported-bindings') return null;
|
||||
if (isBlocked(event.code, event) || !keys.has(key)) return null;
|
||||
return { key, reason };
|
||||
}
|
||||
|
||||
function keyup(event: Pick<KeyboardEvent, 'code' | 'preventDefault'>): void {
|
||||
const key = heldKeys.get(event.code);
|
||||
if (!key) return;
|
||||
@@ -154,5 +178,15 @@ export function createMpvInputForwarding(deps: {
|
||||
releaseAll();
|
||||
}
|
||||
|
||||
return { refresh, keydown, keyup, wheel, mousedown, mouseup, releaseAll, dispose };
|
||||
return {
|
||||
refresh,
|
||||
keydown,
|
||||
keyup,
|
||||
wheel,
|
||||
mousedown,
|
||||
mouseup,
|
||||
releaseAll,
|
||||
dispose,
|
||||
unforwardedReport,
|
||||
};
|
||||
}
|
||||
@@ -125,11 +125,13 @@ export function isHachidoriPopupOpen(root: ParentNode | null | undefined = docum
|
||||
* (the shown event and the host's visible marker) also covers a plain press.
|
||||
*/
|
||||
export function isLookupPopupOpen(
|
||||
state: { yomitanPopupVisible: boolean; hachidoriReaderSeen: boolean },
|
||||
state: { hachidoriReaderSeen: boolean },
|
||||
root: ParentNode | null | undefined = document,
|
||||
): boolean {
|
||||
if (state.hachidoriReaderSeen) return isHachidoriPopupOpen(root);
|
||||
return state.yomitanPopupVisible || isYomitanPopupVisible(root);
|
||||
// The fork marks the host before it fires the shown event, so the DOM is authoritative.
|
||||
// The cached yomitanPopupVisible flag can lag a close (#331) and would keep stealing keys.
|
||||
return isYomitanPopupVisible(root);
|
||||
}
|
||||
|
||||
export function isYomitanPopupVisible(root: ParentNode | null | undefined = document): boolean {
|
||||
|
||||
@@ -27,6 +27,7 @@ export const IPC_CHANNELS = {
|
||||
setIgnoreMouseEvents: 'set-ignore-mouse-events',
|
||||
overlayModalClosed: 'overlay:modal-closed',
|
||||
recordYomitanLookup: 'record-yomitan-lookup',
|
||||
reportUnforwardedMpvKey: 'overlay:unforwarded-mpv-key',
|
||||
youtubePickerResolve: 'youtube:picker-resolve',
|
||||
toggleDevTools: 'toggle-dev-tools',
|
||||
saveSubtitlePosition: 'save-subtitle-position',
|
||||
|
||||
@@ -4,7 +4,7 @@ import test from 'node:test';
|
||||
import { DEFAULT_CONFIG, DEFAULT_KEYBINDINGS } from '../../config/definitions';
|
||||
import { compileSessionBindings } from '../../core/services/session-bindings';
|
||||
import { resolveConfiguredShortcuts } from '../../core/utils/shortcut-config';
|
||||
import { parseSessionActionDispatchRequest } from './validators';
|
||||
import { parseSessionActionDispatchRequest, parseUnforwardedMpvKeyReport } from './validators';
|
||||
|
||||
// Regression guard: SESSION_ACTION_IDS in validators.ts is a hand-maintained mirror of the
|
||||
// SessionActionId union. If a new shortcut-backed action is added to the union/defaults but not to
|
||||
@@ -36,3 +36,13 @@ test('every default session-action binding is accepted by parseSessionActionDisp
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
test('unforwarded mpv key reports accept known reasons only', () => {
|
||||
assert.deepEqual(parseUnforwardedMpvKeyReport({ key: 'LEFT', reason: 'lookup-popup' }), {
|
||||
key: 'LEFT',
|
||||
reason: 'lookup-popup',
|
||||
});
|
||||
assert.equal(parseUnforwardedMpvKeyReport({ key: 'LEFT', reason: 'toString' }), null);
|
||||
assert.equal(parseUnforwardedMpvKeyReport({ key: '', reason: 'modal' }), null);
|
||||
assert.equal(parseUnforwardedMpvKeyReport(null), null);
|
||||
});
|
||||
@@ -14,7 +14,12 @@ import type {
|
||||
SubsyncManualRunRequest,
|
||||
} from '../../types/runtime';
|
||||
import type { RuntimeOptionId, RuntimeOptionValue } from '../../types/runtime-options';
|
||||
import type { SessionActionId, SessionActionPayload } from '../../types/session-bindings';
|
||||
import type {
|
||||
MpvKeyForwardBlock,
|
||||
SessionActionId,
|
||||
SessionActionPayload,
|
||||
UnforwardedMpvKeyReport,
|
||||
} from '../../types/session-bindings';
|
||||
import type { SubtitlePosition } from '../../types/subtitle';
|
||||
import { OVERLAY_HOSTED_MODALS, type OverlayHostedModal } from './contracts';
|
||||
import { isControllerFaceButtonLabels, parseControllerDiscreteBinding } from '../controller-review';
|
||||
@@ -365,6 +370,26 @@ export function parseMpvCommand(value: unknown): Array<string | number> | null {
|
||||
: null;
|
||||
}
|
||||
|
||||
// A Record so a new MpvKeyForwardBlock member fails typecheck until it is listed here.
|
||||
const MPV_KEY_FORWARD_BLOCKS: Record<MpvKeyForwardBlock, true> = {
|
||||
'config-loading': true,
|
||||
modal: true,
|
||||
'lookup-popup': true,
|
||||
'interactive-target': true,
|
||||
'no-imported-bindings': true,
|
||||
};
|
||||
|
||||
function isMpvKeyForwardBlock(value: unknown): value is MpvKeyForwardBlock {
|
||||
return typeof value === 'string' && Object.hasOwn(MPV_KEY_FORWARD_BLOCKS, value);
|
||||
}
|
||||
|
||||
export function parseUnforwardedMpvKeyReport(value: unknown): UnforwardedMpvKeyReport | null {
|
||||
if (!isObject(value)) return null;
|
||||
const { key, reason } = value;
|
||||
if (typeof key !== 'string' || key.length === 0 || key.length > 64) return null;
|
||||
return isMpvKeyForwardBlock(reason) ? { key, reason } : null;
|
||||
}
|
||||
|
||||
export function parseOptionalForwardingOptions(value: unknown): {
|
||||
forward?: boolean;
|
||||
} {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { MpvInputBindingsSnapshot } from './session-bindings';
|
||||
import type { MpvInputBindingsSnapshot, UnforwardedMpvKeyReport } from './session-bindings';
|
||||
import type {
|
||||
KikuFieldGroupingChoice,
|
||||
KikuFieldGroupingRequestData,
|
||||
@@ -600,6 +600,8 @@ export interface ElectronAPI {
|
||||
setIgnoreMouseEvents: (ignore: boolean, options?: { forward?: boolean }) => void;
|
||||
reportOverlayInteractive: (interactive: boolean) => void;
|
||||
recordYomitanLookup: (context?: SubtitleMiningContext | null) => void;
|
||||
/** Debug-only: the overlay kept a key that mpv binds. */
|
||||
reportUnforwardedMpvKey: (report: UnforwardedMpvKeyReport) => void;
|
||||
getSubtitlePosition: () => Promise<SubtitlePosition | null>;
|
||||
saveSubtitlePosition: (position: SubtitlePosition) => void;
|
||||
sendMpvCommand: (command: (string | number)[]) => void;
|
||||
|
||||
@@ -13,6 +13,20 @@ export interface MpvInputBindingsSnapshot {
|
||||
blockedKeys: SessionKeySpec[];
|
||||
}
|
||||
|
||||
/** Why the overlay kept a key that mpv binds instead of forwarding it. */
|
||||
export type MpvKeyForwardBlock =
|
||||
| 'config-loading'
|
||||
| 'modal'
|
||||
| 'lookup-popup'
|
||||
| 'interactive-target'
|
||||
| 'no-imported-bindings';
|
||||
|
||||
/** Debug report the overlay sends when it does not forward an mpv-bound key. */
|
||||
export interface UnforwardedMpvKeyReport {
|
||||
key: string;
|
||||
reason: MpvKeyForwardBlock;
|
||||
}
|
||||
|
||||
export interface SessionBindingWarning {
|
||||
kind: 'unsupported' | 'conflict' | 'deprecated-config';
|
||||
path: string;
|
||||
|
||||
Reference in new issue
Block a user