mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-08-24 16:11:43 +00:00
terminal/kitty: X handling properly since 0.45 fix
This commit is contained in:
@@ -783,7 +783,7 @@ pub const AnimationFrameLoading = struct {
|
||||
/// leaves the gap unchanged.
|
||||
gap_ms: i32 = 0, // z
|
||||
|
||||
composition_mode: CompositionMode = .alpha_blend, // X (or C, see parse)
|
||||
composition_mode: CompositionMode = .alpha_blend, // X
|
||||
background: Background = .{}, // Y
|
||||
|
||||
/// The canvas background color as a 32-bit RGBA value where R is
|
||||
@@ -825,16 +825,10 @@ pub const AnimationFrameLoading = struct {
|
||||
result.gap_ms = @bitCast(v);
|
||||
}
|
||||
|
||||
// The published spec assigns the composition mode to the X
|
||||
// key and Kitty honored that through 0.44; Kitty 0.45 moved
|
||||
// it to the C key (a doc/implementation regression). We accept
|
||||
// either, tested only against 1 like Kitty.
|
||||
// Tested only against 1 like Kitty.
|
||||
if (kv.get('X')) |v| {
|
||||
result.composition_mode = if (v == 1) .overwrite else .alpha_blend;
|
||||
}
|
||||
if (kv.get('C')) |v| {
|
||||
if (v == 1) result.composition_mode = .overwrite;
|
||||
}
|
||||
|
||||
if (kv.get('Y')) |v| {
|
||||
result.background = @bitCast(v);
|
||||
|
||||
@@ -2852,19 +2852,8 @@ test "kittygfx animation: create from base frame with overwrite" {
|
||||
try testing.expect(resp.ok());
|
||||
}
|
||||
|
||||
// Kitty >= 0.45 uses C for the same flag; accept it too.
|
||||
{
|
||||
const cmd = try command.Parser.parseString(
|
||||
alloc,
|
||||
"a=f,i=1,f=32,s=1,v=1,c=1,C=1;AAD/gA==",
|
||||
);
|
||||
defer cmd.deinit(alloc);
|
||||
try testing.expect(execute(io, alloc, &t, &cmd).?.ok());
|
||||
}
|
||||
|
||||
const anim = storage.imagePtrByIdOrNumber(1, 0).?.animation.?;
|
||||
try testing.expectEqualSlices(u8, &.{ 0, 0, 255, 128 }, anim.frames.items[0].data);
|
||||
try testing.expectEqualSlices(u8, &.{ 0, 0, 255, 128 }, anim.frames.items[1].data);
|
||||
}
|
||||
|
||||
test "kittygfx animation: alpha blend composes over base frame" {
|
||||
|
||||
Reference in New Issue
Block a user