Documentation
¶
Overview ¶
Command stalepaintprobe checks #864: a change made just after a window's content is built, before or around its first paint, must reach the screen.
It builds a window with a red rectangle and a short label, and from a goroutine started at build turns the rectangle green and lengthens the label. 2.5 s later it reads back the last frame the window presented, armed before the first paint so nothing forces a repaint, and prints
CHANGE at=... rect-canvas=... label-canvas=... frames=N RESULT ... rect=green(ok)|red(STALE) label-ink-width=W frames=N
label-ink-width is how far right the label's text reaches: 154 for the long text on macOS at 1x, 85 for the short one. Run with no change at all (DELAY_MS=100000) as the control: it must print red(STALE) and the short width, which shows the read-back is the presented frame.
Environment: DELAY_MS before the change; HOP=runonmain to hop with bellui.RunOnMain instead of bellui.Do; MODE=swap to build into a window already shown; SHAPE=stack for Bellui Player's AudioPlayer shape (a widget over a Stack whose child is replaced, then both refreshed).
HIDE=1 (macOS) is the case that lost the change (#864): the app is hidden 300 ms after the start, so the window can't paint, and brought back to the front at 3 s. Give the change a DELAY_MS between the two, such as 1500. The read-back then waits until 5.5 s. It needs System Events (Accessibility) and does not raise the window if another app takes the front meanwhile, so the probe then forces a repaint after the read-back and prints whether a frame began: repaint-began=false means the window was still covered and the run says nothing.
go run ./hack/stalepaintprobe HIDE=1 DELAY_MS=1500 go run ./hack/stalepaintprobe