summaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/macos.zig26
1 files changed, 12 insertions, 14 deletions
diff --git a/runtime/macos.zig b/runtime/macos.zig
index 7485f472..1b0ecd83 100644
--- a/runtime/macos.zig
+++ b/runtime/macos.zig
@@ -411,10 +411,6 @@ export fn pardes_deinit() void {
}
pardes.lsp.setStatusSink(null, null);
host_io.setExitWake(null, null);
- if (st.inbox.lsp_task) |*t| {
- t.future.cancel(st.io);
- st.inbox.lsp_task = null;
- }
st.pipe_tasks.cancelAll(st.io);
for (0..pardes.MAX_PANES) |pane| if (st.file_watches.entries[pane] != null) {
const id: u8 = @intCast(pane);
@@ -426,7 +422,7 @@ export fn pardes_deinit() void {
hostWatchFile(theme_watch_pane, generation, null, 0);
}
for (0..pardes.MAX_PANES) |pane| reap(st, @intCast(pane));
- st.inbox.close();
+ st.inbox.deinit();
st.file_watches.deinit(st.gpa);
if (st.cells.len > 0) st.gpa.free(st.cells);
for (st.layer_cells) |cells| st.gpa.free(cells);
@@ -847,6 +843,7 @@ export fn pardes_tick() bool {
did = did or drained.count != 0;
if (drained.pending) wake(st);
}
+ st.core.advance(@intCast(std.Io.Clock.awake.now(st.io).nanoseconds));
while (st.core.nextEffect()) |effect| {
did = true;
st.core.perform(effect);
@@ -912,17 +909,14 @@ export fn pardes_animation_tick() bool {
const st = &(state orelse return false);
const now: u64 = @intCast(std.Io.Clock.awake.now(st.io).nanoseconds);
+ st.core.advance(now);
const spend = spendTickTime(st.last_tick_ns, now, st.tick_bank_ns);
st.last_tick_ns = now;
st.tick_bank_ns = spend.bank_ns;
- var changed = false;
+ var changed = st.core.needs_frame;
for (0..spend.steps) |_| {
- if (st.core.animationActive()) {
- st.core.update(.tick);
- changed = true;
- }
if (st.scroll_coasting) {
const spent_now = spendScroll(
st,
@@ -1220,20 +1214,22 @@ fn clearFrame(st: *State) void {
fn blankTagCells(cells: []Cell, cols: u16, rows: u16, source: []const pardes.Cell, layers: []const pardes.Layer) void {
for (layers) |layer| {
if (layer.rows == 0 or layer.viewport.y >= rows or layer.viewport.x >= cols) continue;
- const start = @as(usize, layer.viewport.y) * cols + layer.viewport.x;
const count = @min(layer.viewport.w, cols - layer.viewport.x);
// The tag text is the layer's to draw. (The look-hover's glass
// rect went with the core's hover bit, stage 8's follow-up.)
_ = source;
- for (cells[start..][0..count]) |*cell| cell.* = encodeCell(.{});
+ for (layer.viewport.y..@min(rows, @as(usize, layer.viewport.y) + layer.rows)) |row| {
+ const start = row * cols + layer.viewport.x;
+ for (cells[start..][0..count]) |*cell| cell.* = encodeCell(.{});
+ }
}
}
fn tagCursorCovered(core: *const pardes.Pardes) bool {
const cursor = core.surface.cursor orelse return false;
for (core.surface.tag_layers) |layer| {
- if (layer.rows != 0 and cursor.y == layer.viewport.y and cursor.x >= layer.viewport.x and
- cursor.x - layer.viewport.x < layer.viewport.w) return true;
+ if (cursor.y >= layer.viewport.y and cursor.y - layer.viewport.y < layer.rows and
+ cursor.x >= layer.viewport.x and cursor.x - layer.viewport.x < layer.viewport.w) return true;
}
return false;
}
@@ -1402,6 +1398,7 @@ export fn pardes_tag_layer_value(index: u32, field: u32) u32 {
const st = &(state orelse return 0);
if (index >= pardes.MAX_TAG_LAYERS) return 0;
const layer = &st.core.surface.tag_layers[index];
+ if (layer.rows == 0) return 0;
return switch (field) {
0 => layer.cols,
1 => @backingInt(layer.kind),
@@ -1420,6 +1417,7 @@ export fn pardes_tag_layer_value(index: u32, field: u32) u32 {
const border = st.core.chrome().rule;
break :rgb @as(u32, border[0]) << 16 | @as(u32, border[1]) << 8 | border[2];
},
+ 13 => if (layer.cursor) |c| c.y else 65535,
else => 0,
};
}