mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 00:36:07 +03:00
terminal/kitty-gfx: images store transmit time
This commit is contained in:
@ -297,6 +297,7 @@ const EncodeableError = Image.Error || Allocator.Error;
|
||||
fn encodeError(r: *Response, err: EncodeableError) void {
|
||||
switch (err) {
|
||||
error.OutOfMemory => r.message = "ENOMEM: out of memory",
|
||||
error.InternalError => r.message = "EINVAL: internal error",
|
||||
error.InvalidData => r.message = "EINVAL: invalid data",
|
||||
error.DecompressionFailed => r.message = "EINVAL: decompression failed",
|
||||
error.FilePathTooLong => r.message = "EINVAL: file path too long",
|
||||
|
@ -244,6 +244,12 @@ pub const LoadingImage = struct {
|
||||
return error.InvalidData;
|
||||
}
|
||||
|
||||
// Set our time
|
||||
self.image.transmit_time = std.time.Instant.now() catch |err| {
|
||||
log.warn("failed to get time: {}", .{err});
|
||||
return error.InternalError;
|
||||
};
|
||||
|
||||
// Everything looks good, copy the image data over.
|
||||
var result = self.image;
|
||||
result.data = try self.data.toOwnedSlice(alloc);
|
||||
@ -358,8 +364,10 @@ pub const Image = struct {
|
||||
format: command.Transmission.Format = .rgb,
|
||||
compression: command.Transmission.Compression = .none,
|
||||
data: []const u8 = "",
|
||||
transmit_time: std.time.Instant = undefined,
|
||||
|
||||
pub const Error = error{
|
||||
InternalError,
|
||||
InvalidData,
|
||||
DecompressionFailed,
|
||||
DimensionsRequired,
|
||||
|
Reference in New Issue
Block a user