diff options
Diffstat (limited to 'src/pardes.zig')
| -rw-r--r-- | src/pardes.zig | 52 |
1 files changed, 4 insertions, 48 deletions
diff --git a/src/pardes.zig b/src/pardes.zig index 63f8b61a..8204915d 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -1065,7 +1065,6 @@ test "an empty column shows its theme's empty_col under its tag: acme's white, e tagline.exitHeader(p); inline for (.{ "acme", "dark" }) |name| { try std.testing.expect(p.executeBuiltinLine(0, "Theme " ++ name)); - p.chrome_animation.displayed = colors.ChromeTheme.fromTheme(p.theme()); p.sync(); var arena: std.heap.ArenaAllocator = .init(std.testing.allocator); defer arena.deinit(); @@ -3367,7 +3366,7 @@ pub const Pardes = struct { theme_file_loaded: config.Runtime.Text(limits.host_path_cap) = .{}, theme_file_generation: u32 = 0, theme_file_pane: u8 = 0, - chrome_animation: colors.ChromeAnimation = colors.ChromeAnimation.init(colors.initial_chrome), + chrome: colors.ChromeTheme = colors.initial_chrome, /// The focused cursor's quad on its springs (animation.CursorGlide), /// the pane and view origin it was last aimed in, and the last key or /// click, which a blink holds for. @@ -3385,7 +3384,6 @@ pub const Pardes = struct { /// cursor waits where it was drawn for the release that places it. cursor_held: bool = false, input_ns: u64 = 0, - animate_theme_changes: bool = false, native_images: bool = false, /// The shell can take a changed image a few rows at a time (a texture row /// upload, a shared-memory hand-off), so a PDF selection is repainted as @@ -3602,7 +3600,7 @@ pub const Pardes = struct { pub const replica = .{ .local = .{ // A frame, and the animations and timings that make it. - "surface", "frames", "chrome_animation", + "surface", "frames", "chrome", "cursor_glide", "cursor_view", "cursor_crossing", "cursor_held", "frame_arena", "scratch", "needs_frame", "present_skipped", "shell_continuous", "native_image_patches", "echo", @@ -5295,7 +5293,6 @@ pub const Pardes = struct { }, .tick => { mouse.edgeScroll(p); - p.chrome_animation.advance(); look.advanceLookHover(p); }, } @@ -6802,10 +6799,9 @@ pub const Pardes = struct { return &themes[p.settings.theme]; } - /// Displayed colors for anchored UI chrome. Unlike `theme()`, this may be - /// between themes while a live transition is active. + /// The colours of the chrome: the theme's, set as it changes. pub fn chromeTheme(p: *const Pardes) *const ChromeTheme { - return &p.chrome_animation.displayed; + return &p.chrome; } /// The theme's own chrome, not a fade's (`theme()`'s, worked out once @@ -6830,7 +6826,6 @@ pub const Pardes = struct { // the next frame (writes served before the shell's clock was first // seen are stamped 0, which `advance` would count back from). if (p.fs.batch.bytes.items.len > 0) return @max(next, p.fs.batch.last_ns + ctlfs.pane.batch_pause_ns); - if (p.chrome_animation.isActive()) return next; // Places still to find resume on the next frame; a picture being // decoded is looked for. for (p.panes) |slot| if (slot) |pane| if (pane.places.busy(pane)) return next; @@ -8066,45 +8061,6 @@ test "jump history terminal rectangle follows output and clears on reflow" { try std.testing.expectEqual(.none, pane.sel[0].state); } -test "core animation keeps wall time at 60, 120 and 144 Hz and across a stall" { - const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 80, .rows = 24 }); - defer p.deinit(); - const frame = animation.frame_ns; - // Something that animates for as long as the test wants: the theme - // fade, held at its start before every step. - for ([_]u64{ 60, 120, 144 }) |hz| { - const start: u64 = 5 * std.time.ns_per_s; - p.clock_started = false; - p.advance(start); - var steps: u64 = 0; - var at: u64 = 1; - while (at <= hz) : (at += 1) { - const before = p.stepped_ns; - p.chrome_animation.step = 0; - p.advance(start + at * std.time.ns_per_s / hz); - const taken = (p.stepped_ns - before + frame / 2) / frame; - // Never two steps in one display frame: that is a visible hitch. - try std.testing.expect(taken <= 1); - steps += taken; - } - switch (hz) { - // One step a display frame, every display frame. - 60 => try std.testing.expectEqual(@as(u64, 60), steps), - 120 => try std.testing.expectEqual(@as(u64, 60), steps), - // The frame's own rate: 62 a second, give or take one. - else => try std.testing.expect(steps >= 61 and steps <= 63), - } - } - // A stall of minutes is not minutes of frames. - const before = p.stepped_ns; - p.chrome_animation.step = 0; - p.advance(before + 600 * std.time.ns_per_s); - try std.testing.expectEqual(before + 600 * std.time.ns_per_s, p.stepped_ns); - p.chrome_animation.step = animation.transition_steps; - p.advance(p.stepped_ns + frame); - try std.testing.expectEqual(@as(?u64, null), p.nextWake()); -} - test "a Save the host could not do logs no save record" { const th = @import("ninep/testing.zig"); const p = try th.withFile(std.testing.allocator, "x\n"); |
