summaryrefslogtreecommitdiff
path: root/src/surface.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-28 23:34:20 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:15 -0300
commitfaa5ee1d81e2b9c4be6925b7178db2d2dc4577f8 (patch)
tree14799bbd5748743b985ac617ba134ad12bdc9269 /src/surface.zig
parentd8d770454e77fbeeb0dd9c5e965a7eda6a5558ba (diff)
downloadpardes-faa5ee1d81e2b9c4be6925b7178db2d2dc4577f8.tar.gz
pardes-faa5ee1d81e2b9c4be6925b7178db2d2dc4577f8.zip
G3: the focused cursor glides a jump on the Motion flavour's springs, and blinks
The core owns the motion, as Lift: animation.CursorGlide keeps the focused cursor's four corners on springs (leading corners at the flavour's pace x2.4, trailing ones x follow, so a jump smears and collapses; a long jump bows by the flavour's arc), sampled at each frame's own time. A step of a cell or less, insert mode, a focus change and any scroll (a file's view, a terminal's output) land at once; a snap lands a glide under way too. The quad is clamped to the focused pane when drawn (never its springs). Chrome carries it on the wire (cursor_glide: bit 1 a cursor, bit 0 gliding; cursor_alpha; cursor_quad, grid cells; cursor_idle_ms): the GUI draws the quad as an overlay in the cursor's colour, at 85% (70% on the long flavours) rising to solid as it lands, and hides the cells' cursors while it does: one or the other every frame. Only the focused cursor glides. Blink (CursorBlink, on by default in pixel shells) is the shell's: from cursor_idle_ms and when the frame arrived, solid while typing and 500 ms after, 530 ms halves with 80 ms eased edges, solid after 10 s idle, and never while the window is unfocused or minimized or on a virtual clock. An edge redraws the last frame with no core render (level B, blink_redraws); an attached GUI blinks from the same field without a frame per edge. Tests: snaps a cell, glides a jump with smear and bow, arrives under a pixel by 150 ms on smooth and lands exactly, shifts with a scroll; blink holds, eases, stops; the core glides a jump (ge) frame by frame (gliding exactly while it moves, alpha rising, exact at rest), snaps a step (j) and a switch to insert mid-glide; a terminal's scrolling output lands its cursor; wire round-trip of the cursor record. Shared files: src/animation.zig, src/pardes.zig, src/config.zig (toggle CursorBlink), src/surface.zig, src/detached/wire.zig.
Diffstat (limited to 'src/surface.zig')
-rw-r--r--src/surface.zig10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/surface.zig b/src/surface.zig
index 15de128f..523cba43 100644
--- a/src/surface.zig
+++ b/src/surface.zig
@@ -412,6 +412,16 @@ pub const Chrome = struct {
grip_focus_ring: [3]u8 = .{ 0, 0, 0 },
/// A dirty pane's button fill.
grip_dirty: [3]u8 = .{ 0, 0, 0 },
+ /// The focused cursor's quad (four corners, x then y, in grid cells, top
+ /// left clockwise): `cursor_glide` bit 1 says there is one, bit 0 that
+ /// it glides, when a pixel shell draws it at `cursor_alpha` in place of
+ /// its cursors (as it does while it blinks, from `cursor_idle_ms`, the
+ /// time since the last key or click when the frame was made; maxInt,
+ /// no blink).
+ cursor_glide: u8 = 0,
+ cursor_alpha: f32 = 1,
+ cursor_quad: [8]f32 = @splat(0),
+ cursor_idle_ms: u32 = std.math.maxInt(u32),
/// The rule between a pane's tag and its body; null is halfway between
/// the tag's ground and the page the shell actually draws.
tag_rule: ?[3]u8 = null,