diff options
Diffstat (limited to 'dev/gui/gui.zig')
| -rw-r--r-- | dev/gui/gui.zig | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/dev/gui/gui.zig b/dev/gui/gui.zig index 59e70935..36243c71 100644 --- a/dev/gui/gui.zig +++ b/dev/gui/gui.zig @@ -1449,7 +1449,15 @@ fn clientSession(init: std.process.Init, g: *Gui, opts_in: pardes.Options, test_ std.Io.File.stderr().writeStreamingAll(io, std.fmt.bufPrint(&said, "pardes-gui: detached from '{s}', which is still running; come back with `pardes-gui attach {s}`\n", .{ to.session, to.session }) catch "pardes-gui: detached\n") catch {}; std.process.exit(0); }, - .ended => |code| std.process.exit(code), + .ended => |code| { + // A pair's window is its session's parent: its status once it + // is gone, as the terminal's (tui.zig `runClient`). + if (opts_in.pair != null) { + var status: c_int = 0; + while (libc.waitpid(@intCast(start.joined.pid), &status, 0) < 0 and libc.errno(-1) == .INTR) {} + } + std.process.exit(code); + }, } } @@ -1501,6 +1509,7 @@ const StdinFeed = struct { // so a driver exercises the real pointer path (pixel to cell, // tag and body hits). SGR mouse carries only cells. // finger;<kind>;<id>;<x>;<y>;<pressure> + // close: the window's close button // One the read cut short, or what may yet begin one, waits for // the next read. const rest = f.buf[seq_start..len]; @@ -1564,6 +1573,12 @@ const StdinFeed = struct { dispatch(gp, in, &sev); c.SDL_SetModState(before); } + } else if (std.mem.eql(u8, event[0..semi], "close")) { + if (g) |gp| { + var sev = std.mem.zeroes(c.SDL_Event); + sev.type = c.SDL_EVENT_WINDOW_CLOSE_REQUESTED; + dispatch(gp, in, &sev); + } } else if (std.mem.eql(u8, event[0..semi], "finger")) { if (parseFinger(fields)) |finger| if (g) |gp| { var wpw: c_int = 0; @@ -1744,6 +1759,8 @@ const Input = struct { fn close(in: *Input) void { if (in.client) |r| { + // Its bye says so: a pair's session ends at its last client's. + r.loop.link.close = true; r.loop.link.quit = true; in.quit = true; return; |
