diff options
Diffstat (limited to 'src/gui/gui.zig')
| -rw-r--r-- | src/gui/gui.zig | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/src/gui/gui.zig b/src/gui/gui.zig index 3ed97f10..c7b52fc4 100644 --- a/src/gui/gui.zig +++ b/src/gui/gui.zig @@ -4484,7 +4484,7 @@ fn pollFrame(ctx: ?*anyopaque) void { const geom = windowCells(g); if (updateCoreResize(core, geom.cols, geom.rows, g.cell_w, g.cell_h, g.tagline_width, g.tagline_height)) resetScroll(g); stepScroll(g, core, s.gpa); - _ = s.shaders.sync(s.gpa, s.io, core, s.inotify_fd, s.watches, .{ .call = sdlWake }); + _ = s.shaders.sync(s.gpa, s.io, core, s.inotify_fd, s.watches, sdlWake); { var passes: [Post.max]ShaderBuild.Pass = undefined; g.post.sync(s.gpa, g.device, g.swapchain_format, s.shaders.view(&core.settings.post, &passes), s.shaders.revision, core); @@ -8959,7 +8959,7 @@ const luminance = pardes.colors.relativeLuminance; /// How dark a shadow may make the page and its text, both together, before /// the pair drops below its own contrast or 4.5, whichever is lower (ยง8.2): /// darkening in linear light by k leaves (k L1 + .05) / (k L2 + .05). -fn shadowCeiling(fg: [3]u8, bg: [3]u8) f32 { +pub fn shadowCeiling(fg: [3]u8, bg: [3]u8) f32 { const a = luminance(fg); const b = luminance(bg); const light = @max(a, b); @@ -9839,25 +9839,23 @@ fn gripDecor(g: *Gui, gpa: std.mem.Allocator, regions: []const pardes.Region, ce try addDecor(g, gpa, x1 - gap, y0 + gap, x1 - b, y1 - gap, band, 1, track, win_w, win_h); } } + // The marks are the first row's alone, where its cell is blank (no + // mode glyph), centered in the button, in its ink from the region's + // state. const x = grip.rect.x; - for (0..grip.rect.h) |line| { - const y = grip.rect.y + @as(u16, @intCast(line)); - if (x >= cols or y >= rows) continue; - const cell = &cells[@as(usize, y) * cols + x]; - if (cell.default or cell.printableAscii() != ' ') continue; - // The marks are in the button's ink, from the region's state. - const rgb = inkOn(gripFill(chrome, grip.active, grip.dirty)); - // The marks are the first row's alone, centered in the button. - if (line != 0) continue; - const center_x = @floor((button[0] + button[2]) / 2); - const center_y = @as(f32, @floatFromInt(y)) * layout.h + @as(f32, @floatFromInt(taglineBandOffset(y, win_h, g.cell_h, g.tagline_height))) + @as(f32, @floatFromInt(g.tagline_height)) / 2; - const half_w = @max(dp(1), @min(dp(3), @floor((button[2] - button[0] - 2 * dp(3)) / 2))); - // The mode's two bars: a logical pixel thick, a pixel either - // side of the middle. - const bar = dp(1); - try addDecor(g, gpa, @floor(center_x - half_w), @floor(center_y - bar - dp(1)), @floor(center_x + half_w), @floor(center_y - dp(1)), rgb, 1, track, win_w, win_h); - try addDecor(g, gpa, @floor(center_x - half_w), @floor(center_y + dp(1)), @floor(center_x + half_w), @floor(center_y + dp(1) + bar), rgb, 1, track, win_w, win_h); - } + const y = grip.rect.y; + if (x >= cols) continue; + const cell = &cells[@as(usize, y) * cols + x]; + if (cell.default or cell.printableAscii() != ' ') continue; + const rgb = inkOn(gripFill(chrome, grip.active, grip.dirty)); + const center_x = @floor((button[0] + button[2]) / 2); + const center_y = @as(f32, @floatFromInt(y)) * layout.h + @as(f32, @floatFromInt(taglineBandOffset(y, win_h, g.cell_h, g.tagline_height))) + @as(f32, @floatFromInt(g.tagline_height)) / 2; + const half_w = @max(dp(1), @min(dp(3), @floor((button[2] - button[0] - 2 * dp(3)) / 2))); + // The mode's two bars: a logical pixel thick, a pixel either side of + // the middle. + const bar = dp(1); + try addDecor(g, gpa, @floor(center_x - half_w), @floor(center_y - bar - dp(1)), @floor(center_x + half_w), @floor(center_y - dp(1)), rgb, 1, track, win_w, win_h); + try addDecor(g, gpa, @floor(center_x - half_w), @floor(center_y + dp(1)), @floor(center_x + half_w), @floor(center_y + dp(1) + bar), rgb, 1, track, win_w, win_h); } } |
