Skip to content

Draw the first frame when the window comes on screen - #14

Open
ekoneil wants to merge 1 commit into
ArchAstro:mainfrom
ekoneil:fix-blank-first-frame
Open

ekoneil wants to merge 1 commit into
ArchAstro:mainfrom
ekoneil:fix-blank-first-frame

Conversation

@ekoneil

@ekoneil ekoneil commented Nov 6, 2026

Copy link
Copy Markdown

What changed

Launching stet file.md from a terminal on macOS could open a blank window
that only drew the document after a click. With STET_TIMING=1 stet -f, the
first redraw was requested three times and laid out each time, but no surface
texture was ever acquired and nothing asked again:

stet:  95.61ms  ready for first frame
stet: 100.31ms  first redraw requested
stet: 100.53ms  first frame laid out
stet: 102.37ms  first redraw requested
stet: 102.54ms  first frame laid out
stet: 118.64ms  first redraw requested
stet: 118.69ms  first frame laid out

redraw() returned on Occluded and Timeout without requesting another
frame, and there was no handler for WindowEvent::Occluded, so the dropped
frame was never retried until input arrived.

  • WindowEvent::Occluded(false) now requests a redraw.
  • Timeout requests another frame instead of dropping it.
  • Occluded still returns without retrying, so a hidden or minimized window
    doesn't spin.

Verification

  • Manual, macOS (Apple Silicon): before, the window was blank until clicked;
    after, tour.md draws on launch, and the timing log reaches
    first frame presented with no input.
  • No automated test: the bug needs a real window and surface plus on-screen
    timing, which --screenshot (headless) doesn't create. Happy to add one if
    --drive can reproduce it.
  • cargo fmt --check, cargo clippy --all-targets --all-features -D warnings,
    cargo doc with -D warnings, and cargo test --all-targets --all-features
    (307 passed, 2 ignored) all pass locally.
  • cargo audit fails on main too (RUSTSEC-2026-0433, pulldown-cmark 0.13.5);
    unrelated to this change, and addressed in a separate PR.

Checklist

  • Tests cover the behavior change (see above: manual only)
  • Documentation is updated where needed (no behavior or config change)
  • No secrets, private fixtures, or generated artifacts are included
  • Formatting, clippy, tests, and docs pass locally

🤖 Generated with Claude Code

Launched from a terminal on macOS, the window could stay blank until
clicked: the first frames were asked for before the window was on
screen, the surface came back occluded or timed out, and redraw()
returned without asking again. Nothing else asks for a frame until
input arrives.

Redraw on WindowEvent::Occluded(false), and ask again after a timeout.
An occluded surface still returns without asking, so a hidden window
does not spin.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant