summaryrefslogtreecommitdiff
path: root/src/gui/gui.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/gui.zig')
-rw-r--r--src/gui/gui.zig32
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);