From 412fe9a64aeeb5cf2040ab7e947dbdafd7117bdb Mon Sep 17 00:00:00 2001 From: EtienneLescot Date: Sat, 21 Nov 2026 21:56:59 +0100 Subject: [PATCH] fix(hud): open no camera preview window at launch while the camera is off v2.3.0 created the floating camera preview window, transparent and content-protected, the moment the HUD mounted, camera on or off. It is the only new window macOS gets at launch since v2.2.2, where the same HUD with the same content protection paints. Create it only once the camera is on; the macOS capture paths still reserve it before they read exclusion IDs. Refs #1639 --- electron/cameraPreview.test.ts | 8 +++----- electron/cameraPreview.ts | 5 +++++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/electron/cameraPreview.test.ts b/electron/cameraPreview.test.ts index 1c30bb5b0..f56262234 100644 --- a/electron/cameraPreview.test.ts +++ b/electron/cameraPreview.test.ts @@ -199,17 +199,15 @@ describe("floating camera preview lifecycle", () => { expect(overlay.webContents.send).not.toHaveBeenCalled(); }); - it("creates a hidden exclusion window even when the camera starts off", () => { + it("opens no window at launch while the camera is off (#1639)", () => { const { preview, sender, owner, overlay, create } = setup(); preview.configure(sender, false, true); - overlay.emit("ready-to-show"); - expect(create).toHaveBeenCalledOnce(); - expect(overlay.hide).toHaveBeenCalledOnce(); - expect(overlay.showInactive).not.toHaveBeenCalled(); + expect(create).not.toHaveBeenCalled(); preview.frame(sender, jpeg); expect(overlay.webContents.send).not.toHaveBeenCalled(); preview.configure(sender, true, true); expect(create).toHaveBeenCalledOnce(); + overlay.emit("ready-to-show"); expect(overlay.showInactive).toHaveBeenCalledOnce(); owner.emit("destroyed"); expect(overlay.destroy).toHaveBeenCalledOnce(); diff --git a/electron/cameraPreview.ts b/electron/cameraPreview.ts index 663fc4914..32b914b71 100644 --- a/electron/cameraPreview.ts +++ b/electron/cameraPreview.ts @@ -118,6 +118,11 @@ export class CameraPreviewController { } configure(owner: WebContents, enabled: boolean, visible: boolean): void { + // The HUD configures on mount, camera on or off. With the camera off, do not open a + // second content-protected transparent window beside the HUD at launch: v2.3.0 did, + // and on macOS 15 the HUD then never painted (#1639). The macOS capture paths still + // reserve the window before they read exclusion IDs (ensureMacCameraPreviewWindow). + if (!enabled && !this.window) return; const previewWindow = this.ensure(owner); if (!previewWindow) return; this.visible = enabled && visible;