aboutsummaryrefslogtreecommitdiff
path: root/vendor/libghostty-vt/include
diff options
context:
space:
mode:
authorCan Celik <ogulcancelik@gmail.com>2026-09-24 20:59:48 +0300
committerGitHub <noreply@github.com>2026-09-24 20:59:48 +0300
commitc411883ec639c9893ed9c33021c890485e91727b (patch)
tree797bb6efdb3a9425e3d8c31953f62452bd564cb1 /vendor/libghostty-vt/include
parent11a7ab4ae21ab9427bcb44b3be01f62a4ab58c47 (diff)
feat!: replace the custom graphics api with optimized native kitty rendering (#4561)
* feat!: replace the custom graphics api with optimized native kitty rendering * fix: enable safe kitty optimizations automatically --------- Co-authored-by: JJ Liebig <jonathan.liebig@gmail.com>
Diffstat (limited to 'vendor/libghostty-vt/include')
-rw-r--r--vendor/libghostty-vt/include/ghostty/vt/kitty_graphics.h20
-rw-r--r--vendor/libghostty-vt/include/ghostty/vt/terminal.h41
2 files changed, 57 insertions, 4 deletions
diff --git a/vendor/libghostty-vt/include/ghostty/vt/kitty_graphics.h b/vendor/libghostty-vt/include/ghostty/vt/kitty_graphics.h
index 99cee60a..8dad8086 100644
--- a/vendor/libghostty-vt/include/ghostty/vt/kitty_graphics.h
+++ b/vendor/libghostty-vt/include/ghostty/vt/kitty_graphics.h
@@ -391,12 +391,13 @@ typedef enum GHOSTTY_ENUM_TYPED {
/**
* Borrowed pointer to the raw pixel data. Valid as long as the
* underlying terminal is not mutated. Returns GHOSTTY_NO_VALUE when
- * the image metadata is resident but its pixel payload is pending.
+ * the image metadata is resident but its pixel payload is pending, or
+ * when the experimental PRESERVE_PNG option retained encoded PNG data.
*
* The data is always fully decoded, uncompressed pixels in the
* format reported by GHOSTTY_KITTY_IMAGE_DATA_FORMAT: zlib payloads
- * are inflated and PNG payloads are decoded to RGBA at transmission
- * time, before the image is stored. Consumers can upload this
+ * are inflated and PNG payloads are normally decoded to RGBA at transmission
+ * time, before the image is stored. Consumers can upload returned pixels
* directly to the GPU without any decode step.
*
* For an animated image (Kitty graphics animation, actions a=f/a=a)
@@ -412,7 +413,7 @@ typedef enum GHOSTTY_ENUM_TYPED {
/**
* Length of the raw pixel data in bytes. Always equal to
* width * height * bytes-per-pixel for the reported format. For a
- * pending image, this is the expected length reserved against the
+ * pending or encoded PNG image, this is the expected decoded length reserved against the
* storage limit even though DATA_PTR is not available yet.
*
* Output type: size_t *
@@ -439,6 +440,17 @@ typedef enum GHOSTTY_ENUM_TYPED {
*/
GHOSTTY_KITTY_IMAGE_DATA_GENERATION = 9,
+ /** Owned encoded PNG bytes, borrowed until the next mutation. NO_VALUE
+ * unless experimentally retained. Output type: const uint8_t **.
+ */
+ GHOSTTY_KITTY_IMAGE_DATA_ENCODED_PNG_PTR = 10,
+ /** Encoded PNG length; NO_VALUE unless retained. Output type: size_t *. */
+ GHOSTTY_KITTY_IMAGE_DATA_ENCODED_PNG_LEN = 11,
+ /** Borrowed void* backing context; valid only while image is unchanged. */
+ GHOSTTY_KITTY_IMAGE_DATA_FILE_CONTEXT = 12,
+ /** uint64_t immutable revision fingerprint; never reads image pixels. */
+ GHOSTTY_KITTY_IMAGE_DATA_FILE_IDENTITY = 13,
+
GHOSTTY_KITTY_IMAGE_DATA_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE,
} GhosttyKittyGraphicsImageData;
diff --git a/vendor/libghostty-vt/include/ghostty/vt/terminal.h b/vendor/libghostty-vt/include/ghostty/vt/terminal.h
index 81f9ebd0..6404af53 100644
--- a/vendor/libghostty-vt/include/ghostty/vt/terminal.h
+++ b/vendor/libghostty-vt/include/ghostty/vt/terminal.h
@@ -27,6 +27,39 @@
extern "C" {
#endif
+/** Borrowed opened descriptor; size is sizeof this request. No path is supplied. */
+typedef struct {
+ size_t size;
+ int64_t fd;
+ uint64_t expected_len;
+} GhosttyKittyImageSnapshotFileRequest;
+
+typedef bool (*GhosttyKittyImageFileReadFn)(void *context, uint8_t *dest, size_t len);
+typedef void (*GhosttyKittyImageFileReleaseFn)(void *context);
+
+typedef struct {
+ void *context;
+ uint64_t identity;
+ size_t len;
+ GhosttyKittyImageFileReadFn read;
+ GhosttyKittyImageFileReleaseFn release;
+} GhosttyKittyImageFileBacking;
+
+/** Optional synchronous callback, default NULL. Verify exact descriptor size
+ * and snapshot immutable bytes before returning true. True transfers one context
+ * reference; false transfers nothing. Do not close the borrowed descriptor or
+ * reenter the terminal. Both read and release MUST be non-NULL on success.
+ * Read must fill exactly len bytes; release is called once. An incomplete
+ * backing is rejected and ordinary file loading is used instead. If release
+ * is provided, rejection calls it once; without release, the host remains
+ * responsible for cleanup (the terminal cannot release that context).
+ * identity identifies the immutable revision, not a pathname or source inode.
+ */
+typedef bool (*GhosttyKittyImageSnapshotFileFn)(
+ GhosttyTerminal terminal, void *userdata,
+ const GhosttyKittyImageSnapshotFileRequest *request,
+ GhosttyKittyImageFileBacking *out_backing);
+
/** @defgroup terminal Terminal
*
* Complete terminal emulator state and rendering.
@@ -1545,6 +1578,14 @@ typedef enum GHOSTTY_ENUM_TYPED {
* Input type: size_t*
*/
GHOSTTY_TERMINAL_OPT_CLIPBOARD_WRITE_MAX_BYTES = 39,
+
+ /** Experimental, default-off PNG retention for quiet base transmissions.
+ * Input type: bool*. NULL is a no-op. Corrupt compressed pixels may only
+ * be detected when an animation operation materializes the image.
+ */
+ GHOSTTY_TERMINAL_OPT_KITTY_IMAGE_PRESERVE_PNG = 40,
+ /** Optional synchronous GhosttyKittyImageSnapshotFileFn; NULL disables. */
+ GHOSTTY_TERMINAL_OPT_KITTY_IMAGE_SNAPSHOT_FILE = 41,
GHOSTTY_TERMINAL_OPT_MAX_VALUE = GHOSTTY_ENUM_MAX_VALUE,
} GhosttyTerminalOption;