mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 08:46:08 +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 {
|
fn encodeError(r: *Response, err: EncodeableError) void {
|
||||||
switch (err) {
|
switch (err) {
|
||||||
error.OutOfMemory => r.message = "ENOMEM: out of memory",
|
error.OutOfMemory => r.message = "ENOMEM: out of memory",
|
||||||
|
error.InternalError => r.message = "EINVAL: internal error",
|
||||||
error.InvalidData => r.message = "EINVAL: invalid data",
|
error.InvalidData => r.message = "EINVAL: invalid data",
|
||||||
error.DecompressionFailed => r.message = "EINVAL: decompression failed",
|
error.DecompressionFailed => r.message = "EINVAL: decompression failed",
|
||||||
error.FilePathTooLong => r.message = "EINVAL: file path too long",
|
error.FilePathTooLong => r.message = "EINVAL: file path too long",
|
||||||
|
@ -244,6 +244,12 @@ pub const LoadingImage = struct {
|
|||||||
return error.InvalidData;
|
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.
|
// Everything looks good, copy the image data over.
|
||||||
var result = self.image;
|
var result = self.image;
|
||||||
result.data = try self.data.toOwnedSlice(alloc);
|
result.data = try self.data.toOwnedSlice(alloc);
|
||||||
@ -358,8 +364,10 @@ pub const Image = struct {
|
|||||||
format: command.Transmission.Format = .rgb,
|
format: command.Transmission.Format = .rgb,
|
||||||
compression: command.Transmission.Compression = .none,
|
compression: command.Transmission.Compression = .none,
|
||||||
data: []const u8 = "",
|
data: []const u8 = "",
|
||||||
|
transmit_time: std.time.Instant = undefined,
|
||||||
|
|
||||||
pub const Error = error{
|
pub const Error = error{
|
||||||
|
InternalError,
|
||||||
InvalidData,
|
InvalidData,
|
||||||
DecompressionFailed,
|
DecompressionFailed,
|
||||||
DimensionsRequired,
|
DimensionsRequired,
|
||||||
|
Reference in New Issue
Block a user