mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-21 23:05:20 +00:00
macos: support setting multiple clipboard content types
This commit is contained in:
@@ -66,7 +66,13 @@ pub const App = struct {
|
||||
) callconv(.c) void,
|
||||
|
||||
/// Write the clipboard value.
|
||||
write_clipboard: *const fn (SurfaceUD, [*:0]const u8, c_int, bool) callconv(.c) void,
|
||||
write_clipboard: *const fn (
|
||||
SurfaceUD,
|
||||
c_int,
|
||||
[*]const CAPI.ClipboardContent,
|
||||
usize,
|
||||
bool,
|
||||
) callconv(.c) void,
|
||||
|
||||
/// Close the current surface given by this function.
|
||||
close_surface: ?*const fn (SurfaceUD, bool) callconv(.c) void = null,
|
||||
@@ -707,8 +713,12 @@ pub const Surface = struct {
|
||||
) !void {
|
||||
self.app.opts.write_clipboard(
|
||||
self.userdata,
|
||||
val.ptr,
|
||||
@intCast(@intFromEnum(clipboard_type)),
|
||||
&.{.{
|
||||
.mime = "text/plain",
|
||||
.data = val.ptr,
|
||||
}},
|
||||
1,
|
||||
confirm,
|
||||
);
|
||||
}
|
||||
@@ -1211,6 +1221,12 @@ pub const CAPI = struct {
|
||||
cell_height_px: u32,
|
||||
};
|
||||
|
||||
// ghostty_clipboard_content_s
|
||||
const ClipboardContent = extern struct {
|
||||
mime: [*:0]const u8,
|
||||
data: [*:0]const u8,
|
||||
};
|
||||
|
||||
// ghostty_text_s
|
||||
const Text = extern struct {
|
||||
tl_px_x: f64,
|
||||
|
||||
Reference in New Issue
Block a user