summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/gui.zig22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/gui/gui.zig b/src/gui/gui.zig
index 35fbc99d..39d7f61e 100644
--- a/src/gui/gui.zig
+++ b/src/gui/gui.zig
@@ -603,6 +603,10 @@ test "closing tombstone overlays but never owns canonical cells" {
};
const groups = makeGroups(&.{closing}, true);
try std.testing.expectEqual(@as(usize, 0), groupAt(&groups, 4, 4));
+ // A still pane's notice stays under the tombstone sliding over it.
+ const notice: pardes.Layer = .{ .kind = .notice, .viewport = .{ .x = 4, .y = 4, .w = 3, .h = 1 }, .rows = 1 };
+ try std.testing.expectEqual(@as(usize, 0), noticeGroup(&groups, &notice));
+ try std.testing.expectEqual(makeGroups(&.{}, false).notices, noticeGroup(&makeGroups(&.{}, false), &notice));
try std.testing.expectEqual(@as(usize, 1), groups.tracks);
try std.testing.expectEqual(pardes.animation.Phase.closing, groups.items[1].track.?.phase);
}
@@ -2071,6 +2075,14 @@ fn groupOf(groups: *const Groups, serial: u32) usize {
return 0;
}
+/// A notice floats over the panes (tier 4), except while a pane closes: then
+/// it stays in its own pane's group, under the tombstone sliding over it.
+fn noticeGroup(groups: *const Groups, layer: *const pardes.Layer) usize {
+ for (groups.items[1..][0..groups.tracks]) |group|
+ if (group.track.?.phase == .closing) return groupAt(groups, layer.viewport.x, layer.viewport.y);
+ return groups.notices;
+}
+
/// What draws a grid cell, marked once a frame from the layers and the
/// regions (coverFrame), so the cell loops read it rather than search.
const Cover = packed struct(u16) {
@@ -5344,7 +5356,7 @@ fn renderFrame(
}
for (surface.tagLayers()) |*layer| {
if (layer.rows == 0) continue;
- const group_index = if (layer.kind == .notice) groups.notices else groupAt(&groups, layer.viewport.x, layer.viewport.y);
+ const group_index = if (layer.kind == .notice) noticeGroup(&groups, layer) else groupAt(&groups, layer.viewport.x, layer.viewport.y);
groups.items[group_index].cell_count += (tagLayerCellCount(g, layer) + 1) * layer.rows;
}
for (groups.items[1..][0..groups.tracks], 1..) |group, index| {
@@ -5440,7 +5452,7 @@ fn renderFrame(
if (layer.rows == 0) continue;
const track_index = groupAt(&groups, layer.viewport.x, layer.viewport.y);
// A notice floats over the panes, moving with its own.
- const group_index = if (layer.kind == .notice) groups.notices else track_index;
+ const group_index = if (layer.kind == .notice) noticeGroup(&groups, layer) else track_index;
emitTagLayer(g, instances, &cell_next[group_index], layer, win_w, win_h, groups.items[track_index].track, page, cursors_shown, false);
}
for (groups.items[1..][0..groups.tracks], 1..) |group, index| {
@@ -7374,8 +7386,8 @@ fn buildDecor(g: *Gui, gpa: std.mem.Allocator, surface: *const pardes.Surface, g
// ruled off from the text beneath it the way a tag is: the same
// colour and thickness along its bottom, running to the window's
// edge when it does, fading up and dissolving with its band.
- if (index == groups.notices) for (surface.tagLayers()) |*layer| {
- if (layer.rows == 0 or layer.kind != .notice) continue;
+ for (surface.tagLayers()) |*layer| {
+ if (layer.rows == 0 or layer.kind != .notice or noticeGroup(groups, layer) != index) continue;
const x0 = @as(f32, @floatFromInt(layer.viewport.x)) * layout.w;
const x1 = x0 + @as(f32, @floatFromInt(layer.viewport.w)) * layout.w;
const rule_x1 = if (win_w - x1 < layout.w) @max(x1, win_w) else x1;
@@ -7386,7 +7398,7 @@ fn buildDecor(g: *Gui, gpa: std.mem.Allocator, surface: *const pardes.Surface, g
if (rule_y - 1 < top) continue;
const track = groups.items[groupAt(groups, layer.viewport.x, layer.viewport.y)].track;
try addDecor(g, gpa, x0, rule_y - 1, rule_x1, rule_y, chrome.border, layer.fade, track, win_w, win_h);
- };
+ }
if (index == groups.ink and cursors_shown) try cursorDecor(g, gpa, surface, layout, win_w, win_h);
}
}