summaryrefslogtreecommitdiff
path: root/src/macos.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/macos.zig')
-rw-r--r--src/macos.zig33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/macos.zig b/src/macos.zig
index 9bbe3ac2..4d59fb90 100644
--- a/src/macos.zig
+++ b/src/macos.zig
@@ -829,6 +829,35 @@ export fn pardes_gui_tagline_font_percent() u8 {
return taglineFontPercent(if (state) |*st| st.core else null);
}
+/// Where that smaller band sits inside its body-sized row, and the rule between
+/// the topbar band and the first pane-tag band. Both answers come from the core
+/// rather than being reimplemented here, because a second copy of this geometry
+/// is exactly what left the native shell centring every band while the SDL
+/// shell joined them (`pardes.taglineBandOffset`).
+///
+/// PHYSICAL PIXELS, like the SDL shell's: a host working in points multiplies
+/// by its backing scale on the way in and divides on the way out, which is the
+/// same snapping it already does for the cell itself.
+export fn pardes_tagline_band_offset(row: u16, canvas_h: f32, cell_h: u32, tagline_h: u32) u32 {
+ return pardes.taglineBandOffset(row, canvas_h, cell_h, tagline_h);
+}
+
+export fn pardes_topbar_pane_border_px(cell_h: u32, tagline_h: u32) u32 {
+ return pardes.topbarPaneBorderPixels(cell_h, tagline_h);
+}
+
+/// Colour of that rule: the compiled override when a build pins one, otherwise
+/// the active theme's scrollbar track — the same resolution the SDL shell does
+/// at `src/gui/gui.zig:3813`. PARDES_COLOR_DEFAULT before there is a session to
+/// ask, which the host reads as "do not draw the rule yet".
+export fn pardes_topbar_pane_border_rgb() u32 {
+ const rgb = pardes.config.gui_topbar_pane_border_rgb orelse fromTheme: {
+ const st = state orelse return color_default;
+ break :fromTheme st.core.chromeTheme().scroll_track;
+ };
+ return @as(u32, rgb[0]) << 16 | @as(u32, rgb[1]) << 8 | rgb[2];
+}
+
test "tagline percent falls back before init and follows live core state" {
try std.testing.expectEqual(pardes.config.gui_tagline_font_percent, taglineFontPercent(null));
@@ -2142,6 +2171,9 @@ test "pardes.h declares every export the way it is defined" {
try expectSameAbi(@TypeOf(c.pardes_should_quit), @TypeOf(pardes_should_quit));
try expectSameAbi(@TypeOf(c.pardes_animating), @TypeOf(pardes_animating));
try expectSameAbi(@TypeOf(c.pardes_gui_tagline_font_percent), @TypeOf(pardes_gui_tagline_font_percent));
+ try expectSameAbi(@TypeOf(c.pardes_tagline_band_offset), @TypeOf(pardes_tagline_band_offset));
+ try expectSameAbi(@TypeOf(c.pardes_topbar_pane_border_px), @TypeOf(pardes_topbar_pane_border_px));
+ try expectSameAbi(@TypeOf(c.pardes_topbar_pane_border_rgb), @TypeOf(pardes_topbar_pane_border_rgb));
try expectSameAbi(@TypeOf(c.pardes_scene), @TypeOf(pardes_scene));
try expectSameAbi(@TypeOf(c.pardes_postprocessor_unavailable), @TypeOf(pardes_postprocessor_unavailable));
try expectSameAbi(@TypeOf(c.pardes_panel_animation_failed), @TypeOf(pardes_panel_animation_failed));
@@ -2216,6 +2248,7 @@ test "pardes.h matches the Zig boundary" {
try expectEqual(@as(u32, c.PARDES_COLOR_INDEXED), color_indexed);
try expectEqual(@as(u8, c.PARDES_CELL_DEFAULT), cell_flag_default);
try expectEqual(@as(u8, c.PARDES_CELL_TAGLINE), cell_flag_tagline);
+ try expectEqual(@as(u16, c.PARDES_TOPBAR_H), pardes.TOPBAR_H);
try expectEqual(@as(u32, c.PARDES_SCENE_CRT), scene_flag_crt);
try expectEqual(@as(u32, c.PARDES_SCENE_RIPPLE), scene_flag_ripple);
try expectEqual(@as(u32, c.PARDES_SCENE_GLITCH), scene_flag_glitch);