Merge screen-anchored render-grid export with main's lease rotation

Merged
AZ
4mo ago
+76-6

Merges the screen-anchored render-grid export branch (ghostty_surface_render_grid_json_v2 with history metrics, from https://github.com/manaflow-ai/cmux/pull/8860) with fork main's frame-lease rotation (https://github.com/manaflow-ai/ghostty/pull/145). Both sides independently added identical next_slot rotation to src/renderer/frame_lease.zig; the merge keeps fork main's version verbatim. No other overlaps: render_grid_json_v2 appears exactly once in include/ghostty.h and src/apprt/embedded.zig.

šŸ¤– Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Summary by cubic

Adds a screen-anchored render-grid export with history metrics. Keeps swap-chain slot rotation from main to fix frozen frames with fully serial presenters.

  • New Features

    • New C API: ghostty_surface_render_grid_json_v2(surface, id_ptr, id_len, state_seq, scrollback_lines, include_theme, anchor_active).
    • anchor_active=true anchors the grid to the active area, independent of scroll; scrollback_lines bounds history above it.
    • JSON now includes history_rows and row_space_revision for precise scroll deltas and invalidation.
    • Existing exports keep viewport anchoring; no behavior change.
  • Bug Fixes

    • Round-robin swap-chain slot selection so consecutive frames use distinct IOSurfaces, ensuring Core Animation recomposites and preventing frozen frames on serial producers (e.g., iOS render_now).