aboutsummaryrefslogtreecommitdiff
path: root/src/ghostty/bindings.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/ghostty/bindings.rs')
-rw-r--r--src/ghostty/bindings.rs159
1 files changed, 159 insertions, 0 deletions
diff --git a/src/ghostty/bindings.rs b/src/ghostty/bindings.rs
index 6e77288f..4998e2b6 100644
--- a/src/ghostty/bindings.rs
+++ b/src/ghostty/bindings.rs
@@ -2505,3 +2505,162 @@ unsafe extern "C" {
#[doc = " Check if paste data is safe to paste into the terminal.\n\n Data is considered unsafe if it contains:\n - Newlines (`\\n`) which can inject commands\n - The bracketed paste end sequence (`\\x1b[201~`) which can be used\n to exit bracketed paste mode and inject commands\n\n This check is conservative and considers data unsafe regardless of\n current terminal state.\n\n @param data The paste data to check (must not be NULL)\n @param len The length of the data in bytes\n @return true if the data is safe to paste, false otherwise"]
pub fn ghostty_paste_is_safe(data: *const ::std::os::raw::c_char, len: usize) -> bool;
}
+
+// Manually maintained additions for the vendored libghostty-vt Kitty graphics
+// C API. The rest of this file is generated by bindgen; keep these constants
+// in sync with vendor/libghostty-vt/include/ghostty/vt/*.h until bindings are
+// regenerated from the current vendored headers.
+pub const GhosttyTerminalOption_GHOSTTY_TERMINAL_OPT_KITTY_IMAGE_STORAGE_LIMIT:
+ GhosttyTerminalOption = 15;
+pub const GhosttyTerminalOption_GHOSTTY_TERMINAL_OPT_KITTY_IMAGE_MEDIUM_FILE:
+ GhosttyTerminalOption = 16;
+pub const GhosttyTerminalOption_GHOSTTY_TERMINAL_OPT_KITTY_IMAGE_MEDIUM_TEMP_FILE:
+ GhosttyTerminalOption = 17;
+pub const GhosttyTerminalOption_GHOSTTY_TERMINAL_OPT_KITTY_IMAGE_MEDIUM_SHARED_MEM:
+ GhosttyTerminalOption = 18;
+pub const GhosttyTerminalOption_GHOSTTY_TERMINAL_OPT_APC_MAX_BYTES: GhosttyTerminalOption = 19;
+pub const GhosttyTerminalOption_GHOSTTY_TERMINAL_OPT_APC_MAX_BYTES_KITTY: GhosttyTerminalOption =
+ 20;
+
+pub const GhosttyTerminalData_GHOSTTY_TERMINAL_DATA_KITTY_GRAPHICS: GhosttyTerminalData = 30;
+
+pub type GhosttySysOption = ::std::os::raw::c_uint;
+pub const GhosttySysOption_GHOSTTY_SYS_OPT_DECODE_PNG: GhosttySysOption = 1;
+
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct GhosttyKittyGraphicsImpl {
+ _unused: [u8; 0],
+}
+pub type GhosttyKittyGraphics = *mut GhosttyKittyGraphicsImpl;
+
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct GhosttyKittyGraphicsImageImpl {
+ _unused: [u8; 0],
+}
+pub type GhosttyKittyGraphicsImage = *const GhosttyKittyGraphicsImageImpl;
+
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct GhosttyKittyGraphicsPlacementIteratorImpl {
+ _unused: [u8; 0],
+}
+pub type GhosttyKittyGraphicsPlacementIterator = *mut GhosttyKittyGraphicsPlacementIteratorImpl;
+
+pub type GhosttyKittyGraphicsData = ::std::os::raw::c_uint;
+pub const GhosttyKittyGraphicsData_GHOSTTY_KITTY_GRAPHICS_DATA_PLACEMENT_ITERATOR:
+ GhosttyKittyGraphicsData = 1;
+
+pub type GhosttyKittyGraphicsPlacementData = ::std::os::raw::c_uint;
+pub const GhosttyKittyGraphicsPlacementData_GHOSTTY_KITTY_GRAPHICS_PLACEMENT_DATA_IMAGE_ID:
+ GhosttyKittyGraphicsPlacementData = 1;
+pub const GhosttyKittyGraphicsPlacementData_GHOSTTY_KITTY_GRAPHICS_PLACEMENT_DATA_PLACEMENT_ID:
+ GhosttyKittyGraphicsPlacementData = 2;
+pub const GhosttyKittyGraphicsPlacementData_GHOSTTY_KITTY_GRAPHICS_PLACEMENT_DATA_X_OFFSET:
+ GhosttyKittyGraphicsPlacementData = 4;
+pub const GhosttyKittyGraphicsPlacementData_GHOSTTY_KITTY_GRAPHICS_PLACEMENT_DATA_Y_OFFSET:
+ GhosttyKittyGraphicsPlacementData = 5;
+pub const GhosttyKittyGraphicsPlacementData_GHOSTTY_KITTY_GRAPHICS_PLACEMENT_DATA_Z:
+ GhosttyKittyGraphicsPlacementData = 12;
+
+pub type GhosttyKittyGraphicsImageData = ::std::os::raw::c_uint;
+pub const GhosttyKittyGraphicsImageData_GHOSTTY_KITTY_IMAGE_DATA_WIDTH:
+ GhosttyKittyGraphicsImageData = 3;
+pub const GhosttyKittyGraphicsImageData_GHOSTTY_KITTY_IMAGE_DATA_HEIGHT:
+ GhosttyKittyGraphicsImageData = 4;
+pub const GhosttyKittyGraphicsImageData_GHOSTTY_KITTY_IMAGE_DATA_FORMAT:
+ GhosttyKittyGraphicsImageData = 5;
+pub const GhosttyKittyGraphicsImageData_GHOSTTY_KITTY_IMAGE_DATA_COMPRESSION:
+ GhosttyKittyGraphicsImageData = 6;
+pub const GhosttyKittyGraphicsImageData_GHOSTTY_KITTY_IMAGE_DATA_DATA_PTR:
+ GhosttyKittyGraphicsImageData = 7;
+pub const GhosttyKittyGraphicsImageData_GHOSTTY_KITTY_IMAGE_DATA_DATA_LEN:
+ GhosttyKittyGraphicsImageData = 8;
+
+pub type GhosttyKittyImageFormat = ::std::os::raw::c_uint;
+pub const GhosttyKittyImageFormat_GHOSTTY_KITTY_IMAGE_FORMAT_RGB: GhosttyKittyImageFormat = 0;
+pub const GhosttyKittyImageFormat_GHOSTTY_KITTY_IMAGE_FORMAT_RGBA: GhosttyKittyImageFormat = 1;
+pub const GhosttyKittyImageFormat_GHOSTTY_KITTY_IMAGE_FORMAT_PNG: GhosttyKittyImageFormat = 2;
+
+pub type GhosttyKittyImageCompression = ::std::os::raw::c_uint;
+pub const GhosttyKittyImageCompression_GHOSTTY_KITTY_IMAGE_COMPRESSION_NONE:
+ GhosttyKittyImageCompression = 0;
+
+#[repr(C)]
+#[derive(Debug, Default, Copy, Clone)]
+pub struct GhosttyKittyGraphicsPlacementRenderInfo {
+ pub size: usize,
+ pub pixel_width: u32,
+ pub pixel_height: u32,
+ pub grid_cols: u32,
+ pub grid_rows: u32,
+ pub viewport_col: i32,
+ pub viewport_row: i32,
+ pub viewport_visible: bool,
+ pub source_x: u32,
+ pub source_y: u32,
+ pub source_width: u32,
+ pub source_height: u32,
+}
+
+#[repr(C)]
+#[derive(Debug, Default, Copy, Clone)]
+pub struct GhosttySysImage {
+ pub width: u32,
+ pub height: u32,
+ pub data: *mut u8,
+ pub data_len: usize,
+}
+
+pub type GhosttySysDecodePngFn = ::std::option::Option<
+ unsafe extern "C" fn(
+ userdata: *mut ::std::os::raw::c_void,
+ allocator: *const GhosttyAllocator,
+ data: *const u8,
+ data_len: usize,
+ out: *mut GhosttySysImage,
+ ) -> bool,
+>;
+
+unsafe extern "C" {
+ pub fn ghostty_sys_set(
+ option: GhosttySysOption,
+ value: *const ::std::os::raw::c_void,
+ ) -> GhosttyResult;
+ pub fn ghostty_kitty_graphics_get(
+ graphics: GhosttyKittyGraphics,
+ data: GhosttyKittyGraphicsData,
+ out: *mut ::std::os::raw::c_void,
+ ) -> GhosttyResult;
+ pub fn ghostty_kitty_graphics_image(
+ graphics: GhosttyKittyGraphics,
+ image_id: u32,
+ ) -> GhosttyKittyGraphicsImage;
+ pub fn ghostty_kitty_graphics_image_get(
+ image: GhosttyKittyGraphicsImage,
+ data: GhosttyKittyGraphicsImageData,
+ out: *mut ::std::os::raw::c_void,
+ ) -> GhosttyResult;
+ pub fn ghostty_kitty_graphics_placement_iterator_new(
+ allocator: *const GhosttyAllocator,
+ out_iterator: *mut GhosttyKittyGraphicsPlacementIterator,
+ ) -> GhosttyResult;
+ pub fn ghostty_kitty_graphics_placement_iterator_free(
+ iterator: GhosttyKittyGraphicsPlacementIterator,
+ );
+ pub fn ghostty_kitty_graphics_placement_next(
+ iterator: GhosttyKittyGraphicsPlacementIterator,
+ ) -> bool;
+ pub fn ghostty_kitty_graphics_placement_get(
+ iterator: GhosttyKittyGraphicsPlacementIterator,
+ data: GhosttyKittyGraphicsPlacementData,
+ out: *mut ::std::os::raw::c_void,
+ ) -> GhosttyResult;
+ pub fn ghostty_kitty_graphics_placement_render_info(
+ iterator: GhosttyKittyGraphicsPlacementIterator,
+ image: GhosttyKittyGraphicsImage,
+ terminal: GhosttyTerminal_ptr,
+ out_info: *mut GhosttyKittyGraphicsPlacementRenderInfo,
+ ) -> GhosttyResult;
+}