Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

fix(hud): stop being born click-through, wait for the renderer to ask

Etienne Lescot6eb5bbb77184
diff --git a/electron/windows.ts b/electron/windows.ts
index 687a3a175..d6926f7a6 100644
--- a/electron/windows.ts
+++ b/electron/windows.ts
@@ -264,7 +264,22 @@ export function createHudOverlayWindow(): BrowserWindow {
backgroundThrottling: false,
},
});
- win.setIgnoreMouseEvents(true, { forward: true });
+
+ // Deliberately NOT born click-through: the renderer asks for it on mount, over
+ // "hud-overlay-ignore-mouse-events", within a frame or two of the first paint
+ // (`show: false` holds this window back until ready-to-show). What that leaves
+ // open is an invisible rectangle that swallows a desktop click for those two
+ // frames, right after the user launched the app — against what doing it here cost
+ // them: the whole app (issue #266). On Windows the `forward` option is a global
+ // WH_MOUSE_LL hook, and that hook is the only way out of the state, because
+ // Chromium sends no pointermove to a window it has made input-transparent — so
+ // the renderer can never ask to leave it on its own. Electron latches
+ // the install behind `forwarding_mouse_messages_` and retries only after a
+ // setIgnoreMouseEvents(false) — the very call a dead hook prevents. One refused
+ // or revoked hook (Windows drops any whose callback overruns the 300 ms
+ // LowLevelHooksTimeout — on this thread, still busy booting the app) and the HUD
+ // is painted, inert, forever. Asking later moves the install onto an IPC message,
+ // i.e. onto a main thread that is provably pumping.
// Keep the recording controls out of the recording (see applyContentProtection).
applyContentProtection(win, "HUD");