diff options
Diffstat (limited to 'core')
| -rw-r--r-- | core/Kind.zig | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/core/Kind.zig b/core/Kind.zig index 22a7ebe0..9316c502 100644 --- a/core/Kind.zig +++ b/core/Kind.zig @@ -39,7 +39,7 @@ pub const abi: u32 = c.PA_ABI; // records the core reads are the ones addons are built to. comptime { if (@sizeOf(usize) == 8) for (.{ - .{ c.pa_cell, 20 }, .{ c.pa_window, 24 }, .{ c.pa_rect, 16 }, .{ c.pa_cells, 8 }, + .{ c.pa_cell, 20 }, .{ c.pa_window, 32 }, .{ c.pa_rect, 16 }, .{ c.pa_cells, 8 }, .{ c.pa_placement, 80 }, .{ c.pa_paint, 48 }, .{ c.pa_key, 8 }, .{ c.pa_mouse, 16 }, .{ c.pa_api, 128 }, .{ c.pa_out, 16 }, .{ c.pa_word, 32 }, .{ c.pa_head, 56 }, .{ c.pa_ops, 208 }, .{ c.pa_view, 32 }, .{ c.pa_tick, 128 }, @@ -529,7 +529,8 @@ pub fn paint(p: *const Pardes, slot: *Slot, id: usize, arena: std.mem.Allocator, var gpu: GpuPaint = .{ .arena = arena, .frame = frame }; var out: c.pa_paint = std.mem.zeroInit(c.pa_paint, .{ .placements = &frame.buf, .cap = frame.buf.len, .gpu = GpuPaint.emit, .gpu_ctx = &gpu }); const px = p.view().cell_pixels; - const win = std.mem.zeroInit(c.pa_window, .{ .cells = cells.ptr, .stride = cols, .rows = rows, .cols = cols, .cell_w = px.w, .cell_h = px.h, .focused = @intFromBool(focusedAnywhere(p, id)), .view = p.live + 1, .glyphs = @intFromBool(!p.view().frontend.native_images) }); + const chrome = p.chrome(); + const win = std.mem.zeroInit(c.pa_window, .{ .cells = cells.ptr, .stride = cols, .rows = rows, .cols = cols, .cell_w = px.w, .cell_h = px.h, .focused = @intFromBool(focusedAnywhere(p, id)), .view = p.live + 1, .glyphs = @intFromBool(!p.view().frontend.native_images), .hit = rgb(chrome.hit), .hit_current = rgb(chrome.hit_current) }); var cl: Call = .{ .p = null, .id = id, .slot = slot, .quiet = true, .core = p }; const prev = cl.begin("paint"); const before = if (checked) usedHash(slot) else {}; @@ -803,11 +804,6 @@ pub fn viewOf(p: *const Pardes, k: u8, id: usize) c.pa_view { // derived, so a client joined from a dump has none. const notices = pardes.Messages.bands(p, pane, tag_rows, r).span(); const th = p.theme(); - const rgb = struct { - fn f(x: [3]u8) u32 { - return @as(u32, x[0]) << 16 | @as(u32, x[1]) << 8 | x[2]; - } - }.f; const policy = rasterPolicy(v.frontend.windowed); return .{ .cols = r.w -| pardes.config.GUTTER, @@ -827,6 +823,11 @@ pub fn viewOf(p: *const Pardes, k: u8, id: usize) c.pa_view { }; } +/// A theme's colour as the header's PA_RGB. +fn rgb(x: [3]u8) u32 { + return @as(u32, x[0]) << 16 | @as(u32, x[1]) << 8 | x[2]; +} + /// Whether pane `id` has the keyboard in some view (its window focused). fn focusedAnywhere(p: *const Pardes, id: usize) bool { for (&p.views) |*v| if (v.*) |*vw| if (vw.active == id and vw.window_focused) return true; |
