mirror of
https://github.com/stablyai/orca.git
synced 2026-11-16 19:07:41 +00:00
* fix(window): repaint a never-shown background window on Windows so CDP screenshots return Windows composites nothing for an idle window that was never shown, so Page.captureScreenshot under ORCA_BACKGROUND_LAUNCH=1 waited forever once the status-bar usage chip stopped animating (#33799). * fix(window): pump hidden-window frames from the renderer on Windows background launches Main-process webContents.invalidate() did not make a never-shown Windows window produce a frame CDP can capture (verified on Windows 11). A one-frame root background flip from the preload does, so main stamps a preload flag for ORCA_BACKGROUND_LAUNCH=1 on win32 and tells the preload to stop on first show. * fix(window): stop the hidden-frame pump only on main's show signal, including after reloads A never-shown Windows window can report visible after a desktop change, so the preload no longer stops on visibilitychange; main re-sends the stop after any reload once the window has been shown. * fix(window): register the frame-pump stop with on('show') so every window double supports it createMainWindow suites simulate win32 under the runner's ORCA_BACKGROUND_LAUNCH=1, so they install the pump stop; their window doubles implement on() but not once().
25 lines
965 B
TypeScript
25 lines
965 B
TypeScript
/**
|
|
* Windows produces no compositor frame for an idle never-shown window, and main-process
|
|
* webContents.invalidate() does not change that, so CDP Page.captureScreenshot under
|
|
* ORCA_BACKGROUND_LAUNCH=1 waits forever. A one-frame renderer style flip does produce a frame.
|
|
*/
|
|
const HIDDEN_WINDOW_FRAME_PUMP_ARGUMENT = '--orca-hidden-window-frame-pump'
|
|
|
|
export const HIDDEN_WINDOW_FRAME_PUMP_STOP_CHANNEL = 'window:hidden-frame-pump-stop'
|
|
export const HIDDEN_WINDOW_FRAME_PUMP_INTERVAL_MS = 750
|
|
|
|
export function shouldPumpHiddenWindowFrames(
|
|
env: Readonly<Record<string, string | undefined>>,
|
|
platform: NodeJS.Platform
|
|
): boolean {
|
|
return platform === 'win32' && env.ORCA_BACKGROUND_LAUNCH === '1'
|
|
}
|
|
|
|
export function formatHiddenWindowFramePumpArgument(): string {
|
|
return HIDDEN_WINDOW_FRAME_PUMP_ARGUMENT
|
|
}
|
|
|
|
export function hasHiddenWindowFramePumpArgument(argv: readonly string[]): boolean {
|
|
return argv.includes(HIDDEN_WINDOW_FRAME_PUMP_ARGUMENT)
|
|
}
|