summaryrefslogtreecommitdiff
path: root/dev
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-23 15:14:30 -0300
committerGabriel Schneider <[email protected]>2026-11-23 15:56:38 -0300
commit36dab7187fa0322c728848532638d549af02f746 (patch)
tree34614c46c9475b3e103e4e266e2b8d76262c0a69 /dev
parent62c6caf414fd5a2be556f76eb21d1d6d8d3beadb (diff)
downloadpardes-36dab7187fa0322c728848532638d549af02f746.tar.gz
pardes-36dab7187fa0322c728848532638d549af02f746.zip
upgrade: a window comes back from an Upgrade the size it had (the user's two windows went from 140 x 74 cells to 112 x 32 and from 343 columns to 193 at the 15:11 install): a window session's Upgrade is an exec, and its record said only that there was a window (runtime/upgrade.zig `Record.window`), so the new image made it the default 1120 x 720 points, or the `--geometry` it was started with (its arguments are passed again), never the size the user had given it since; now `upgradeNow` (dev/gui/gui.zig) puts the window's size in points as SDL_GetWindowSize says it then in the record, a line `size WxH` after `window 1` (`Record.size`), and the new image takes it as its `--geometry`, ahead of the one it was started with: the pair's road (a client window's PARDES_JOIN_SIZE, runtime/client.zig `execAgain`, read by the same parse), size only as the pair's (no place: an X11 window started at `+X+Y` is placed by the window manager after an Upgrade now); an older build's record has no such line (the word is passed over by a build before this one): the default, as before; a test window keeps a carried size over PARDES_TEST_COLS and ROWS; test: test/daemon.py `gui_upgrades` resizes the session's window to 100 x 30 cells (the test feed's in-band resize) before the Upgrade and reads the new image's first frame's size from its capture: on the base 1280x840 (80 x 24, the default) where it had been 1600x1050; now 1600x1050 from a build that writes the line, the default from one that does not (the record on the new process's command line says which), and upgrade.zig's record test reads the line back and an older record's none; core-test 934/1100 (166 skipped), shell-test 1142/1145 (3 skipped), gui unit-test 1739/1743 (4 skipped; its perf step's known BaselineHarnessMismatch), test/daemon.py `--upgrade --gui` between this tree's builds (Debug, unstamped and -Dstamp-commit: two semantics) 3/3 and from the installed build (62c6caf414fd) 3/3, `--upgrade` from it 1/1, plain 1/1
Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'dev')
-rw-r--r--dev/gui/gui.zig17
1 files changed, 14 insertions, 3 deletions
diff --git a/dev/gui/gui.zig b/dev/gui/gui.zig
index 76af0ec8..2756f69b 100644
--- a/dev/gui/gui.zig
+++ b/dev/gui/gui.zig
@@ -809,9 +809,12 @@ fn runNative(init: std.process.Init, opts_in: pardes.Options, detached: bool, di
var want_w: c_int = 1120;
var want_h: c_int = 720;
var want_at: ?[2]c_int = null;
- // ...or the size an Upgrade's exec says its window had (client.zig
+ // ...or the size an Upgrade's exec says its window had: a session's in
+ // its record (upgrade.zig `Record.size`), ahead of the `--geometry` it
+ // was started with, a client's in PARDES_JOIN_SIZE (client.zig
// `execAgain`).
- if (opts_in.geometry orelse if (std.c.getenv("PARDES_JOIN_SIZE")) |e| std.mem.span(e) else null) |spec| geometry: {
+ const kept = if (upgrade.resumed) |rec| rec.size else null;
+ if (kept orelse opts_in.geometry orelse if (std.c.getenv("PARDES_JOIN_SIZE")) |e| std.mem.span(e) else null) |spec| geometry: {
const x_at = std.mem.indexOfScalar(u8, spec, 'x') orelse break :geometry;
const plus = std.mem.indexOfAnyPos(u8, spec, x_at, "+-") orelse spec.len;
want_w = std.math.clamp(std.fmt.parseInt(c_int, spec[0..x_at], 10) catch break :geometry, 200, 16384);
@@ -881,7 +884,8 @@ fn runNative(init: std.process.Init, opts_in: pardes.Options, detached: bool, di
const cell_w: u32 = @intCast(@max(cw, 1));
const cell_h: u32 = @intCast(@max(chh, 1));
const tagline = taglineRaster(&atlas, px, cell_w, cell_h, config.gui_tagline_font_percent);
- if (test_mode) {
+ // An upgraded window keeps its size in a test too.
+ if (test_mode and kept == null) {
const cols = envU16(env, "PARDES_TEST_COLS") orelse 80;
const rows = envU16(env, "PARDES_TEST_ROWS") orelse 24;
// PARDES_TEST_PAD: extra pixels past the grid, as a real window has.
@@ -2535,6 +2539,13 @@ const Shell = struct {
// dials the session again once it is back.
s.peers.refuseAll(core);
var rec: upgrade.Record = .{ .link = daemon.link, .window = s.gui != null, .exe = path };
+ // Its window's size now, the new one's (the user's since its start).
+ var size_buf: [32]u8 = undefined;
+ if (s.gui) |g| {
+ var w: c_int = 0;
+ var h: c_int = 0;
+ if (c.SDL_GetWindowSize(g.window, &w, &h)) rec.size = std.fmt.bufPrint(&size_buf, "{d}x{d}", .{ w, h }) catch null;
+ }
s.ptys.record(&rec);
var at_buf: [1024:0]u8 = undefined;
const failed = upgrade.dumpInto(core, &rec, &at_buf, &why) orelse upgrade.execAs(s.gpa, path, &rec, &at_buf, s.fs, &why);