Fix nested Yomitan popup focus loss

This commit is contained in:
2026-04-07 21:45:12 -07:00
parent 9b4de93283
commit de9b887798
10 changed files with 397 additions and 25 deletions

View File

@@ -37,13 +37,21 @@ export function updateVisibleOverlayVisibility(args: {
const showPassiveVisibleOverlay = (): void => {
const forceMousePassthrough = args.forceMousePassthrough === true;
if (args.isMacOSPlatform || args.isWindowsPlatform || forceMousePassthrough) {
mainWindow.setIgnoreMouseEvents(true, { forward: true });
} else {
mainWindow.setIgnoreMouseEvents(false);
const shouldDefaultToPassthrough =
args.isMacOSPlatform || args.isWindowsPlatform || forceMousePassthrough;
const wasVisible = mainWindow.isVisible();
if (!wasVisible || forceMousePassthrough) {
if (shouldDefaultToPassthrough) {
mainWindow.setIgnoreMouseEvents(true, { forward: true });
} else {
mainWindow.setIgnoreMouseEvents(false);
}
}
args.ensureOverlayWindowLevel(mainWindow);
mainWindow.show();
if (!wasVisible) {
mainWindow.show();
}
if (!args.isWindowsPlatform && !args.isMacOSPlatform && !forceMousePassthrough) {
mainWindow.focus();
}