mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-17 13:02:42 +00:00
Replace the ImageInfo and PlacementInfo sized structs and their associated .info enum variants with a new _get_multi pattern that batches multiple enum+pointer pairs into a single call. This avoids struct ABI concerns (field order, padding, alignment, GHOSTTY_INIT_SIZED) while preserving the single-call-crossing performance benefit for FFI and Cgo callers. Each _get_multi function takes an array of enum keys, an array of output pointers, and an optional out_written parameter that reports how many values were successfully written before any error. This applies uniformly to all _get APIs: terminal_get, cell_get, row_get, render_state_get, render_state_row_get, render_state_row_cells_get, kitty_graphics_image_get, and kitty_graphics_placement_get. The C example is updated to use compound-literal _get_multi calls, and tests cover both success and error paths for every new function.
Example: ghostty-vt Kitty Graphics Protocol
This contains a simple example of how to use the system interface
(ghostty_sys_set) to install a PNG decoder callback, then send
a Kitty Graphics Protocol image via ghostty_terminal_vt_write.
This uses a build.zig and Zig to build the C program so that we
can reuse a lot of our build logic and depend directly on our source
tree, but Ghostty emits a standard C library that can be used with any
C tooling.
Usage
Run the program:
zig build run