mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 16:56:09 +03:00
terminal/kitty: graphics exec ported
This commit is contained in:
@ -184,15 +184,19 @@ fn display(
|
|||||||
// Make sure our response has the image id in case we looked up by number
|
// Make sure our response has the image id in case we looked up by number
|
||||||
result.id = img.id;
|
result.id = img.id;
|
||||||
|
|
||||||
// Determine the screen point for the placement.
|
// Track a new pin for our cursor. The cursor is always tracked but we
|
||||||
const placement_point = (point.Viewport{
|
// don't want this one to move with the cursor.
|
||||||
.x = terminal.screen.cursor.x,
|
const placement_pin = terminal.screen.pages.trackPin(
|
||||||
.y = terminal.screen.cursor.y,
|
terminal.screen.cursor.page_pin.*,
|
||||||
}).toScreen(&terminal.screen);
|
) catch |err| {
|
||||||
|
log.warn("failed to create pin for Kitty graphics err={}", .{err});
|
||||||
|
result.message = "EINVAL: failed to prepare terminal state";
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
|
||||||
// Add the placement
|
// Add the placement
|
||||||
const p: ImageStorage.Placement = .{
|
const p: ImageStorage.Placement = .{
|
||||||
.point = placement_point,
|
.pin = placement_pin,
|
||||||
.x_offset = d.x_offset,
|
.x_offset = d.x_offset,
|
||||||
.y_offset = d.y_offset,
|
.y_offset = d.y_offset,
|
||||||
.source_x = d.x,
|
.source_x = d.x,
|
||||||
@ -209,6 +213,7 @@ fn display(
|
|||||||
result.placement_id,
|
result.placement_id,
|
||||||
p,
|
p,
|
||||||
) catch |err| {
|
) catch |err| {
|
||||||
|
p.deinit(&terminal.screen);
|
||||||
encodeError(&result, err);
|
encodeError(&result, err);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user