From 1b2ac091200e9192f3677abe161217ba82463606 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 5 Nov 2026 13:08:44 -0300 Subject: effects out, the message animations: a message no longer falls into its row and dissolves out of it; it shows at once and goes when it has lingered, its lifetime the one deadline the core keeps for it (MessageLinger, a wait nextWake jumps in one step); MessageAnimation, MessageFall and MessageDissolve go with their settings, the entering and leaving phases (Pane.MessagePhase is shown or lingering), Messages.messageMotion and noticeLife, the notice band's colour blend toward the page, Layer.slide and fade, and the window's offset band, its clip to the body and its rule's fade; no frontend fades a message of its own (the window would have to see a notice come and go between frames for a 150 ms fade); the snapshot harness's, kitty harness's and casts' inits lose `MessageAnimation off`; the message tests keep their linger and stacking and lose the fall and dissolve, and `a notice leaves quicker than it arrives` goes; GUI goldens 10 and 12 to 17 change, the golden session having run with MessageAnimation on by default: a message dismissed while it fell stayed up (its dismissal undone by the next announcement), and FocusTint's stood on in every scene after; the tree before this change with MessageAnimation off draws exactly these frames, all sixteen byte for byte Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/gui/gui.zig | 34 ++++++---------------------------- 1 file changed, 6 insertions(+), 28 deletions(-) (limited to 'src/gui/gui.zig') diff --git a/src/gui/gui.zig b/src/gui/gui.zig index 01a58eae..a81f029f 100644 --- a/src/gui/gui.zig +++ b/src/gui/gui.zig @@ -5548,13 +5548,7 @@ fn renderFrame( if (layer.rows == 0) continue; // A notice floats over the panes. const group_index = if (layer.kind == .notice) groups.notices else 0; - const start = cell_next[group_index]; emitTagLayer(g, instances, &cell_next[group_index], layer, win_w, win_h, page, cursors_shown); - // A notice dropping past its row (a flavour's overshoot) stays - // inside its pane's body. - if (layer.kind == .notice and layer.slide > 0) if (bodyBottom(surface, layer.id, layout)) |bottom| { - for (instances[start..cell_next[group_index]]) |*instance| clipInstance(instance, .{ -1e9, -1e9, 1e9, bottom }, win_w, win_h); - }; } for (groups.items[0..groups.len], 0..) |group, index| std.debug.assert(cell_next[index] == group.cell_start + group.cell_count); @@ -5809,14 +5803,6 @@ test "the layer cover is the per-cell layer scan, over a core's layouts and rand } } -/// The bottom of pane `owner`'s body, in window pixels. -fn bodyBottom(surface: *const pardes.Surface, owner: u16, layout: CellLayout) ?f32 { - for (surface.regionList()) |region| { - if (region.kind == .body and region.owner == owner) return @as(f32, @floatFromInt(region.rect.y + region.rect.h)) * layout.h; - } - return null; -} - fn tagLayerCellCount(g: *const Gui, layer: *const pardes.Layer) u32 { const pixels = @as(u32, layer.viewport.w) * g.cell_w; return @min(layer.cols, (pixels + g.tagline_width - 1) / g.tagline_width); @@ -5829,9 +5815,6 @@ fn emitTagLayer(g: *Gui, instances: [*]CellInstance, next: *u32, layer: *const p const left = @as(f32, @floatFromInt(layer.viewport.x)) * bw; const right = left + @as(f32, @floatFromInt(layer.viewport.w)) * bw; const background: pardes.Cell = .{ .default = false, .style = .{ .bg = .{ .rgb = layer.bg } } }; - // A band sliding into place is drawn offset and cut at its row's top, so - // it comes out from under whatever is above it. - const slide = layer.slide * bh; // A window is rarely a whole number of cells wide: a band that ends at // the last column runs on through the leftover pixels to the edge. const band_right = if (win_w - right < bw) @max(right, win_w) else right; @@ -5839,16 +5822,14 @@ fn emitTagLayer(g: *Gui, instances: [*]CellInstance, next: *u32, layer: *const p // A row to each line, each a grid row with the tagline's glyphs. for (0..layer.rows) |index| { const y = layer.viewport.y + @as(u16, @intCast(index)); - const top = @as(f32, @floatFromInt(y)) * bh; - emitInstance(g, instances, next.*, 0, y, .{ .w = band_right - left, .h = bh, .x_off = left, .y_off = slide }, win_w, win_h, .body, (&background)[0..1], 0, null, false, page); - if (slide != 0) clipInstance(&instances[next.*], .{ -1e9, top, 1e9, 1e9 }, win_w, win_h); + emitInstance(g, instances, next.*, 0, y, .{ .w = band_right - left, .h = bh, .x_off = left, .y_off = 0 }, win_w, win_h, .body, (&background)[0..1], 0, null, false, page); next.* += 1; const cells = layer.cells[index * layer.cols ..][0..layer.cols]; const line_cursor: ?usize = if (layer.cursor) |cu| (if (cu.y == index) cu.x else null) else null; for (0..tagLayerCellCount(g, layer)) |col| { const cursor = if (layer.cursor) |cu| show_cursor and !cu.bar and cu.x == col and cu.y == index else false; - emitInstance(g, instances, next.*, @intCast(col), y, .{ .w = tw, .h = bh, .x_off = left, .y_off = slide }, win_w, win_h, .tagline, cells, col, line_cursor, cursor, page); - clipInstance(&instances[next.*], .{ -1e9, if (slide != 0) top else -1e9, right, 1e9 }, win_w, win_h); + emitInstance(g, instances, next.*, @intCast(col), y, .{ .w = tw, .h = bh, .x_off = left, .y_off = 0 }, win_w, win_h, .tagline, cells, col, line_cursor, cursor, page); + clipInstance(&instances[next.*], .{ -1e9, -1e9, right, 1e9 }, win_w, win_h); if (faded and !cursor) dim.fade(&instances[next.*]); next.* += 1; } @@ -7521,18 +7502,15 @@ fn buildDecor(g: *Gui, gpa: std.mem.Allocator, surface: *const pardes.Surface, g // A notice chip is tagline hung over the body's top rows, so it is // 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. + // edge when it does. if (index == groups.notices) for (surface.tagLayers()) |*layer| { if (layer.rows == 0 or layer.kind != .notice) 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; const top = @as(f32, @floatFromInt(layer.viewport.y)) * layout.h; - // A band still falling into place is cut at its row's top; its - // rule comes with it, and shows only once it is below that cut. - const rule_y = top + (1 + layer.slide) * layout.h; - if (rule_y - dp(1) < top) continue; - try addDecor(g, gpa, x0, rule_y - dp(1), rule_x1, rule_y, chrome.border, layer.fade, win_w, win_h); + const rule_y = top + layout.h; + try addDecor(g, gpa, x0, rule_y - dp(1), rule_x1, rule_y, chrome.border, 1, win_w, win_h); }; if (index == groups.ink and cursors_shown) try cursorDecor(g, gpa, surface, layout, win_w, win_h); } -- cgit v1.3