diff options
Diffstat (limited to 'src/pardes.zig')
| -rw-r--r-- | src/pardes.zig | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/pardes.zig b/src/pardes.zig index 691ee345..9f20e0a3 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -68,6 +68,17 @@ pub const frameMark = tracy.frameMark; pub const Platform = enum { tty, gui, web, macos, p4 }; pub const platform: Platform = @field(Platform, @tagName(@import("pardes_config").platform)); +/// Whether a theme change FADES the anchored chrome palette or replaces it. Ten display frames +/// either way (`animation.transition_steps`), and on every screen but one that is a short legible +/// transition rather than a glitch. +/// +/// The exception is a screen reached through a UART. Each of the ten steps recolors every anchored +/// cell, so the diff finds the whole chrome dirty and spends a frame's worth of wire on it, ten times +/// over, for a fade nobody can see arrive gradually anyway. Off by default for `p4` and settable +/// either way from the build, because the thing that makes it wrong is the transport rather than the +/// target - see `build.zig`. +pub const theme_animation = @import("pardes_config").theme_animation; + /// A build with no host but its display: the embedded source filesystem, the /// in-process clipboard, silent ptys. Comptime, and its own option module /// rather than a `pardes_config` field, because it is the one setting that @@ -2436,7 +2447,13 @@ pub const ChromeTheme = struct { } }; -const ChromeAnimation = animation.Transition(ChromeTheme); +/// The fade, or its absence, decided at comptime so that `-Dtheme-animation=false` leaves +/// `ChromeTheme.interpolate` unreachable and therefore out of the binary entirely. Every call site +/// below is written against the shared interface and needs no condition of its own. +const ChromeAnimation = if (theme_animation) + animation.Transition(ChromeTheme) +else + animation.Immediate(ChromeTheme); const initial_chrome = ChromeTheme.fromTheme(&themes[0]); // ---- the boundary types ---- @@ -5548,6 +5565,10 @@ pub const Pardes = struct { chrome_animation: ChromeAnimation = ChromeAnimation.init(initial_chrome), /// False only while startup configuration or a dump restore is selecting /// its first theme. No frame is rendered in that interval. + /// + /// Nothing to do with `-Dtheme-animation`: that is decided by the type of + /// `chrome_animation`, so a build without the fade does not carry a flag + /// saying so. animate_theme_changes: bool = false, /// Native pixel attachments supported by the shell (Kitty graphics in a /// terminal, GPU textures in SDL). Image panes dynamically fall back to |
