mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-08-02 05:39:05 +00:00
#13182 Replace the OSC 52-specific kind and encoded payload callback with an atomic clipboard write containing a normalized destination and decoded MIME representations. This keeps protocol details out of embedders and lets iTerm2 Copy use the same semantic path. Represent clears with an empty content list, preserve binary payloads, and return a generic result for protocols that acknowledge writes. Add the C ABI descriptors, layout metadata, and effects example so future multipart protocols can reuse the callback without another API break.
37 lines
855 B
Zig
37 lines
855 B
Zig
/// The clipboard destination for a write.
|
|
pub const Location = enum(c_int) {
|
|
standard = 0,
|
|
selection = 1,
|
|
primary = 2,
|
|
_,
|
|
};
|
|
|
|
/// A single representation of clipboard data.
|
|
///
|
|
/// The MIME type and data are borrowed and only valid for the duration of a
|
|
/// clipboard write callback. Data is binary-safe.
|
|
pub const Content = struct {
|
|
mime: []const u8,
|
|
data: []const u8,
|
|
};
|
|
|
|
/// One atomic clipboard write.
|
|
///
|
|
/// Contents are borrowed and only valid for the duration of a clipboard write
|
|
/// callback. An empty contents slice clears the destination.
|
|
pub const Write = struct {
|
|
location: Location,
|
|
contents: []const Content,
|
|
};
|
|
|
|
/// The result of a clipboard write.
|
|
pub const WriteResult = enum(c_int) {
|
|
success = 0,
|
|
denied = 1,
|
|
unsupported = 2,
|
|
busy = 3,
|
|
invalid_data = 4,
|
|
io_error = 5,
|
|
_,
|
|
};
|