mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-15 00:06:09 +03:00
kittygfx: z-index handling fixes
Fixes #2921 Our z-index handling was pretty much completely broken, hence I can't think of a better initial commit message. We were splitting the placements at the wrong points and just generally putting images in the wrong z-index. I'm shocked this didn't come up earlier.
This commit is contained in:
@ -1721,21 +1721,22 @@ fn prepKittyGraphics(
|
|||||||
}.lessThan,
|
}.lessThan,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Find our indices
|
// Find our indices. The values are sorted by z so we can find the
|
||||||
self.image_bg_end = 0;
|
// first placement out of bounds to find the limits.
|
||||||
self.image_text_end = 0;
|
var bg_end: ?u32 = null;
|
||||||
|
var text_end: ?u32 = null;
|
||||||
const bg_limit = std.math.minInt(i32) / 2;
|
const bg_limit = std.math.minInt(i32) / 2;
|
||||||
for (self.image_placements.items, 0..) |p, i| {
|
for (self.image_placements.items, 0..) |p, i| {
|
||||||
if (self.image_bg_end == 0 and p.z >= bg_limit) {
|
if (bg_end == null and p.z >= bg_limit) {
|
||||||
self.image_bg_end = @intCast(i);
|
bg_end = @intCast(i);
|
||||||
}
|
}
|
||||||
if (self.image_text_end == 0 and p.z >= 0) {
|
if (text_end == null and p.z >= 0) {
|
||||||
self.image_text_end = @intCast(i);
|
text_end = @intCast(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (self.image_text_end == 0) {
|
|
||||||
self.image_text_end = @intCast(self.image_placements.items.len);
|
self.image_bg_end = bg_end orelse 0;
|
||||||
}
|
self.image_text_end = text_end orelse self.image_bg_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prepKittyVirtualPlacement(
|
fn prepKittyVirtualPlacement(
|
||||||
|
@ -952,21 +952,22 @@ fn prepKittyGraphics(
|
|||||||
}.lessThan,
|
}.lessThan,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Find our indices
|
// Find our indices. The values are sorted by z so we can find the
|
||||||
self.image_bg_end = 0;
|
// first placement out of bounds to find the limits.
|
||||||
self.image_text_end = 0;
|
var bg_end: ?u32 = null;
|
||||||
|
var text_end: ?u32 = null;
|
||||||
const bg_limit = std.math.minInt(i32) / 2;
|
const bg_limit = std.math.minInt(i32) / 2;
|
||||||
for (self.image_placements.items, 0..) |p, i| {
|
for (self.image_placements.items, 0..) |p, i| {
|
||||||
if (self.image_bg_end == 0 and p.z >= bg_limit) {
|
if (bg_end == null and p.z >= bg_limit) {
|
||||||
self.image_bg_end = @intCast(i);
|
bg_end = @intCast(i);
|
||||||
}
|
}
|
||||||
if (self.image_text_end == 0 and p.z >= 0) {
|
if (text_end == null and p.z >= 0) {
|
||||||
self.image_text_end = @intCast(i);
|
text_end = @intCast(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (self.image_text_end == 0) {
|
|
||||||
self.image_text_end = @intCast(self.image_placements.items.len);
|
self.image_bg_end = bg_end orelse 0;
|
||||||
}
|
self.image_text_end = text_end orelse self.image_bg_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prepKittyVirtualPlacement(
|
fn prepKittyVirtualPlacement(
|
||||||
|
Reference in New Issue
Block a user