diff options
| -rw-r--r-- | src/Messages.zig | 2 | ||||
| -rw-r--r-- | src/builtins.zig | 8 | ||||
| -rw-r--r-- | src/config.zig | 19 | ||||
| -rw-r--r-- | src/gui/gui.zig | 1 | ||||
| -rw-r--r-- | src/pardes.zig | 37 | ||||
| -rw-r--r-- | src/views.zig | 8 |
6 files changed, 37 insertions, 38 deletions
diff --git a/src/Messages.zig b/src/Messages.zig index e18815e3..8fa89125 100644 --- a/src/Messages.zig +++ b/src/Messages.zig @@ -304,7 +304,7 @@ pub fn messageWake(p: *const Pardes, pane: *const Pane) ?u64 { return soonest; } -/// Animation frames a message timing lasts; at least one. +/// Frames a message timing lasts; at least one. pub fn messageFrames(ms: u16) u16 { return @intCast(@max(1, (@as(u32, ms) + pardes.frame_ms - 1) / pardes.frame_ms)); } diff --git a/src/builtins.zig b/src/builtins.zig index c1d7c50b..de69c545 100644 --- a/src/builtins.zig +++ b/src/builtins.zig @@ -24,8 +24,8 @@ pub const frontend: config.Runtime.Capabilities = .{ // Only the SDL shell shapes with HarfBuzz and honours the setting. macOS // draws CoreText ligatures of its own, but nothing there reads it yet. .ligatures = pardes.platform == .gui, - // Soft shadows are the SDL shell's decor. - .lift = pardes.platform == .gui, + // The grip's width, the cursor's blink and the Pet are the SDL window's. + .pixels = pardes.platform == .gui, }; /// The terminal's build and the window's (docs/next-daemon.md, "Phase 6: @@ -33,8 +33,8 @@ pub const frontend: config.Runtime.Capabilities = .{ /// its own frontend does (`viewCapabilities`), so a terminal's replica of a /// window's session steps as the window's own does, and back. pub const desktop = pardes.platform == .tui or pardes.platform == .gui; -const window_capabilities: config.Runtime.Capabilities = .{ .font_picker = true, .tagline_font_size = true, .window_opacity = true, .window_blur = false, .ligatures = true, .lift = true }; -const terminal_capabilities: config.Runtime.Capabilities = .{ .font_picker = false, .tagline_font_size = false, .window_opacity = false, .window_blur = false, .ligatures = false, .lift = false }; +const window_capabilities: config.Runtime.Capabilities = .{ .font_picker = true, .tagline_font_size = true, .window_opacity = true, .window_blur = false, .ligatures = true, .pixels = true }; +const terminal_capabilities: config.Runtime.Capabilities = .{ .font_picker = false, .tagline_font_size = false, .window_opacity = false, .window_blur = false, .ligatures = false, .pixels = false }; /// The words this build has: a desktop build's are the window's. pub const capabilities: config.Runtime.Capabilities = if (desktop) window_capabilities else frontend; diff --git a/src/config.zig b/src/config.zig index 9eb95cfd..abc901d6 100644 --- a/src/config.zig +++ b/src/config.zig @@ -162,12 +162,12 @@ pub const leader_path = paths: { if (builtins.capabilities.window_opacity) table.set(.WindowOpacity, null); if (builtins.capabilities.window_blur) table.set(.WindowBlur, null); if (builtins.capabilities.ligatures) table.set(.Ligatures, null); - if (builtins.capabilities.lift) table.set(.CursorBlink, null); + if (builtins.capabilities.pixels) table.set(.CursorBlink, null); table.set(.JumpTrail, null); table.set(.ProgramEsc, null); - if (builtins.capabilities.lift) table.set(.GripWidth, null); + if (builtins.capabilities.pixels) table.set(.GripWidth, null); table.set(.InactiveDim, null); - if (builtins.capabilities.lift) table.set(.Pet, null); + if (builtins.capabilities.pixels) table.set(.Pet, null); if (builtins.TreeContext.enabled) table.set(.TreeContext, null); table.set(.ThemeFile, null); table.set(.DumpThemes, null); @@ -854,8 +854,9 @@ pub const Runtime = struct { window_blur: bool = false, /// The shell shapes text, so it can draw ligatures and stop drawing them. ligatures: bool = false, - /// The shell draws soft shadows under what stands off the page. - lift: bool = false, + /// The shell draws its own pixels (the SDL window): the grip at + /// GripWidth, its own cursor blink, the Pet. + pixels: bool = false, }; pub const Capability = std.meta.FieldEnum(Capabilities); @@ -903,13 +904,13 @@ pub const Runtime = struct { .font, .tagline_size => .font_picker, .window_opacity => .window_opacity, .window_blur => .window_blur, - .grip_width => .lift, + .grip_width => .pixels, .toggle => |field| switch (field) { .ligatures => .ligatures, - .cursor_blink => .lift, + .cursor_blink => .pixels, else => null, }, - .choice => |which| if (which == .pet) .lift else null, + .choice => |which| if (which == .pet) .pixels else null, else => null, }; } @@ -1349,7 +1350,7 @@ pub const Runtime = struct { .window_opacity = true, .window_blur = true, .ligatures = true, - .lift = true, + .pixels = true, }, .state = &state, }; diff --git a/src/gui/gui.zig b/src/gui/gui.zig index 60b00f7a..1bba29f8 100644 --- a/src/gui/gui.zig +++ b/src/gui/gui.zig @@ -4730,7 +4730,6 @@ test "a notch scrolls the core at once and the picture glides after it, a wrappe } test "a wheel's caret rides with its line, the text's own glide, never a spring of its own" { - if (!pardes.builtins.capabilities.lift) return error.SkipZigTest; const gpa = std.testing.allocator; const core = try pardes.Pardes.init(gpa, .{ .cols = 80, .rows = 24 }); defer core.deinit(); diff --git a/src/pardes.zig b/src/pardes.zig index ec684b78..16dd794e 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -546,7 +546,7 @@ test "startup config runs builtin lines in order and isolates bad lines" { try std.testing.expectEqualStrings("acme", p.theme().name); // The theme lands without a tween (the chrome is the theme's at once); - // the bad lines are said, so a notice may be animating. + // the bad lines are said, so a notice may be up. try std.testing.expectEqual(ChromeTheme.fromTheme(p.theme()), p.chromeTheme().*); try std.testing.expect(!p.quit); for (0..p.effects_len) |i| switch (p.effects[(p.effects_head + i) % p.effects.len]) { @@ -3496,8 +3496,8 @@ pub const Pardes = struct { /// frame is still owed, and the next pump draws it again. present_skipped: bool = false, /// Core time. `now_ns` is the shell's monotonic clock as `advance` was - /// last given it; `stepped_ns` is how far animation has been stepped - /// along it, in whole frames of `frame_ns`. Idle, the two are + /// last given it; `stepped_ns` is how far its timings have been + /// stepped along it, in whole frames of `frame_ns`. Idle, the two are /// the same instant. now_ns: u64 = 0, stepped_ns: u64 = 0, @@ -3586,7 +3586,7 @@ pub const Pardes = struct { /// effects has. pub const replica = .{ .local = .{ - // A frame, and the animations and timings that make it. + // A frame, and the timings that make it. "surface", "frames", "chrome", "frame_arena", "scratch", "needs_frame", "present_skipped", "native_image_patches", @@ -5006,10 +5006,8 @@ pub const Pardes = struct { const h = p.host; const v = h.vtable; if (v.wait_input) |f| { - // Asleep until input or until core animation next needs a - // frame; 0 is no timeout at all. - // A render-time animation draws every loop: the wait only takes - // what input is there. + // Asleep until input or until the core's next deadline + // (nextWake); 0 is no timeout at all. // The clock read whether or not it is wanted: what a replica // waits on is its own (a picture decoding wakes only a frame // that draws it), and the tape has the same calls either way. @@ -5035,7 +5033,7 @@ pub const Pardes = struct { // the display for one. This is what keeps the frame rate governing // rendering and nothing else. // A shell with a clock draws what `advance` stepped; one without - // steps its own `.tick`s and draws while anything animates. + // steps its own `.tick`s and draws while a deadline is due. if (!p.needs_frame and (v.now != null or !p.animationActive())) return p.frames.idle(); // No one to see it: the frame stays owed (needs_frame), not drawn. // A pty streaming into an unwatched session spent most of its time @@ -5142,7 +5140,7 @@ pub const Pardes = struct { defer tape.leave(p, taped); defer panes.File.syncTwins(p); defer p.reportFocus(); - // A tick with nothing animating is the one event that cannot change + // A tick with no deadline due is the one event that cannot change // the screen. p.needs_frame = p.needs_frame or ev != .tick; p.shell_rows.sweep(p.gpa); @@ -6800,12 +6798,13 @@ pub const Pardes = struct { return &p.body_chrome.?.chrome; } - /// When core animation next needs a frame, on the `stepped_ns` - /// timeline: a frame from now while anything moves, the end of the - /// wait while something only waits (a message lingering, a look-hover - /// delay), null when nothing is animating. Every frame-based animation - /// the core owns is in this one list, which is what lets every shell - /// sleep exactly as long as nothing changes. + /// When the core next needs a frame, on the `stepped_ns` timeline: a + /// frame from now while work goes on (places to find, a picture + /// decoding, a PDF page on a lane), the end of the wait while something + /// only waits (a message lingering, a look-hover delay), null when + /// nothing is due. Every deadline the core owns is in this one list, + /// which is what lets every shell sleep exactly as long as nothing + /// changes; what moves on the screen is the frontends' own. pub fn nextWake(p: *const Pardes) ?u64 { const next = p.stepped_ns + frame_ns; // Held 9P writes go in when they pause: wake for it, never before @@ -6865,12 +6864,12 @@ pub const Pardes = struct { return p.nextWake() != null; } - /// Bring core animation up to `now_ns`, the shell's monotonic clock: one + /// Bring core time up to `now_ns`, the shell's monotonic clock: one /// `.tick` for every whole frame that has passed since it last stood - /// still, so an animation takes as long on a 144 Hz display, over ssh or + /// still, so a timing lasts as long on a 144 Hz display, over ssh or /// after a slow frame as it does anywhere. A wait (a message lingering, /// the look-hover delay) is jumped to its end in one step and drawn - /// once. Idle, time is not banked: the next animation starts from now. + /// once. Idle, time is not banked: the next wait starts from now. pub fn advance(p: *Pardes, now_ns: u64) void { const taped = tape.enter(p, .{ .advance = now_ns }); defer tape.leave(p, taped); diff --git a/src/views.zig b/src/views.zig index 7e087523..f54e9eb2 100644 --- a/src/views.zig +++ b/src/views.zig @@ -30,7 +30,7 @@ pub const max = 4; /// The session's fields that are each view's own: its screen and layout, /// its focus, its pointer and gestures, its jumps, its key prefixes, and -/// what drawing it keeps (animations, the presentation of its panels). +/// what drawing it keeps (its frame and its timings). pub const fields = [_][:0]const u8{ "screen_w", "screen_h", "cell_pixels", "row_metrics", "ncol", "col_weight", "col_panes", "col_n", @@ -92,8 +92,8 @@ pub const Parked = struct { }; /// What a session's dump keeps of a view's share: all of it but what -/// drawing keeps (Pardes.replica's local fields: its animations, its -/// panels as presented). +/// drawing keeps (Pardes.replica's local fields: its frame and its +/// timings). const kept = blk: { @setEvalBranchQuota(100_000); var names: []const [:0]const u8 = &.{}; @@ -421,7 +421,7 @@ fn emptied(p: *Pardes, k: u8) void { /// A new view, as the live one is laid out and focused, with its panes /// where they are scrolled and its cursors where they are; the rest of it -/// (column tags, gestures, animations) as a session starts. Null when there +/// (column tags, gestures) as a session starts. Null when there /// are `max` already. pub fn open(p: *Pardes) ?u8 { const k: u8 = for (0..max) |i| { |
