summaryrefslogtreecommitdiff
path: root/dev/tui
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-24 12:13:55 -0300
committerGabriel Schneider <[email protected]>2026-11-24 12:23:08 -0300
commit3b3264d4236ae5624a46e0119c77d9ff2148a6d1 (patch)
treebc9a881e7590a6c367b0fe1e50ae7608128ef1a8 /dev/tui
parentfe8d39e583cd19458727aa1caf01af3cc15abda6 (diff)
downloadpardes-3b3264d4236ae5624a46e0119c77d9ff2148a6d1.tar.gz
pardes-3b3264d4236ae5624a46e0119c77d9ff2148a6d1.zip
gui, tui: a run of pointer motions is one input, merged where the window's events become inputs (dispatch holds the last, Input.moved; Input.post posts it before whatever input comes next, a pass's end posts it), so the session's own window and a client's window, and every road into either (SDL's queue, the test feed, a finger's or a pad's posts after it), take motions the same way: the user's "resizing feels very slow with several clients" (2026-11-24): a client window fed every SDL event as an input (Client.wait), each a step of the session, a unit to every client and a frame of each; and the session's own window, with a client attached, held every motion after a wait's first for the next wait (Shell.split ran before waitInput's own merging loop), a wait, a pump, a unit and a frame a motion (the hunt's real window: 1652 motions in 0.35 s were 1655 frames of the session, 0.65 s behind the pointer); now split takes a motion after a motion as the same input, waitInput's merging loop is gone (its two dispatch loops are one, Shell.takeEvents), and a client feeds each input as it comes but a held motion, which goes with the next input or the pass's end (Client.feed flushes it); the tty session's own terminal had the same split (tui.zig: a second motion held before waitOnce's merge): split now lets a motion that goes on the wait's run through, by the merge's own test (movesOn); a terminal client's road merged already (its split is the session's only); --client-motion (300 motions a road, 30 bytes each, read 1024 bytes a pass: at most ten passes, each one input): a window client of a terminal's session 305 -> 14 inputs by the feed and 305 -> 14 by SDL's queue (the terminal client watching 765 -> 144 units over the run), the session's own window a drag with a terminal client attached 95 -> 9 frames (that client's draws 128 -> 13); Debug both ends, load 1.5-3
Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'dev/tui')
-rw-r--r--dev/tui/tui.zig19
1 files changed, 13 insertions, 6 deletions
diff --git a/dev/tui/tui.zig b/dev/tui/tui.zig
index f0011273..e2cdd2fa 100644
--- a/dev/tui/tui.zig
+++ b/dev/tui/tui.zig
@@ -1572,11 +1572,9 @@ const Shell = struct {
var motion: ?Msg = null;
var ev = first;
while (true) {
- if (s.split(ev)) break;
+ if (s.split(ev, motion)) break;
if (ev == .mouse and (ev.mouse.type == .motion or ev.mouse.type == .drag)) {
- if (motion) |m| if (m.mouse.button != ev.mouse.button or m.mouse.type != ev.mouse.type or
- @as(u3, @bitCast(m.mouse.mods)) != @as(u3, @bitCast(ev.mouse.mods)))
- {
+ if (motion) |m| if (!movesOn(m, ev)) {
_ = s.apply(m);
};
motion = ev;
@@ -1605,14 +1603,16 @@ const Shell = struct {
/// a person's input, and none after a pty's output: a step reads the
/// terminals as the clients' deltas bring them, sent after each unit
/// (docs/next-daemon.md, part B terminal notes). One that must wait is
- /// held for the next. Whether `ev` is.
- fn split(s: *Shell, ev: Msg) bool {
+ /// held for the next. Whether `ev` is; a motion that goes on this
+ /// wait's run of them (`streak`) is that one input, its last.
+ fn split(s: *Shell, ev: Msg, streak: ?Msg) bool {
if (!s.peers.recording) return false;
switch (ev) {
.key_press => if (s.in_paste) return false,
.mouse, .paste, .paste_end, .reply_dropped, .winsize, .focus_in, .focus_out => {},
else => return false,
}
+ if (streak) |m| if (movesOn(m, ev)) return false;
if (s.took_output or s.took_input) {
s.held = ev;
s.input_seen = true;
@@ -1622,6 +1622,13 @@ const Shell = struct {
return false;
}
+ /// Whether `ev` goes on the motion `streak`: one move to its last cell
+ /// (the same button, kind and modifiers).
+ fn movesOn(streak: Msg, ev: Msg) bool {
+ return ev == .mouse and ev.mouse.type == streak.mouse.type and ev.mouse.button == streak.mouse.button and
+ @as(u3, @bitCast(ev.mouse.mods)) == @as(u3, @bitCast(streak.mouse.mods));
+ }
+
fn apply(s: *Shell, event: Msg) bool {
const core = s.core;
const tz_event = tracy.zone(@src(), "event");