feat(lib): port libghostty, Ghostty's embedded C API

Ports apprt/embedded.zig, main_c.zig and config/CApi.zig + c_get.zig as
crates/ghostty-lib (cdylib/staticlib/rlib `libghostty`), exporting every
function of the unchanged include/ghostty.h - the ABI Ghostty's Swift
macOS/iOS app links against. The embedded runtime implements the
runtime traits over the host's C callbacks, so the real core drives it.

- ghostty-core selects the renderer per target: Metal on Apple (surface
  NSView/UIView via RtSurface::platform_view), OpenGL elsewhere.
- ghostty_config_get follows Zig's c_get rules via a CValue type (143
  supported keys, checked against the Zig field types).
- The inspector C API is complete; its Metal backend replaces ImGui's
  Metal renderer and has not run.

Verification: generated C ABI probe (sizeof/alignof/offsetof of every
struct/union, 755 enum values, every function linked, nm exports, headers
byte-identical to upstream); a C host on Linux covering init, CLI
actions, config, app, keys, focus and color scheme; an opt-in
test-platform feature creating real surfaces on Linux with headless EGL
and a pty (13 tests). Apple targets are clippy-clean but not run; the
Swift app has not been built against it.

Test Plan:
- cargo test -p ghostty-lib (and --features test-platform)
- cargo clippy --target aarch64-apple-darwin -p ghostty-lib (cross env
  in docs/rewrite/notes/macos-M1.md)
This commit is contained in:
ddidderr committed 2026-10-12 06:38:33 +02:00
1 parent 4787565397
commit 49d4ecefae
47 files changed
+10296 -34

No files matched your search

+143
View File
@@ -0,0 +1,143 @@
language
font-synthetic-style
font-size
font-thicken
font-thicken-strength
font-shaping-break
alpha-blending
grapheme-width-method
freetype-load-flags
background
foreground
background-image
background-image-opacity
background-image-position
background-image-fit
background-image-repeat
selection-clear-on-typing
selection-clear-on-copy
minimum-contrast
palette
palette-generate
palette-harmonious
cursor-opacity
cursor-style
cursor-style-blink
cursor-click-to-move
mouse-hide-while-typing
scroll-to-bottom
mouse-shift-capture
mouse-reporting
background-opacity
background-opacity-cells
background-blur
unfocused-split-opacity
unfocused-split-fill
split-divider-color
split-preserve-zoom
notify-on-command-finish
notify-on-command-finish-action
notify-on-command-finish-after
wait-after-command
abnormal-command-exit-runtime
scrollbar
link-url
link-previews
maximize
fullscreen
title
class
x11-instance-name
window-padding-balance
window-padding-color
window-vsync
window-inherit-working-directory
tab-inherit-working-directory
split-inherit-working-directory
window-inherit-font-size
window-decoration
window-title-font-family
window-subtitle
window-theme
window-colorspace
window-height
window-width
window-position-x
window-position-y
window-save-state
window-step-resize
window-new-tab-position
window-show-tab-bar
window-titlebar-background
window-titlebar-foreground
resize-overlay
resize-overlay-position
resize-overlay-duration
focus-follows-mouse
clipboard-read
clipboard-write
clipboard-trim-trailing-spaces
clipboard-paste-protection
clipboard-paste-bracketed-safe
title-report
image-storage-limit
copy-on-select
right-click-action
click-repeat-interval
config-default-files
confirm-close-surface
quit-after-last-window-closed
quit-after-last-window-closed-delay
initial-window
undo-timeout
quick-terminal-position
quick-terminal-size
gtk-quick-terminal-layer
quick-terminal-screen
quick-terminal-animation-duration
quick-terminal-autohide
quick-terminal-space-behavior
quick-terminal-keyboard-interactivity
shell-integration
shell-integration-features
command-palette-entry
osc-color-report-format
vt-kam-allowed
custom-shader-animation
bell-features
bell-audio-path
bell-audio-volume
app-notifications
macos-non-native-fullscreen
macos-window-buttons
macos-titlebar-style
macos-titlebar-proxy-icon
macos-dock-drop-behavior
macos-option-as-alt
macos-window-shadow
macos-hidden
macos-auto-secure-input
macos-secure-input-indication
macos-applescript
macos-icon
macos-custom-icon
macos-icon-frame
macos-icon-ghost-color
macos-icon-screen-color
macos-shortcuts
linux-cgroup
linux-cgroup-hard-fail
gtk-opengl-debug
gtk-single-instance
gtk-titlebar
gtk-tabs-location
gtk-titlebar-hide-when-maximized
gtk-toolbar-style
gtk-titlebar-style
gtk-wide-tabs
desktop-notifications
progress-style
faint-opacity
async-backend
auto-update
auto-update-channel