summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gui/gui.zig11
-rw-r--r--src/panes.zig4
-rw-r--r--test/replicas.zig12
3 files changed, 22 insertions, 5 deletions
diff --git a/src/gui/gui.zig b/src/gui/gui.zig
index a8816494..4f6a58c2 100644
--- a/src/gui/gui.zig
+++ b/src/gui/gui.zig
@@ -1216,6 +1216,10 @@ const Client = struct {
inbox: std.ArrayListUnmanaged(replica.Said) = .empty,
taken: std.ArrayListUnmanaged(replica.Said) = .empty,
ended: bool = false,
+ /// The size the window last posted while its view is not that size
+ /// yet (the session has not taken it, or speculation stopped at it):
+ /// posted once, not again each pass while it waits.
+ posted: ?@FieldType(pardes.Event, "resize") = null,
fn deinit(cl: *Client) void {
cl.pending.deinit(cl.gpa);
@@ -1330,7 +1334,11 @@ const OwnView = struct {
if (scrollRows(g, v.in, v.s.gpa)) v.s.client.?.link.dirty = true;
if (fitTaglineFont(g, core.settings.font.tagline_percent)) v.s.client.?.link.dirty = true;
const geom = windowCells(g);
- if (resizeOf(core.view(), geom.cols, geom.rows, g.cell_w, g.cell_h, g.tagline_width, g.tagline_height)) |ev| v.in.post(ev);
+ const cl = v.s.client.?;
+ if (resizeOf(core.view(), geom.cols, geom.rows, g.cell_w, g.cell_h, g.tagline_width, g.tagline_height)) |ev| {
+ if (cl.posted == null or !std.meta.eql(cl.posted.?, ev.resize)) v.in.post(ev);
+ cl.posted = ev.resize;
+ } else cl.posted = null;
if (v.pointer) refreshPresentedPointer(g, v.in);
runDemo(g, v.in, core);
if (v.s.test_mode) {
@@ -1424,6 +1432,7 @@ fn clientSession(init: std.process.Init, g: *Gui, opts_in: pardes.Options, test_
g.hit_core = core;
frame_probe = &core.frames;
link.reset(r, &joined);
+ client.posted = null;
client.ended = false;
// ponytail: why it joined again is the window's title (and its
// log) until a key, where a terminal's client draws it over its
diff --git a/src/panes.zig b/src/panes.zig
index 237693fa..e9c9b1d3 100644
--- a/src/panes.zig
+++ b/src/panes.zig
@@ -945,7 +945,9 @@ pub const Pane = struct {
/// replica by its authority (the next delta says), on such an authority
/// once the step's unit is out (`resizeDeferred`).
pub fn resizeGrid(pane: *Pane, cols: u16, rows: u16) void {
- if (tape.authorityOnly("resize a terminal")) return;
+ // A screen-state client's speculation does what its replay does
+ // (its selections, never the grid): it waits for no round trip.
+ if (!tape.screenState() and tape.authorityOnly("resize a terminal")) return;
const state = pane.terminal orelse return;
if (cols != pane.cols) for (0..pane.sel.len) |button| {
pane.clearPointerSelection(button);
diff --git a/test/replicas.zig b/test/replicas.zig
index bd759b03..48ffe5d4 100644
--- a/test/replicas.zig
+++ b/test/replicas.zig
@@ -413,6 +413,8 @@ const Client = struct {
wake_at: u64 = 0,
drew: bool = false,
resize: ?pardes.Event = null,
+ /// gui.zig `Client.posted`: a size posted once while it waits.
+ posted: ?@FieldType(pardes.Event, "resize") = null,
resizes: u32 = 0,
fn present(ctx: ?*anyopaque, _: *const pardes.Surface) void {
@@ -453,9 +455,12 @@ const Client = struct {
if (cl.kind != .window) return;
cl.r.?.within(cl, own);
if (cl.resize) |ev| {
- cl.link.input(ev);
- cl.resizes += 1;
- }
+ if (cl.posted == null or !std.meta.eql(cl.posted.?, ev.resize)) {
+ cl.link.input(ev);
+ cl.resizes += 1;
+ }
+ cl.posted = ev.resize;
+ } else cl.posted = null;
cl.resize = null;
}
};
@@ -1050,6 +1055,7 @@ fn run(r: Run, dir: []const u8, totals: *Totals) !void {
if (c == 1) cl.link.test_diverge = 40;
}
cl.link.reset(rp, &j);
+ cl.posted = null;
// What it is, then its size, are its view's first inputs
// (the window's size from its own pass over its view).
cl.link.input(.{ .frontend = if (cl.kind == .window) .{ .windowed = true, .native_images = true, .native_image_patches = true } else .{ .windowed = false } });