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:
1 parent
f2252bb165
commit
75bf604375
47 files changed
+10296
-34
No files matched your search
@@ -1,5 +1,8 @@
|
||||
//! Keybinding actions end to end (default and configured bindings).
|
||||
|
||||
// These drive the real surface over a headless OpenGL context; the Apple targets render
|
||||
// with Metal.
|
||||
#![cfg(not(target_vendor = "apple"))]
|
||||
#![allow(clippy::unwrap_used, clippy::expect_used)]
|
||||
|
||||
use std::fmt::Write as _;
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
//! IME: preedit state and rendering, commit, composing key events.
|
||||
|
||||
// These drive the real surface over a headless OpenGL context; the Apple targets render
|
||||
// with Metal.
|
||||
#![cfg(not(target_vendor = "apple"))]
|
||||
#![allow(clippy::unwrap_used, clippy::expect_used)]
|
||||
|
||||
mod common;
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
//! recording (with the pty encoding and triggered bindings) and VT event
|
||||
//! recording while data is read from the pty.
|
||||
|
||||
// These drive the real surface over a headless OpenGL context; the Apple targets render
|
||||
// with Metal.
|
||||
#![cfg(not(target_vendor = "apple"))]
|
||||
#![allow(clippy::unwrap_used, clippy::expect_used, clippy::assert_is_empty)]
|
||||
|
||||
mod common;
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
//! Keyboard input end to end: key events -> core Surface -> encoder -> pty ->
|
||||
//! a real `cat` child that records the exact bytes it received.
|
||||
|
||||
// These drive the real surface over a headless OpenGL context; the Apple targets render
|
||||
// with Metal.
|
||||
#![cfg(not(target_vendor = "apple"))]
|
||||
#![allow(clippy::unwrap_used, clippy::expect_used)]
|
||||
|
||||
mod common;
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
//! Mouse end to end: selection, copy-on-select, multi-click, mouse reporting
|
||||
//! formats, alternate scroll, shift bypass and links.
|
||||
|
||||
// These drive the real surface over a headless OpenGL context; the Apple targets render
|
||||
// with Metal.
|
||||
#![cfg(not(target_vendor = "apple"))]
|
||||
#![allow(clippy::unwrap_used, clippy::expect_used)]
|
||||
|
||||
mod common;
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
//! Terminal <-> runtime events: resize, focus, title, pwd, bell, OSC 52,
|
||||
//! notifications, progress, child exit.
|
||||
|
||||
// These drive the real surface over a headless OpenGL context; the Apple targets render
|
||||
// with Metal.
|
||||
#![cfg(not(target_vendor = "apple"))]
|
||||
#![allow(clippy::unwrap_used, clippy::expect_used)]
|
||||
|
||||
mod common;
|
||||
|
||||
Reference in new issue
Block a user