diff options
Diffstat (limited to 'src/gui')
| -rw-r--r-- | src/gui/gui.zig | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/src/gui/gui.zig b/src/gui/gui.zig index 3c2fd693..8da6f933 100644 --- a/src/gui/gui.zig +++ b/src/gui/gui.zig @@ -2422,6 +2422,7 @@ fn localSession( defer pardes.lsp.setStatusSink(null, null); while (!core.quit) { + pardes.turn.restoreSettled(); try core.pump(host); if (core.quit) break; // a session that ended does not restore into one if (core.takeAttach()) |req| { @@ -2465,7 +2466,7 @@ fn localSession( g.prepared_images.clearRetainingCapacity(); nc.native_images = true; nc.host = host; - if (fs) |f| f.reset(core); + if (fs) |f| f.reset(nc); core.deinit(); core = nc; shell.core = nc; @@ -2758,7 +2759,10 @@ const StdinFeed = struct { } var fds = [_]posix.pollfd{.{ .fd = 0, .events = posix.POLL.IN, .revents = 0 }}; - _ = posix.poll(&fds, 16) catch return out; + pardes.turn.rest(); + const polled = posix.poll(&fds, 16); + pardes.turn.wake(); + _ = polled catch return out; if ((fds[0].revents & posix.POLL.IN) == 0) { if ((fds[0].revents & (posix.POLL.HUP | posix.POLL.ERR)) != 0) out.eof = true; return out; @@ -3762,7 +3766,11 @@ fn waitInput(ctx: ?*anyopaque, timeout_ms: u32) void { if (s.gui) |g| { var sev = std.mem.zeroes(c.SDL_Event); const ms: c_int = if (timeout_ms != 0) @intCast(timeout_ms) else 16; - if (c.SDL_WaitEventTimeout(&sev, ms)) { + // The wait is the 9P connections' turn with the core. + pardes.turn.rest(); + const got = c.SDL_WaitEventTimeout(&sev, ms); + pardes.turn.wake(); + if (got) { dispatch(g, &in, &sev); while (c.SDL_PollEvent(&sev)) dispatch(g, &in, &sev); } @@ -3785,7 +3793,7 @@ fn pollFrame(ctx: ?*anyopaque) void { const s = shellOf(ctx); s.reconcilePtys(); const core = s.core; - if (s.fs) |f| if (f.tick(core).pending) s.queue.push(.fs_ready); + if (s.fs) |f| if (f.tick().pending) s.queue.push(.fs_ready); const g = s.gui orelse { if (core.settings.window_opacity_pending) { var unchanged_opacity: u8 = 100; @@ -3923,7 +3931,7 @@ fn gridPollFrame(ctx: ?*anyopaque) void { const s = shellOf(ctx); s.reconcilePtys(); if (s.fs) |f| { - if (f.tick(s.core).count != 0) s.saw_event = true; + if (f.tick().count != 0) s.saw_event = true; } pollCwds(s.core, s.ptys); if (s.core.animationActive()) { @@ -5077,6 +5085,13 @@ fn renderFrame( ); } } + // Body layers first: a notice chip over a tree-sitter context band + // is a tag layer, and instances paint in emission order. + for (surface.bodyLayers()) |*layer| { + if (layer.rows == 0) continue; + const batch_index = paintBatchAt(&paint_plan, layer.viewport.x, layer.viewport.y); + emitBodyLayer(g, instances, &cell_next[batch_index], layer, win_w, win_h, paint_plan.batches[batch_index].track, page, paint_plan.len == 1, false, topbar_pane_border_rgb); + } for (surface.tagLayers()) |*layer| { if (layer.cols == 0) continue; const batch_index = paintBatchAt(&paint_plan, layer.viewport.x, layer.viewport.y); @@ -5092,11 +5107,6 @@ fn renderFrame( emitTagLayer(g, instances, &cell_next[destination], layer, win_w, win_h, if (under) null else track, page, false, track.effect == .dissolve); } } - for (surface.bodyLayers()) |*layer| { - if (layer.rows == 0) continue; - const batch_index = paintBatchAt(&paint_plan, layer.viewport.x, layer.viewport.y); - emitBodyLayer(g, instances, &cell_next[batch_index], layer, win_w, win_h, paint_plan.batches[batch_index].track, page, paint_plan.len == 1, false, topbar_pane_border_rgb); - } for (paint_plan.batches[1..paint_plan.len], 1..) |batch, batch_index| { const track = batch.track.?; const under = track.effect == .vertical and track.phase == .opening; |
