← Blog

Capturing a window that is completely covered

Perch 1 min read

The mirror exists so you can keep working while a window is being shared. That only works if a window that is completely hidden behind another still produces frames.

On Windows it does. The Desktop Window Manager keeps an offscreen surface per window, and Windows.Graphics.Capture reads from that surface rather than from the screen. Bury Chrome behind a full-screen editor and the capture keeps running.

The part that is not obvious#

Capture keeping up is not the same as Chrome keeping up.

Chrome computes native window occlusion on Windows and stops rendering the foreground tab when its window is completely covered — precisely the failure the mirror exists to prevent. The capture stays healthy and delivers the same still frame forever, which looks exactly like a bug in the capture code.

Since Perch launches Chrome itself, it adds two switches:

--disable-backgrounding-occluded-windows
--disable-features=CalculateNativeWinOcclusion

macOS needs neither. I had previously removed an equivalent setting from the Mac build as a placebo, having measured that macOS Chrome does not throttle covered windows. On Windows it does, and the difference is not academic.

A platform limit worth stating plainly#

A minimised window has no DWM surface, so it cannot be captured at all. macOS has no such restriction. This is not a bug to be worked around, and the UI says so rather than showing a frozen frame and hoping.

Measured on a covered window: 102 frames, 60 of them distinct, scroll forwarding still driving the page from 900 to 1800. Minimised: zero frames, IsIconic true. Restored: 83 frames.