diff --git a/docs/steam.md b/docs/steam.md index 7a0d859..297a646 100644 --- a/docs/steam.md +++ b/docs/steam.md @@ -105,7 +105,7 @@ await window.next2dWindow.quit(); const off = window.next2dWindow.onResume(() => { /* 状態の再送など */ }); ``` -重ね表示が有効なときは、アプリは**1つだけ**起動します(2つ目の起動はすぐに終了します。macOSではDockにアイコンも出しません)。開発中に複数起動したいときは `--next2d-allow-multiple` を付けて起動します。 +重ね表示が有効なときは、アプリは**1つだけ**起動します(2つ目の起動はすぐに終了します)。macOSではDockにアイコンを出しません(エージェントアプリ。終了はゲーム内のボタンで行います)。開発中に複数起動したいときは `--next2d-allow-multiple` を付けて起動します。 スリープ(ノートPCのふたを閉じる等)から復帰すると、GPUがリセットされて描画が止まることがあるため、画面(renderer)を読み込み直します(ゲームは自動保存を前提にしてください)。電源・ディスプレイ・GPUのイベントは `userData/diagnostics.log`(Windowsは `%APPDATA%\\diagnostics.log`)に記録されます。 @@ -327,7 +327,7 @@ await window.next2dWindow.quit(); const off = window.next2dWindow.onResume(() => { /* resend state, etc. */ }); ``` -With the overlay enabled the app runs **once**: a second launch quits at once (and, on macOS, never shows a Dock icon). Start with `--next2d-allow-multiple` to run several copies while developing. +With the overlay enabled the app runs **once**: a second launch quits at once. On macOS it is an agent app with no Dock icon (quit from inside the game). Start with `--next2d-allow-multiple` to run several copies while developing. After sleep (e.g. closing a laptop lid) the GPU may be reset and drawing stops, so the page (renderer) is loaded again; the game should save automatically. Power, display and GPU events are logged to `userData/diagnostics.log` (Windows: `%APPDATA%\\diagnostics.log`). diff --git a/package-lock.json b/package-lock.json index 65ff957..ff1e948 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@next2d/builder", - "version": "0.4.6", + "version": "0.4.7", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@next2d/builder", - "version": "0.4.6", + "version": "0.4.7", "license": "MIT", "bin": { "builder": "dist/index.js" diff --git a/package.json b/package.json index 22cbced..193b236 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@next2d/builder", - "version": "0.4.6", + "version": "0.4.7", "description": "Multi-platform builder for Next2d Framework, supporting export to various platforms such as macOS, Windows, iOS, Android and Web(HTML)", "author": "Toshiyuki Ienaga ", "license": "MIT", diff --git a/src/electron-config.ts b/src/electron-config.ts index 595692a..5093c85 100644 --- a/src/electron-config.ts +++ b/src/electron-config.ts @@ -154,8 +154,7 @@ export const createElectronPackagerOptions = ( ...os === "macos" && (config.macos.localNetworkUsageDescription || config.window.overlay?.enabled) ? { "extendInfo": { ...config.macos.localNetworkUsageDescription ? { "NSLocalNetworkUsageDescription": config.macos.localNetworkUsageDescription } : {}, - // An overlay starts as an agent app (no Dock icon) so that a second launch, which quits at once, - // never shows one. The first instance shows its Dock icon itself (templates/electron/index.js). + // An overlay is an agent app: no Dock icon, also for a second launch that quits at once. ...config.window.overlay?.enabled ? { "LSUIElement": true } : {} }, ...config.macos.localNetworkUsageDescription ? { diff --git a/templates/electron/index.js b/templates/electron/index.js index 7a03389..f2c03ff 100644 --- a/templates/electron/index.js +++ b/templates/electron/index.js @@ -205,9 +205,8 @@ const createWindow = async () => { app.whenReady().then(async () => { if (!hasLock) return; - // The overlay app is packaged as an agent app (LSUIElement) so a second launch never shows a Dock icon; - // the instance that keeps running shows it. - if (process.platform === "darwin" && overlay) app.dock?.show(); + // The overlay app is packaged as an agent app (LSUIElement): it never shows a Dock icon (a desktop pet stays out + // of the Dock and the app switcher; the game offers its own "quit"). Menu.setApplicationMenu(process.platform === "darwin" ? Menu.buildFromTemplate([ { role: "appMenu" }, { role: "editMenu" }, { role: "windowMenu" } ]) : null); diff --git a/tests/electron-overlay.test.ts b/tests/electron-overlay.test.ts index 3f3c75a..ba08357 100644 --- a/tests/electron-overlay.test.ts +++ b/tests/electron-overlay.test.ts @@ -236,8 +236,8 @@ test("a desktop overlay runs once: a second launch quits before any window or Do const first = await startHost(t, { window: { overlay: { enabled: true, clickThrough: true } } }); assert.equal(first.windows.length, 1); assert.equal(first.calls.some(([name]) => name === "exit"), false); - // The running instance shows its Dock icon itself (the app is packaged as an agent app). - assert.equal(first.calls.some(([name]) => name === "dock.show"), process.platform === "darwin"); + // The overlay is an agent app: no instance shows a Dock icon. + assert.equal(first.calls.some(([name]) => name === "dock.show"), false); assert.equal(denied.calls.some(([name]) => name === "dock.show"), false); first.calls.length = 0; first.appListeners.get("second-instance")(); diff --git a/tests/electron.test.ts b/tests/electron.test.ts index 0aa2c75..f1d2368 100644 --- a/tests/electron.test.ts +++ b/tests/electron.test.ts @@ -62,7 +62,7 @@ test("macOS local network purpose is opt-in and applied to the app and helpers", assert.equal(createElectronPackagerOptions(root, config, "linux", root).extendHelperInfo, undefined); fs.writeFileSync(path.join(root, "electron.config.json"), "{}"); assert.equal(createElectronPackagerOptions(root, readElectronConfig(root), "macos", root).extendInfo, undefined); - // An overlay is packaged as an agent app (no Dock icon until the running instance shows it). + // An overlay is packaged as an agent app (never a Dock icon). fs.writeFileSync(path.join(root, "electron.config.json"), JSON.stringify({ window: { overlay: { enabled: true } } })); const overlay = createElectronPackagerOptions(root, readElectronConfig(root), "macos", root); assert.deepEqual(overlay.extendInfo, { LSUIElement: true });