diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-18 10:19:31 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-18 10:19:31 -0300 |
| commit | a2538c49b1bb69dcd1a6f1350834e13f68c3c05d (patch) | |
| tree | 92c0cfb229d44974bf34ce6d4caa379142fbae44 /src/gui/gui.zig | |
| parent | b2f709d7130571658220636f33b5f89414a5101a (diff) | |
| parent | 5c5e0102f92938f433a3465c92818be810c1ef78 (diff) | |
| download | pardes-a2538c49b1bb69dcd1a6f1350834e13f68c3c05d.tar.gz pardes-a2538c49b1bb69dcd1a6f1350834e13f68c3c05d.zip | |
integration: addons in a client part 3 (the core's prerequisites and the double free; the PDF kind where it is shown: a plain record and pages as draws) with the client path's round 1: no conflict; tui core-test 820/959 (139 skipped), shell-test 994/997, behaviour-test 274/274, replicas pass, pane-test 180/181; gui unit-test 1588/1592 (its perf check refuses the baseline by compiler version, as on the base), the tui build has no SDL symbol, the frame corpus 74/77 against mbase in Debug and ReleaseFast: frames 58 to 60 show WindowOpacity's notice alone where the base stacked it under InactiveDim's (a PDF render's answer no longer lands between the two ctl writes: accepted, and the baseline recorded anew as mbase2 with those three frames), the perf window -0.405% (threshold 0.5%)
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'src/gui/gui.zig')
| -rw-r--r-- | src/gui/gui.zig | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/src/gui/gui.zig b/src/gui/gui.zig index 3af66b12..a8816494 100644 --- a/src/gui/gui.zig +++ b/src/gui/gui.zig @@ -1439,6 +1439,7 @@ fn clientSession(init: std.process.Init, g: *Gui, opts_in: pardes.Options, test_ // What it is, then its size, are its view's first inputs. link.input(.{ .frontend = .{ .windowed = true, .native_images = true, .native_image_patches = true } }); var drew = false; + var again = false; while (!link.quit) { core.frames.period_ns = refreshNs(g); var own: OwnView = .{ .g = g, .in = &in, .s = &shell, .pointer = drew }; @@ -1451,14 +1452,25 @@ fn clientSession(init: std.process.Init, g: *Gui, opts_in: pardes.Options, test_ if (link.dirty) { client.draw(&shell); drew = shell.presented; - } + } else if (again and shell.presented) if (shell.surface) |frame| { + // A blink, the window's own motion: the last frame again, + // moved on, as the session's own window draws it (pollFrame). + g.now_ns = shell.ownNow(); + shell.presented = renderFrame(g, gpa, core, frame) catch false; + drew = shell.presented; + }; + again = false; // The window's own motions (its glide, its caret, a jump's // trail) and its blink are on its clock: no unit need come. const minimized = !test_mode and c.SDL_GetWindowFlags(g.window) & (c.SDL_WINDOW_MINIMIZED | c.SDL_WINDOW_OCCLUDED) != 0; const moving = !minimized and frontendMoving(g); const blink = if (minimized or shell.surface == null) null else blinkNow(g, core.settings.cursor_blink); const predicting = r.echo.n > 0 or r.echo.cursor != null or r.echo.nd > 0; - var ms: c_int = if (test_mode) 16 else -1; + // A latency trace's feed paces the loop, as the session's own + // window's (waitInput): its poll on stdin is the wait, and SDL's, + // which polls a clock and a lock a millisecond at a time with + // the offscreen driver, is not waited too (a frame a loop more). + var ms: c_int = if (latency_fd >= 0) 0 else if (test_mode) 16 else -1; if (demoDue(g)) |due| ms = if (ms < 0) due else @min(ms, due); if (predicting or link.owed) ms = if (ms < 0) frame_ms else @min(ms, frame_ms); // A touchpad's fraction settling onto a row (scrollRows). @@ -1472,7 +1484,7 @@ fn clientSession(init: std.process.Init, g: *Gui, opts_in: pardes.Options, test_ }; if (link.quietCheck()) |wait| ms = if (ms < 0) @intCast(wait) else @min(ms, @as(c_int, @intCast(wait))); // Idle, its frame drawn: the next input needs no copy taken. - if (ms != 0) r.ready(); + if (ms != 0 or latency_fd >= 0) r.ready(); if (shell.surface != null) startGamepads(g); var sev = std.mem.zeroes(c.SDL_Event); g.input_seen = false; @@ -1489,12 +1501,18 @@ fn clientSession(init: std.process.Init, g: *Gui, opts_in: pardes.Options, test_ // Its draws done (api.draw: this window's own pictures). if (shell.takeDraws()) link.dirty = true; r.settle(); + // A rollback since it drew: drawn again, never moved on from + // cells the copy put back. + if (r.moved) { + r.moved = false; + link.dirty = true; + } if (titled and link.notice_len == 0) { titled = false; _ = c.SDL_SetWindowTitle(g.window, "pardes"); } if (link.owed or r.echo.changed) link.dirty = true; - if (moving or (blink != null and (blink.?.edge or timed_out))) link.dirty = true; + if (moving or (blink != null and (blink.?.edge or timed_out))) again = true; if (r.diverged != null) link.quit = true; } if (init.environ_map.get("PARDES_REPLICA_STATS")) |file| link.writeStats(file); |
