diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-17 22:06:33 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-17 22:23:50 -0300 |
| commit | 920110be4c597b4b93fc2d38179c09b335186253 (patch) | |
| tree | fb5a3eaebb48b8c52ec0e23540e5065d940995d0 /src/gui | |
| parent | 7d10ad68b07a7bbab23fa8565d39183e4387c478 (diff) | |
| download | pardes-920110be4c597b4b93fc2d38179c09b335186253.tar.gz pardes-920110be4c597b4b93fc2d38179c09b335186253.zip | |
words: a session with no frontend of its own is `detached` in the code, one word for what was `headless`, `parked`, `alone_unattended`, `Term.none` and `!attached()` (PARDES.md ruling 1): main.zig's and gui.zig's `headless` (run, runNative, localSession) are `detached`, tui.zig's `Term.none` is `Term.detached`, the window's `Shell.parked` (its Gui kept while detached) is `Shell.detached`, `replica.Peers.alone_unattended` is `Peers.detached`, and the terminal's `Shell.attached()` is `Shell.detached()`, its five callers and `watched` negated to match (a test's Shell with no screen is not detached, as it was attached); the tape's `headless`, a replica core that skips `render` and the host calls inside it (set on every client), is `skips_render`, its replay run named `skips-render` ("replay X: skips-render replica: N digests agree"), and the two that read that line follow (test/tty.zig's other-build replay, test/cross_replay.py); NOT renamed, a different fact: `Core.unattended` (detached AND no client: nobody looks), a watched field on the tape by index; names only, no logic moved; tui core-test 811/950 (139 skipped), shell-test 993/996, behaviour-test 269/273 (the four addon ABI tests the base fails) and the same with --replay, process-test 2 of 144 failed (lspcomplete and lspcompletemoved, the base's), replicas pass (checked/wrong 0), daemon.py main passes; gui frame corpus 77/77 byte-identical against mbase, unit-test 1582/1590 (the base's 8 failures)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'src/gui')
| -rw-r--r-- | src/gui/gui.zig | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/gui/gui.zig b/src/gui/gui.zig index 863bb81e..2df408e8 100644 --- a/src/gui/gui.zig +++ b/src/gui/gui.zig @@ -762,8 +762,8 @@ fn coverFrame(cover: []Cover, cols: u16, rows: u16, body_layers: []const pardes. }; } -pub fn run(init: std.process.Init, opts: pardes.Options, headless: bool) !void { - return runNative(init, opts, headless, null); +pub fn run(init: std.process.Init, opts: pardes.Options, detached: bool) !void { + return runNative(init, opts, detached, null); } /// `pardes-gui --attach=<socket>:<session>` (and `<host>:<session>`, @@ -775,7 +775,7 @@ pub fn runClient(init: std.process.Init, opts: pardes.Options, path: []const u8, const Dial = struct { path: []const u8, session: []const u8, far: bool }; -fn runNative(init: std.process.Init, opts_in: pardes.Options, headless: bool, dial: ?Dial) !void { +fn runNative(init: std.process.Init, opts_in: pardes.Options, detached: bool, dial: ?Dial) !void { const gpa = init.gpa; const env = init.environ_map; @@ -826,7 +826,7 @@ fn runNative(init: std.process.Init, opts_in: pardes.Options, headless: bool, di if (surface_opacity) win_flags |= c.SDL_WINDOW_TRANSPARENT; const reopen_flags = win_flags; // `--detach`: a window never shown, closed once the session is up. - if (headless) win_flags |= c.SDL_WINDOW_HIDDEN; + if (detached) win_flags |= c.SDL_WINDOW_HIDDEN; // `--geometry=WxH[+X+Y]`, as X11 programs take it. var want_w: c_int = 1120; var want_h: c_int = 720; @@ -964,7 +964,7 @@ fn runNative(init: std.process.Init, opts_in: pardes.Options, headless: bool, di if (!test_mode and !c.SDL_SetWindowHitTest(window, hitTest, &g)) log.warn("SDL_SetWindowHitTest: {s}", .{c.SDL_GetError()}); if (dial) |to| return clientSession(init, &g, opts_in, test_mode, to); - try localSession(init, &g, opts_in, test_mode, headless); + try localSession(init, &g, opts_in, test_mode, detached); } /// Detach: the window closed (and with it its swapchain or renderer); the @@ -1004,7 +1004,7 @@ fn localSession( g: *Gui, opts_in: pardes.Options, test_mode: bool, - headless: bool, + detached: bool, ) !void { const io = init.io; const gpa = init.gpa; @@ -1104,7 +1104,7 @@ fn localSession( frame_capture_dir = if (std.c.getenv("PARDES_FRAMES_CAPTURE")) |dir| std.mem.span(dir) else null; const host = shell.host(); core.host = host; - shell.peers = .{ .gpa = gpa, .io = io, .name = daemon.name(), .wake = sdlWake, .alone_unattended = headless }; + shell.peers = .{ .gpa = gpa, .io = io, .name = daemon.name(), .wake = sdlWake, .detached = detached }; defer shell.peers.deinit(); // Before the core goes: each client sees its link end. defer shell.peers.dropAll(shell.core); @@ -1127,7 +1127,7 @@ fn localSession( _ = c.SDL_StartTextInput(g.window); // An upgraded session's window, its view's again. - if (upgrade.resumed) |*rec| if (!rec.fresh and !headless) shell.resumeWindow(); + if (upgrade.resumed) |*rec| if (!rec.fresh and !detached) shell.resumeWindow(); if (test_mode) setStdinRaw() catch {}; shell.threads_ok = true; @@ -1135,7 +1135,7 @@ fn localSession( defer pardes.lsp.setStatusSink(null, null); host_io.setExitWake(&queue, Queue.wakeForExit); defer host_io.setExitWake(null, null); - if (headless) { + if (detached) { shell.closeTheWindow(); // Nothing else may wake the first wait. daemon.watch(&shell, deliverNote); @@ -2378,10 +2378,10 @@ fn pollGamepad(g: *Gui, in: *Input) void { const Shell = struct { core: *pardes.Pardes, - /// The window's, while one is open; null while detached (`parked` has + /// The window's, while one is open; null while detached (`detached` has /// it). gui: ?*Gui = null, - parked: ?*Gui = null, + detached: ?*Gui = null, /// Shells a dead session left (Adopt), each waiting for the spawn of /// the terminal pane made for it. adoptions: host_io.Adoptions = .{}, @@ -2521,25 +2521,25 @@ const Shell = struct { fn closeTheWindow(s: *Shell) void { const g = s.gui orelse return; closeWindow(g); - s.parked = g; + s.detached = g; s.gui = null; s.presented = false; s.surface = null; // Its clients look at it still (Peers keeps it attended). - s.peers.alone_unattended = true; + s.peers.detached = true; s.core.unattended = s.peers.count() == 0; daemon.setState(true); } fn openTheWindow(s: *Shell) void { - const g = s.parked orelse return; + const g = s.detached orelse return; if (!reopenWindow(g)) { log.err("--attach: no window: {s}", .{c.SDL_GetError()}); return daemon.setState(true); } s.gui = g; - s.parked = null; - s.peers.alone_unattended = false; + s.detached = null; + s.peers.detached = false; s.core.unattended = false; s.core.needs_frame = true; resetScroll(g); |
