This commit is contained in:
Mitchell Hashimoto
2025-03-11 14:33:33 -07:00
parent 95daca616d
commit 7e2286eb8c
56 changed files with 288 additions and 290 deletions

View File

@ -3,7 +3,7 @@ const builtin = @import("builtin");
const buildpkg = @import("src/build/main.zig"); const buildpkg = @import("src/build/main.zig");
comptime { comptime {
buildpkg.requireZig("0.13.0"); buildpkg.requireZig("0.14.0");
} }
pub fn build(b: *std.Build) !void { pub fn build(b: *std.Build) !void {
@ -50,7 +50,7 @@ pub fn build(b: *std.Build) !void {
// As such, these build steps are lacking. For example, the Darwin // As such, these build steps are lacking. For example, the Darwin
// build only produces an xcframework. // build only produces an xcframework.
if (config.app_runtime == .none) { if (config.app_runtime == .none) {
if (config.target.result.isDarwin()) darwin: { if (config.target.result.os.tag.isDarwin()) darwin: {
if (!config.emit_xcframework) break :darwin; if (!config.emit_xcframework) break :darwin;
// Build the xcframework // Build the xcframework

View File

@ -1,35 +1,36 @@
.{ .{
.name = "ghostty", .name = .ghostty,
.version = "1.1.3", .version = "1.1.3",
.paths = .{""}, .paths = .{""},
.fingerprint = 0x64407a2a0b4147e5,
.dependencies = .{ .dependencies = .{
// Zig libs // Zig libs
.libxev = .{ .libxev = .{
// mitchellh/libxev // mitchellh/libxev
.url = "https://github.com/mitchellh/libxev/archive/8943932a668f338cb2c500f6e1a7396bacd8b55d.tar.gz", .url = "https://github.com/mitchellh/libxev/archive/3df9337a9e84450a58a2c4af434ec1a036f7b494.tar.gz",
.hash = "1220a67b584c9499154de8c96851ed8e92315452cb2027c06e2d7d07a39c6f900d1a", .hash = "1220db2cfd2f8a1527d4c86cc4d298e0624481ae8112bee8c87a73baee0746797d66",
}, },
.mach_glfw = .{ .mach_glfw = .{
// mitchellh/mach-glfw // mitchellh/mach-glfw
.url = "https://deps.files.ghostty.org/mach_glfw-12206ed982e709e565d536ce930701a8c07edfd2cfdce428683f3f2a601d37696a62.tar.gz", .url = "https://github.com/mitchellh/mach-glfw/archive/112fc46340f5c8527e072e442e0375004303e82b.zip",
.hash = "12206ed982e709e565d536ce930701a8c07edfd2cfdce428683f3f2a601d37696a62", .hash = "12206ed982e709e565d536ce930701a8c07edfd2cfdce428683f3f2a601d37696a63",
.lazy = true, .lazy = true,
}, },
.vaxis = .{ .vaxis = .{
// rockorager/libvaxis // rockorager/libvaxis
.url = "git+https://github.com/rockorager/libvaxis#2237a7059eae99e9f132dd5acd1555e49d6c7d93", .url = "git+https://github.com/rockorager/libvaxis#1e24e0dfb509e974e1c8713bcd119d0ae032a8c7",
.hash = "1220f5aec880d4f430cc1597ede88f1530da69e39a4986080e976b0c7b919c2ebfeb", .hash = "vaxis-0.1.0-BWNV_MHyCAARemSCSwwc3sA1etNgv7ge0BCIXspX6CZv",
}, },
.z2d = .{ .z2d = .{
// vancluever/z2d // vancluever/z2d
.url = "https://deps.files.ghostty.org/z2d-12201f0d542e7541cf492a001d4d0d0155c92f58212fbcb0d224e95edeba06b5416a.tar.gz", .url = "https://github.com/vancluever/z2d/archive/03f6ef642e696dce8c6019d4365234d9538eea5d.tar.gz",
.hash = "12201f0d542e7541cf492a001d4d0d0155c92f58212fbcb0d224e95edeba06b5416a", .hash = "z2d-0.1.0-AAAAAMz7BwCFCN76WmSoRhlTe8ZOgPMmG44AyXxBEpHs",
}, },
.zig_objc = .{ .zig_objc = .{
// mitchellh/zig-objc // mitchellh/zig-objc
.url = "https://deps.files.ghostty.org/zig_objc-1220e17e64ef0ef561b3e4b9f3a96a2494285f2ec31c097721bf8c8677ec4415c634.tar.gz", .url = "https://github.com/mitchellh/zig-objc/archive/2329503f692fd5c8ff4c0528b066a22c40dc58e8.tar.gz",
.hash = "1220e17e64ef0ef561b3e4b9f3a96a2494285f2ec31c097721bf8c8677ec4415c634", .hash = "1220458700f3a8319286715099ec64a787c77124da7c0f52fcbae13c40beeab8fe58",
}, },
.zig_js = .{ .zig_js = .{
// mitchellh/zig-js // mitchellh/zig-js
@ -42,13 +43,13 @@
}, },
.zig_wayland = .{ .zig_wayland = .{
// codeberg ifreund/zig-wayland // codeberg ifreund/zig-wayland
.url = "https://deps.files.ghostty.org/zig-wayland-fbfe3b4ac0b472a27b1f1a67405436c58cbee12d.tar.gz", .url = "https://codeberg.org/ifreund/zig-wayland/archive/f3c5d503e540ada8cbcb056420de240af0c094f7.tar.gz",
.hash = "12209ca054cb1919fa276e328967f10b253f7537c4136eb48f3332b0f7cf661cad38", .hash = "1220a686142edf1174287fbde3e4f378c5cea9f9cfd3e0e0e96cb2bcde0e9d5dcaa8",
}, },
.zf = .{ .zf = .{
// natecraddock/zf // natecraddock/zf
.url = "https://deps.files.ghostty.org/zf-1220edc3b8d8bedbb50555947987e5e8e2f93871ca3c8e8d4cc8f1377c15b5dd35e8.tar.gz", .url = "https://github.com/natecraddock/zf/archive/03176fcf23fda543cc02a8675e92c1fe3b1ee2eb.tar.gz",
.hash = "1220edc3b8d8bedbb50555947987e5e8e2f93871ca3c8e8d4cc8f1377c15b5dd35e8", .hash = "zf-0.10.3-OIRy8bKIAACV6JaNNncXA68Nw2BUAD9JVfQdzjyoZQ-J",
}, },
.gobject = .{ .gobject = .{
// ianprime0509/zig-gobject // ianprime0509/zig-gobject

6
flake.lock generated
View File

@ -102,11 +102,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1738239110, "lastModified": 1741702955,
"narHash": "sha256-Y5i9mQ++dyIQr+zEPNy+KIbc5wjPmfllBrag3cHZgcE=", "narHash": "sha256-Emk3VnNByigCBlBN34IH2cMrsUqIhdex02uw9TSDsN0=",
"owner": "mitchellh", "owner": "mitchellh",
"repo": "zig-overlay", "repo": "zig-overlay",
"rev": "1a8fb6f3a04724519436355564b95fce5e272504", "rev": "1152ce759114a94134081270affd970ae1b957ed",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -49,7 +49,7 @@
pkgs-unstable = nixpkgs-unstable.legacyPackages.${system}; pkgs-unstable = nixpkgs-unstable.legacyPackages.${system};
in { in {
devShell.${system} = pkgs-stable.callPackage ./nix/devShell.nix { devShell.${system} = pkgs-stable.callPackage ./nix/devShell.nix {
zig = zig.packages.${system}."0.13.0"; zig = zig.packages.${system}."0.14.0";
wraptest = pkgs-stable.callPackage ./nix/wraptest.nix {}; wraptest = pkgs-stable.callPackage ./nix/wraptest.nix {};
zig2nix = zig2nix; zig2nix = zig2nix;
}; };

View File

@ -1,5 +1,7 @@
.{ .{
.name = "apple-sdk", .name = .apple_sdk,
.version = "0.1.0", .version = "0.1.0",
.dependencies = .{}, .dependencies = .{},
.fingerprint = 0xdde52860f7c464d2,
.paths = .{""},
} }

View File

@ -14,9 +14,9 @@ pub fn build(b: *std.Build) !void {
lib.linkLibCpp(); lib.linkLibCpp();
lib.addIncludePath(upstream.path("src")); lib.addIncludePath(upstream.path("src"));
lib.addIncludePath(b.path("vendor")); lib.addIncludePath(b.path("vendor"));
if (target.result.isDarwin()) { if (target.result.os.tag.isDarwin()) {
const apple_sdk = @import("apple_sdk"); const apple_sdk = @import("apple_sdk");
try apple_sdk.addPaths(b, &lib.root_module); try apple_sdk.addPaths(b, lib.root_module);
} }
var flags = std.ArrayList([]const u8).init(b.allocator); var flags = std.ArrayList([]const u8).init(b.allocator);
@ -29,7 +29,7 @@ pub fn build(b: *std.Build) !void {
.flags = flags.items, .flags = flags.items,
}); });
if (target.result.isDarwin()) { if (target.result.os.tag.isDarwin()) {
lib.addCSourceFiles(.{ lib.addCSourceFiles(.{
.root = upstream.path(""), .root = upstream.path(""),
.files = common_apple, .files = common_apple,

View File

@ -76,9 +76,9 @@ pub fn build(b: *std.Build) !void {
.flags = flags.items, .flags = flags.items,
}); });
if (target.result.isDarwin()) { if (target.result.os.tag.isDarwin()) {
if (!target.query.isNative()) { if (!target.query.isNative()) {
try @import("apple_sdk").addPaths(b, &lib.root_module); try @import("apple_sdk").addPaths(b, lib.root_module);
try @import("apple_sdk").addPaths(b, module); try @import("apple_sdk").addPaths(b, module);
} }
lib.addCSourceFile(.{ lib.addCSourceFile(.{

View File

@ -69,9 +69,9 @@ fn buildLib(b: *std.Build, module: *std.Build.Module, options: anytype) !*std.Bu
}); });
lib.linkLibC(); lib.linkLibC();
lib.addIncludePath(upstream.path("include")); lib.addIncludePath(upstream.path("include"));
if (target.result.isDarwin()) { if (target.result.os.tag.isDarwin()) {
const apple_sdk = @import("apple_sdk"); const apple_sdk = @import("apple_sdk");
try apple_sdk.addPaths(b, &lib.root_module); try apple_sdk.addPaths(b, lib.root_module);
} }
module.addIncludePath(upstream.path("include")); module.addIncludePath(upstream.path("include"));

View File

@ -16,7 +16,7 @@ pub fn build(b: *std.Build) !void {
module.addIncludePath(upstream.path("")); module.addIncludePath(upstream.path(""));
module.addIncludePath(b.path("override")); module.addIncludePath(b.path("override"));
if (target.result.isDarwin()) { if (target.result.os.tag.isDarwin()) {
const apple_sdk = @import("apple_sdk"); const apple_sdk = @import("apple_sdk");
try apple_sdk.addPaths(b, module); try apple_sdk.addPaths(b, module);
} }
@ -53,9 +53,9 @@ fn buildGlslang(
lib.linkLibCpp(); lib.linkLibCpp();
lib.addIncludePath(upstream.path("")); lib.addIncludePath(upstream.path(""));
lib.addIncludePath(b.path("override")); lib.addIncludePath(b.path("override"));
if (target.result.isDarwin()) { if (target.result.os.tag.isDarwin()) {
const apple_sdk = @import("apple_sdk"); const apple_sdk = @import("apple_sdk");
try apple_sdk.addPaths(b, &lib.root_module); try apple_sdk.addPaths(b, lib.root_module);
} }
var flags = std.ArrayList([]const u8).init(b.allocator); var flags = std.ArrayList([]const u8).init(b.allocator);

View File

@ -1,6 +1,7 @@
.{ .{
.name = "gtk4-layer-shell", .name = .gtk4_layer_shell,
.version = "1.1.0", .version = "1.1.0",
.fingerprint = 0x4b96f9483c6feeb1,
.paths = .{""}, .paths = .{""},
.dependencies = .{ .dependencies = .{
.gtk4_layer_shell = .{ .gtk4_layer_shell = .{

View File

@ -95,8 +95,8 @@ fn buildLib(b: *std.Build, module: *std.Build.Module, options: anytype) !*std.Bu
lib.addIncludePath(upstream.path("src")); lib.addIncludePath(upstream.path("src"));
module.addIncludePath(upstream.path("src")); module.addIncludePath(upstream.path("src"));
if (target.result.isDarwin()) { if (target.result.os.tag.isDarwin()) {
try apple_sdk.addPaths(b, &lib.root_module); try apple_sdk.addPaths(b, lib.root_module);
try apple_sdk.addPaths(b, module); try apple_sdk.addPaths(b, module);
} }

View File

@ -21,9 +21,9 @@ pub fn build(b: *std.Build) !void {
lib.addIncludePath(upstream.path("")); lib.addIncludePath(upstream.path(""));
module.addIncludePath(upstream.path("")); module.addIncludePath(upstream.path(""));
if (target.result.isDarwin()) { if (target.result.os.tag.isDarwin()) {
const apple_sdk = @import("apple_sdk"); const apple_sdk = @import("apple_sdk");
try apple_sdk.addPaths(b, &lib.root_module); try apple_sdk.addPaths(b, lib.root_module);
try apple_sdk.addPaths(b, module); try apple_sdk.addPaths(b, module);
} }

View File

@ -42,9 +42,9 @@ pub fn build(b: *std.Build) !void {
lib.addIncludePath(upstream.path("gettext-runtime/intl")); lib.addIncludePath(upstream.path("gettext-runtime/intl"));
lib.addIncludePath(upstream.path("gettext-runtime/intl/gnulib-lib")); lib.addIncludePath(upstream.path("gettext-runtime/intl/gnulib-lib"));
if (target.result.isDarwin()) { if (target.result.os.tag.isDarwin()) {
const apple_sdk = @import("apple_sdk"); const apple_sdk = @import("apple_sdk");
try apple_sdk.addPaths(b, &lib.root_module); try apple_sdk.addPaths(b, lib.root_module);
} }
lib.addCSourceFiles(.{ lib.addCSourceFiles(.{

View File

@ -15,9 +15,9 @@ pub fn build(b: *std.Build) !void {
if (target.result.os.tag == .linux) { if (target.result.os.tag == .linux) {
lib.linkSystemLibrary("m"); lib.linkSystemLibrary("m");
} }
if (target.result.isDarwin()) { if (target.result.os.tag.isDarwin()) {
const apple_sdk = @import("apple_sdk"); const apple_sdk = @import("apple_sdk");
try apple_sdk.addPaths(b, &lib.root_module); try apple_sdk.addPaths(b, lib.root_module);
} }
// For dynamic linking, we prefer dynamic linking and to search by // For dynamic linking, we prefer dynamic linking and to search by

View File

@ -66,7 +66,7 @@ pub fn build(b: *std.Build) !void {
// it to the `LIBXML_{field}_ENABLED` C define where field is uppercased. // it to the `LIBXML_{field}_ENABLED` C define where field is uppercased.
inline for (std.meta.fields(Options)) |field| { inline for (std.meta.fields(Options)) |field| {
const opt = b.option(bool, field.name, "Configure flag") orelse const opt = b.option(bool, field.name, "Configure flag") orelse
@as(*const bool, @ptrCast(field.default_value.?)).*; @as(*const bool, @ptrCast(field.default_value_ptr.?)).*;
if (opt) { if (opt) {
var nameBuf: [32]u8 = undefined; var nameBuf: [32]u8 = undefined;
const name = std.ascii.upperString(&nameBuf, field.name); const name = std.ascii.upperString(&nameBuf, field.name);

View File

@ -38,7 +38,7 @@ pub fn build(b: *std.Build) !void {
module.linkFramework("Carbon", .{}); module.linkFramework("Carbon", .{});
} }
if (target.result.isDarwin()) { if (target.result.os.tag.isDarwin()) {
module.linkFramework("CoreFoundation", .{}); module.linkFramework("CoreFoundation", .{});
module.linkFramework("CoreGraphics", .{}); module.linkFramework("CoreGraphics", .{});
module.linkFramework("CoreText", .{}); module.linkFramework("CoreText", .{});
@ -46,7 +46,7 @@ pub fn build(b: *std.Build) !void {
module.linkFramework("QuartzCore", .{}); module.linkFramework("QuartzCore", .{});
if (!target.query.isNative()) { if (!target.query.isNative()) {
try apple_sdk.addPaths(b, &lib.root_module); try apple_sdk.addPaths(b, lib.root_module);
try apple_sdk.addPaths(b, module); try apple_sdk.addPaths(b, module);
} }
} }

View File

@ -68,9 +68,9 @@ fn buildLib(b: *std.Build, module: *std.Build.Module, options: anytype) !*std.Bu
lib.addIncludePath(upstream.path("src")); lib.addIncludePath(upstream.path("src"));
module.addIncludePath(upstream.path("src")); module.addIncludePath(upstream.path("src"));
if (target.result.isDarwin()) { if (target.result.os.tag.isDarwin()) {
const apple_sdk = @import("apple_sdk"); const apple_sdk = @import("apple_sdk");
try apple_sdk.addPaths(b, &lib.root_module); try apple_sdk.addPaths(b, lib.root_module);
} }
lib.addConfigHeader(b.addConfigHeader(.{ lib.addConfigHeader(b.addConfigHeader(.{
@ -88,10 +88,10 @@ fn buildLib(b: *std.Build, module: *std.Build.Module, options: anytype) !*std.Bu
.HAVE_SYS_TYPES_H = true, .HAVE_SYS_TYPES_H = true,
.HAVE_UNISTD_H = true, .HAVE_UNISTD_H = true,
.HAVE_INTTYPES_H = true, .HAVE_INTTYPES_H = true,
.SIZEOF_INT = t.c_type_byte_size(.int), .SIZEOF_INT = t.cTypeByteSize(.int),
.SIZEOF_LONG = t.c_type_byte_size(.long), .SIZEOF_LONG = t.cTypeByteSize(.long),
.SIZEOF_LONG_LONG = t.c_type_byte_size(.longlong), .SIZEOF_LONG_LONG = t.cTypeByteSize(.longlong),
.SIZEOF_VOIDP = t.ptrBitWidth() / t.c_type_bit_size(.char), .SIZEOF_VOIDP = t.ptrBitWidth() / t.cTypeByteSize(.char),
})); }));
var flags = std.ArrayList([]const u8).init(b.allocator); var flags = std.ArrayList([]const u8).init(b.allocator);

View File

@ -23,9 +23,9 @@ pub fn build(b: *std.Build) !void {
lib.linkLibC(); lib.linkLibC();
lib.addIncludePath(upstream.path("include")); lib.addIncludePath(upstream.path("include"));
lib.addIncludePath(upstream.path("src")); lib.addIncludePath(upstream.path("src"));
if (target.result.isDarwin()) { if (target.result.os.tag.isDarwin()) {
const apple_sdk = @import("apple_sdk"); const apple_sdk = @import("apple_sdk");
try apple_sdk.addPaths(b, &lib.root_module); try apple_sdk.addPaths(b, lib.root_module);
try apple_sdk.addPaths(b, module); try apple_sdk.addPaths(b, module);
} }

View File

@ -12,9 +12,9 @@ pub fn build(b: *std.Build) !void {
lib.linkLibCpp(); lib.linkLibCpp();
lib.addIncludePath(b.path("vendor")); lib.addIncludePath(b.path("vendor"));
if (target.result.isDarwin()) { if (target.result.os.tag.isDarwin()) {
const apple_sdk = @import("apple_sdk"); const apple_sdk = @import("apple_sdk");
try apple_sdk.addPaths(b, &lib.root_module); try apple_sdk.addPaths(b, lib.root_module);
} }
var flags = std.ArrayList([]const u8).init(b.allocator); var flags = std.ArrayList([]const u8).init(b.allocator);

View File

@ -42,9 +42,9 @@ fn buildSpirvCross(
}); });
lib.linkLibC(); lib.linkLibC();
lib.linkLibCpp(); lib.linkLibCpp();
if (target.result.isDarwin()) { if (target.result.os.tag.isDarwin()) {
const apple_sdk = @import("apple_sdk"); const apple_sdk = @import("apple_sdk");
try apple_sdk.addPaths(b, &lib.root_module); try apple_sdk.addPaths(b, lib.root_module);
} }
var flags = std.ArrayList([]const u8).init(b.allocator); var flags = std.ArrayList([]const u8).init(b.allocator);

View File

@ -1,6 +1,7 @@
.{ .{
.name = "spirv-cross", .name = .spirv_cross,
.version = "13.1.1", .version = "13.1.1",
.fingerprint = 0x7ea1d8312b06cca,
.paths = .{""}, .paths = .{""},
.dependencies = .{ .dependencies = .{
// KhronosGroup/SPIRV-Cross // KhronosGroup/SPIRV-Cross

View File

@ -14,9 +14,9 @@ pub fn build(b: *std.Build) !void {
lib.linkLibCpp(); lib.linkLibCpp();
lib.addIncludePath(upstream.path("")); lib.addIncludePath(upstream.path(""));
if (target.result.isDarwin()) { if (target.result.os.tag.isDarwin()) {
const apple_sdk = @import("apple_sdk"); const apple_sdk = @import("apple_sdk");
try apple_sdk.addPaths(b, &lib.root_module); try apple_sdk.addPaths(b, lib.root_module);
} }
var flags = std.ArrayList([]const u8).init(b.allocator); var flags = std.ArrayList([]const u8).init(b.allocator);

View File

@ -13,7 +13,7 @@ pub fn build(b: *std.Build) !void {
.link_libc = true, .link_libc = true,
}); });
if (target.result.isDarwin()) { if (target.result.os.tag.isDarwin()) {
const apple_sdk = @import("apple_sdk"); const apple_sdk = @import("apple_sdk");
try apple_sdk.addPaths(b, module); try apple_sdk.addPaths(b, module);
} }

View File

@ -13,9 +13,9 @@ pub fn build(b: *std.Build) !void {
}); });
lib.linkLibC(); lib.linkLibC();
lib.addIncludePath(upstream.path("")); lib.addIncludePath(upstream.path(""));
if (target.result.isDarwin()) { if (target.result.os.tag.isDarwin()) {
const apple_sdk = @import("apple_sdk"); const apple_sdk = @import("apple_sdk");
try apple_sdk.addPaths(b, &lib.root_module); try apple_sdk.addPaths(b, lib.root_module);
} }
lib.installHeadersDirectory( lib.installHeadersDirectory(

View File

@ -24,7 +24,7 @@ const global_state = &@import("global.zig").state;
const oni = @import("oniguruma"); const oni = @import("oniguruma");
const crash = @import("crash/main.zig"); const crash = @import("crash/main.zig");
const unicode = @import("unicode/main.zig"); const unicode = @import("unicode/main.zig");
const renderer = @import("renderer.zig"); const rendererpkg = @import("renderer.zig");
const termio = @import("termio.zig"); const termio = @import("termio.zig");
const objc = @import("objc"); const objc = @import("objc");
const imgui = @import("imgui"); const imgui = @import("imgui");
@ -36,13 +36,13 @@ const configpkg = @import("config.zig");
const input = @import("input.zig"); const input = @import("input.zig");
const App = @import("App.zig"); const App = @import("App.zig");
const internal_os = @import("os/main.zig"); const internal_os = @import("os/main.zig");
const inspector = @import("inspector/main.zig"); const inspectorpkg = @import("inspector/main.zig");
const SurfaceMouse = @import("surface_mouse.zig"); const SurfaceMouse = @import("surface_mouse.zig");
const log = std.log.scoped(.surface); const log = std.log.scoped(.surface);
// The renderer implementation to use. // The renderer implementation to use.
const Renderer = renderer.Renderer; const Renderer = rendererpkg.Renderer;
/// Minimum window size in cells. This is used to prevent the window from /// Minimum window size in cells. This is used to prevent the window from
/// being resized to a size that is too small to be useful. These defaults /// being resized to a size that is too small to be useful. These defaults
@ -70,10 +70,10 @@ font_metrics: font.Metrics,
renderer: Renderer, renderer: Renderer,
/// The render state /// The render state
renderer_state: renderer.State, renderer_state: rendererpkg.State,
/// The renderer thread manager /// The renderer thread manager
renderer_thread: renderer.Thread, renderer_thread: rendererpkg.Thread,
/// The actual thread /// The actual thread
renderer_thr: std.Thread, renderer_thr: std.Thread,
@ -113,10 +113,10 @@ io_thread: termio.Thread,
io_thr: std.Thread, io_thr: std.Thread,
/// Terminal inspector /// Terminal inspector
inspector: ?*inspector.Inspector = null, inspector: ?*inspectorpkg.Inspector = null,
/// All our sizing information. /// All our sizing information.
size: renderer.Size, size: rendererpkg.Size,
/// The configuration derived from the main config. We "derive" it so that /// The configuration derived from the main config. We "derive" it so that
/// we don't have a shared pointer hanging around that we need to worry about /// we don't have a shared pointer hanging around that we need to worry about
@ -339,7 +339,7 @@ const DerivedConfig = struct {
self.arena.deinit(); self.arena.deinit();
} }
fn scaledPadding(self: *const DerivedConfig, x_dpi: f32, y_dpi: f32) renderer.Padding { fn scaledPadding(self: *const DerivedConfig, x_dpi: f32, y_dpi: f32) rendererpkg.Padding {
const padding_top: u32 = padding_top: { const padding_top: u32 = padding_top: {
const padding_top: f32 = @floatFromInt(self.window_padding_top); const padding_top: f32 = @floatFromInt(self.window_padding_top);
break :padding_top @intFromFloat(@floor(padding_top * y_dpi / 72)); break :padding_top @intFromFloat(@floor(padding_top * y_dpi / 72));
@ -431,8 +431,8 @@ pub fn init(
); );
// Build our size struct which has all the sizes we need. // Build our size struct which has all the sizes we need.
const size: renderer.Size = size: { const size: rendererpkg.Size = size: {
var size: renderer.Size = .{ var size: rendererpkg.Size = .{
.screen = screen: { .screen = screen: {
const surface_size = try rt_surface.getSize(); const surface_size = try rt_surface.getSize();
break :screen .{ break :screen .{
@ -445,7 +445,7 @@ pub fn init(
.padding = .{}, .padding = .{},
}; };
const explicit: renderer.Padding = derived_config.scaledPadding( const explicit: rendererpkg.Padding = derived_config.scaledPadding(
x_dpi, x_dpi,
y_dpi, y_dpi,
); );
@ -475,7 +475,7 @@ pub fn init(
errdefer alloc.destroy(mutex); errdefer alloc.destroy(mutex);
// Create the renderer thread // Create the renderer thread
var render_thread = try renderer.Thread.init( var render_thread = try rendererpkg.Thread.init(
alloc, alloc,
config, config,
rt_surface, rt_surface,
@ -611,7 +611,7 @@ pub fn init(
// Start our renderer thread // Start our renderer thread
self.renderer_thr = try std.Thread.spawn( self.renderer_thr = try std.Thread.spawn(
.{}, .{},
renderer.Thread.threadMain, rendererpkg.Thread.threadMain,
.{&self.renderer_thread}, .{&self.renderer_thread},
); );
self.renderer_thr.setName("renderer") catch {}; self.renderer_thr.setName("renderer") catch {};
@ -736,9 +736,9 @@ pub fn activateInspector(self: *Surface) !void {
if (self.inspector != null) return; if (self.inspector != null) return;
// Setup the inspector // Setup the inspector
const ptr = try self.alloc.create(inspector.Inspector); const ptr = try self.alloc.create(inspectorpkg.Inspector);
errdefer self.alloc.destroy(ptr); errdefer self.alloc.destroy(ptr);
ptr.* = try inspector.Inspector.init(self); ptr.* = try inspectorpkg.Inspector.init(self);
self.inspector = ptr; self.inspector = ptr;
// Put the inspector onto the render state // Put the inspector onto the render state
@ -1091,7 +1091,7 @@ fn mouseRefreshLinks(
} }
/// Called when our renderer health state changes. /// Called when our renderer health state changes.
fn updateRendererHealth(self: *Surface, health: renderer.Health) void { fn updateRendererHealth(self: *Surface, health: rendererpkg.Health) void {
log.warn("renderer health status change status={}", .{health}); log.warn("renderer health status change status={}", .{health});
_ = self.rt_app.performAction( _ = self.rt_app.performAction(
.{ .surface = self }, .{ .surface = self },
@ -1163,7 +1163,7 @@ pub fn updateConfig(
// We need to store our configs in a heap-allocated pointer so that // We need to store our configs in a heap-allocated pointer so that
// our messages aren't huge. // our messages aren't huge.
var renderer_message = try renderer.Message.initChangeConfig(self.alloc, config); var renderer_message = try rendererpkg.Message.initChangeConfig(self.alloc, config);
errdefer renderer_message.deinit(); errdefer renderer_message.deinit();
var termio_config_ptr = try self.alloc.create(termio.Termio.DerivedConfig); var termio_config_ptr = try self.alloc.create(termio.Termio.DerivedConfig);
errdefer self.alloc.destroy(termio_config_ptr); errdefer self.alloc.destroy(termio_config_ptr);
@ -1497,7 +1497,7 @@ fn setSelection(self: *Surface, sel_: ?terminal.Selection) !void {
/// Change the cell size for the terminal grid. This can happen as /// Change the cell size for the terminal grid. This can happen as
/// a result of changing the font size at runtime. /// a result of changing the font size at runtime.
fn setCellSize(self: *Surface, size: renderer.CellSize) !void { fn setCellSize(self: *Surface, size: rendererpkg.CellSize) !void {
// Update our cell size within our size struct // Update our cell size within our size struct
self.size.cell = size; self.size.cell = size;
self.balancePaddingIfNeeded(); self.balancePaddingIfNeeded();
@ -1573,7 +1573,7 @@ pub fn sizeCallback(self: *Surface, size: apprt.SurfaceSize) !void {
crash.sentry.thread_state = self.crashThreadState(); crash.sentry.thread_state = self.crashThreadState();
defer crash.sentry.thread_state = null; defer crash.sentry.thread_state = null;
const new_screen_size: renderer.ScreenSize = .{ const new_screen_size: rendererpkg.ScreenSize = .{
.width = size.width, .width = size.width,
.height = size.height, .height = size.height,
}; };
@ -1586,7 +1586,7 @@ pub fn sizeCallback(self: *Surface, size: apprt.SurfaceSize) !void {
try self.resize(new_screen_size); try self.resize(new_screen_size);
} }
fn resize(self: *Surface, size: renderer.ScreenSize) !void { fn resize(self: *Surface, size: rendererpkg.ScreenSize) !void {
// Save our screen size // Save our screen size
self.size.screen = size; self.size.screen = size;
self.balancePaddingIfNeeded(); self.balancePaddingIfNeeded();
@ -1667,7 +1667,7 @@ pub fn preeditCallback(self: *Surface, preedit_: ?[]const u8) !void {
var it = view.iterator(); var it = view.iterator();
// Allocate the codepoints slice // Allocate the codepoints slice
const Codepoint = renderer.State.Preedit.Codepoint; const Codepoint = rendererpkg.State.Preedit.Codepoint;
var codepoints: std.ArrayListUnmanaged(Codepoint) = .{}; var codepoints: std.ArrayListUnmanaged(Codepoint) = .{};
defer codepoints.deinit(self.alloc); defer codepoints.deinit(self.alloc);
while (it.nextCodepoint()) |cp| { while (it.nextCodepoint()) |cp| {
@ -1734,7 +1734,7 @@ pub fn keyCallback(
defer crash.sentry.thread_state = null; defer crash.sentry.thread_state = null;
// Setup our inspector event if we have an inspector. // Setup our inspector event if we have an inspector.
var insp_ev: ?inspector.key.Event = if (self.inspector != null) ev: { var insp_ev: ?inspectorpkg.key.Event = if (self.inspector != null) ev: {
var copy = event; var copy = event;
copy.utf8 = ""; copy.utf8 = "";
if (event.utf8.len > 0) copy.utf8 = try self.alloc.dupe(u8, event.utf8); if (event.utf8.len > 0) copy.utf8 = try self.alloc.dupe(u8, event.utf8);
@ -1898,7 +1898,7 @@ pub fn keyCallback(
fn maybeHandleBinding( fn maybeHandleBinding(
self: *Surface, self: *Surface,
event: input.KeyEvent, event: input.KeyEvent,
insp_ev: ?*inspector.key.Event, insp_ev: ?*inspectorpkg.key.Event,
) !?InputEffect { ) !?InputEffect {
switch (event.action) { switch (event.action) {
// Release events never trigger a binding but we need to check if // Release events never trigger a binding but we need to check if
@ -2106,7 +2106,7 @@ fn endKeySequence(
fn encodeKey( fn encodeKey(
self: *Surface, self: *Surface,
event: input.KeyEvent, event: input.KeyEvent,
insp_ev: ?*inspector.key.Event, insp_ev: ?*inspectorpkg.key.Event,
) !?termio.Message.WriteReq { ) !?termio.Message.WriteReq {
// Build up our encoder. Under different modes and // Build up our encoder. Under different modes and
// inputs there are many keybindings that result in no encoding // inputs there are many keybindings that result in no encoding
@ -2749,7 +2749,7 @@ fn mouseReport(
const final: u8 = if (action == .release) 'm' else 'M'; const final: u8 = if (action == .release) 'm' else 'M';
// The position has to be adjusted to the terminal space. // The position has to be adjusted to the terminal space.
const coord: renderer.Coordinate.Terminal = (renderer.Coordinate{ const coord: rendererpkg.Coordinate.Terminal = (rendererpkg.Coordinate{
.surface = .{ .surface = .{
.x = pos.x, .x = pos.x,
.y = pos.y, .y = pos.y,
@ -3819,7 +3819,7 @@ pub fn colorSchemeCallback(self: *Surface, scheme: apprt.ColorScheme) !void {
pub fn posToViewport(self: Surface, xpos: f64, ypos: f64) terminal.point.Coordinate { pub fn posToViewport(self: Surface, xpos: f64, ypos: f64) terminal.point.Coordinate {
// Get our grid cell // Get our grid cell
const coord: renderer.Coordinate = .{ .surface = .{ .x = xpos, .y = ypos } }; const coord: rendererpkg.Coordinate = .{ .surface = .{ .x = xpos, .y = ypos } };
const grid = coord.convert(.grid, self.size).grid; const grid = coord.convert(.grid, self.size).grid;
return .{ .x = grid.x, .y = grid.y }; return .{ .x = grid.x, .y = grid.y };
} }

View File

@ -43,7 +43,7 @@ const c = @import("c.zig").c;
const version = @import("version.zig"); const version = @import("version.zig");
const inspector = @import("inspector.zig"); const inspector = @import("inspector.zig");
const key = @import("key.zig"); const key = @import("key.zig");
const winproto = @import("winproto.zig"); const winprotopkg = @import("winproto.zig");
const testing = std.testing; const testing = std.testing;
const adwaita = @import("adwaita.zig"); const adwaita = @import("adwaita.zig");
@ -58,7 +58,7 @@ app: *c.GtkApplication,
ctx: *c.GMainContext, ctx: *c.GMainContext,
/// State and logic for the underlying windowing protocol. /// State and logic for the underlying windowing protocol.
winproto: winproto.App, winproto: winprotopkg.App,
/// True if the app was launched with single instance mode. /// True if the app was launched with single instance mode.
single_instance: bool, single_instance: bool,
@ -401,7 +401,7 @@ pub fn init(core_app: *CoreApp, opts: Options) !App {
} }
// Setup our windowing protocol logic // Setup our windowing protocol logic
var winproto_app = try winproto.App.init( var winproto_app = try winprotopkg.App.init(
core_app.alloc, core_app.alloc,
display, display,
app_id, app_id,

View File

@ -32,7 +32,7 @@ const ClipboardConfirmationWindow = @import("ClipboardConfirmationWindow.zig");
const ResizeOverlay = @import("ResizeOverlay.zig"); const ResizeOverlay = @import("ResizeOverlay.zig");
const URLWidget = @import("URLWidget.zig"); const URLWidget = @import("URLWidget.zig");
const CloseDialog = @import("CloseDialog.zig"); const CloseDialog = @import("CloseDialog.zig");
const inspector = @import("inspector.zig"); const inspectorpkg = @import("inspector.zig");
const gtk_key = @import("key.zig"); const gtk_key = @import("key.zig");
const c = @import("c.zig").c; const c = @import("c.zig").c;
const Builder = @import("Builder.zig"); const Builder = @import("Builder.zig");
@ -290,7 +290,7 @@ size: apprt.SurfaceSize,
cursor_pos: apprt.CursorPos, cursor_pos: apprt.CursorPos,
/// Inspector state. /// Inspector state.
inspector: ?*inspector.Inspector = null, inspector: ?*inspectorpkg.Inspector = null,
/// Key input states. See gtkKeyPressed for detailed descriptions. /// Key input states. See gtkKeyPressed for detailed descriptions.
in_keyevent: IMKeyEvent = .false, in_keyevent: IMKeyEvent = .false,
@ -703,7 +703,7 @@ pub fn controlInspector(
// If we already have an inspector, we don't need to show anything. // If we already have an inspector, we don't need to show anything.
if (self.inspector != null) return; if (self.inspector != null) return;
self.inspector = inspector.Inspector.create( self.inspector = inspectorpkg.Inspector.create(
self, self,
.{ .window = {} }, .{ .window = {} },
) catch |err| { ) catch |err| {

View File

@ -34,7 +34,7 @@ const TabView = @import("TabView.zig");
const HeaderBar = @import("headerbar.zig"); const HeaderBar = @import("headerbar.zig");
const CloseDialog = @import("CloseDialog.zig"); const CloseDialog = @import("CloseDialog.zig");
const version = @import("version.zig"); const version = @import("version.zig");
const winproto = @import("winproto.zig"); const winprotopkg = @import("winproto.zig");
const log = std.log.scoped(.gtk); const log = std.log.scoped(.gtk);
@ -69,7 +69,7 @@ toast_overlay: *c.GtkWidget,
adw_tab_overview_focus_timer: ?c.guint = null, adw_tab_overview_focus_timer: ?c.guint = null,
/// State and logic for windowing protocol for a window. /// State and logic for windowing protocol for a window.
winproto: winproto.Window, winproto: winprotopkg.Window,
pub const DerivedConfig = struct { pub const DerivedConfig = struct {
background_opacity: f64, background_opacity: f64,
@ -693,7 +693,7 @@ fn gtkRealize(_: *c.GtkWindow, ud: ?*anyopaque) callconv(.C) bool {
const self = userdataSelf(ud.?); const self = userdataSelf(ud.?);
// Initialize our window protocol logic // Initialize our window protocol logic
if (winproto.Window.init( if (winprotopkg.Window.init(
self.app.core_app.alloc, self.app.core_app.alloc,
&self.app.winproto, &self.app.winproto,
self, self,

View File

@ -7,7 +7,7 @@ const builtin = @import("builtin");
const apprt = @import("../apprt.zig"); const apprt = @import("../apprt.zig");
const font = @import("../font/main.zig"); const font = @import("../font/main.zig");
const renderer = @import("../renderer.zig"); const rendererpkg = @import("../renderer.zig");
const Command = @import("../Command.zig"); const Command = @import("../Command.zig");
const WasmTarget = @import("../os/wasm/target.zig").Target; const WasmTarget = @import("../os/wasm/target.zig").Target;
@ -28,7 +28,7 @@ wasm_target: WasmTarget,
/// Comptime interfaces /// Comptime interfaces
app_runtime: apprt.Runtime = .none, app_runtime: apprt.Runtime = .none,
renderer: renderer.Impl = .opengl, renderer: rendererpkg.Impl = .opengl,
font_backend: font.Backend = .freetype, font_backend: font.Backend = .freetype,
/// Feature flags /// Feature flags
@ -69,7 +69,9 @@ pub fn init(b: *std.Build) !Config {
// If we're building for macOS and we're on macOS, we need to // If we're building for macOS and we're on macOS, we need to
// use a generic target to workaround compilation issues. // use a generic target to workaround compilation issues.
if (result.result.os.tag == .macos and builtin.target.isDarwin()) { if (result.result.os.tag == .macos and
builtin.target.os.tag.isDarwin())
{
result = genericMacOSTarget(b, null); result = genericMacOSTarget(b, null);
} }
@ -122,10 +124,10 @@ pub fn init(b: *std.Build) !Config {
) orelse apprt.Runtime.default(target.result); ) orelse apprt.Runtime.default(target.result);
config.renderer = b.option( config.renderer = b.option(
renderer.Impl, rendererpkg.Impl,
"renderer", "renderer",
"The app runtime to use. Not all values supported on all platforms.", "The app runtime to use. Not all values supported on all platforms.",
) orelse renderer.Impl.default(target.result, wasm_target); ) orelse rendererpkg.Impl.default(target.result, wasm_target);
//--------------------------------------------------------------- //---------------------------------------------------------------
// Feature Flags // Feature Flags
@ -331,7 +333,7 @@ pub fn init(b: *std.Build) !Config {
bool, bool,
"emit-xcframework", "emit-xcframework",
"Build and install the xcframework for the macOS library.", "Build and install the xcframework for the macOS library.",
) orelse builtin.target.isDarwin() and ) orelse builtin.target.os.tag.isDarwin() and
target.result.os.tag == .macos and target.result.os.tag == .macos and
config.app_runtime == .none and config.app_runtime == .none and
(!config.emit_bench and (!config.emit_bench and
@ -366,7 +368,7 @@ pub fn init(b: *std.Build) !Config {
.{ .{
// If we're not on darwin we want to use whatever the // If we're not on darwin we want to use whatever the
// default is via the system package mode // default is via the system package mode
.default = if (target.result.isDarwin()) false else null, .default = if (target.result.os.tag.isDarwin()) false else null,
}, },
); );
} }
@ -395,7 +397,7 @@ pub fn addOptions(self: *const Config, step: *std.Build.Step.Options) !void {
step.addOption(bool, "sentry", self.sentry); step.addOption(bool, "sentry", self.sentry);
step.addOption(apprt.Runtime, "app_runtime", self.app_runtime); step.addOption(apprt.Runtime, "app_runtime", self.app_runtime);
step.addOption(font.Backend, "font_backend", self.font_backend); step.addOption(font.Backend, "font_backend", self.font_backend);
step.addOption(renderer.Impl, "renderer", self.renderer); step.addOption(rendererpkg.Impl, "renderer", self.renderer);
step.addOption(ExeEntrypoint, "exe_entrypoint", self.exe_entrypoint); step.addOption(ExeEntrypoint, "exe_entrypoint", self.exe_entrypoint);
step.addOption(WasmTarget, "wasm_target", self.wasm_target); step.addOption(WasmTarget, "wasm_target", self.wasm_target);
step.addOption(bool, "wasm_shared", self.wasm_shared); step.addOption(bool, "wasm_shared", self.wasm_shared);
@ -436,7 +438,7 @@ pub fn fromOptions() Config {
.flatpak = options.flatpak, .flatpak = options.flatpak,
.app_runtime = std.meta.stringToEnum(apprt.Runtime, @tagName(options.app_runtime)).?, .app_runtime = std.meta.stringToEnum(apprt.Runtime, @tagName(options.app_runtime)).?,
.font_backend = std.meta.stringToEnum(font.Backend, @tagName(options.font_backend)).?, .font_backend = std.meta.stringToEnum(font.Backend, @tagName(options.font_backend)).?,
.renderer = std.meta.stringToEnum(renderer.Impl, @tagName(options.renderer)).?, .renderer = std.meta.stringToEnum(rendererpkg.Impl, @tagName(options.renderer)).?,
.exe_entrypoint = std.meta.stringToEnum(ExeEntrypoint, @tagName(options.exe_entrypoint)).?, .exe_entrypoint = std.meta.stringToEnum(ExeEntrypoint, @tagName(options.exe_entrypoint)).?,
.wasm_target = std.meta.stringToEnum(WasmTarget, @tagName(options.wasm_target)).?, .wasm_target = std.meta.stringToEnum(WasmTarget, @tagName(options.wasm_target)).?,
.wasm_shared = options.wasm_shared, .wasm_shared = options.wasm_shared,

View File

@ -27,7 +27,7 @@ pub fn init(
const generate_markdown = b.addExecutable(.{ const generate_markdown = b.addExecutable(.{
.name = "mdgen_" ++ manpage.name ++ "_" ++ manpage.section, .name = "mdgen_" ++ manpage.name ++ "_" ++ manpage.section,
.root_source_file = b.path("src/main.zig"), .root_source_file = b.path("src/main.zig"),
.target = b.host, .target = b.graph.host,
}); });
deps.help_strings.addImport(generate_markdown); deps.help_strings.addImport(generate_markdown);

View File

@ -16,7 +16,7 @@ pub fn init(b: *std.Build) !GhosttyFrameData {
const exe = b.addExecutable(.{ const exe = b.addExecutable(.{
.name = "framegen", .name = "framegen",
.root_source_file = b.path("src/build/framegen/main.zig"), .root_source_file = b.path("src/build/framegen/main.zig"),
.target = b.host, .target = b.graph.host,
}); });
const run = b.addRunArtifact(exe); const run = b.addRunArtifact(exe);

View File

@ -97,8 +97,8 @@ fn createUpdateStep(b: *std.Build) !*std.Build.Step {
} }
} }
const wf = b.addWriteFiles(); const usf = b.addUpdateSourceFiles();
wf.addCopyFileToSource( usf.addCopyFileToSource(
xgettext.captureStdOut(), xgettext.captureStdOut(),
"po/" ++ domain ++ ".pot", "po/" ++ domain ++ ".pot",
); );
@ -107,8 +107,8 @@ fn createUpdateStep(b: *std.Build) !*std.Build.Step {
const msgmerge = b.addSystemCommand(&.{ "msgmerge", "-q" }); const msgmerge = b.addSystemCommand(&.{ "msgmerge", "-q" });
msgmerge.addFileArg(b.path("po/" ++ locale ++ ".po")); msgmerge.addFileArg(b.path("po/" ++ locale ++ ".po"));
msgmerge.addFileArg(xgettext.captureStdOut()); msgmerge.addFileArg(xgettext.captureStdOut());
wf.addCopyFileToSource(msgmerge.captureStdOut(), "po/" ++ locale ++ ".po"); usf.addCopyFileToSource(msgmerge.captureStdOut(), "po/" ++ locale ++ ".po");
} }
return &wf.step; return &usf.step;
} }

View File

@ -30,7 +30,7 @@ pub fn initStatic(
var lib_list = try deps.add(lib); var lib_list = try deps.add(lib);
try lib_list.append(lib.getEmittedBin()); try lib_list.append(lib.getEmittedBin());
if (!deps.config.target.result.isDarwin()) return .{ if (!deps.config.target.result.os.tag.isDarwin()) return .{
.step = &lib.step, .step = &lib.step,
.output = lib.getEmittedBin(), .output = lib.getEmittedBin(),
}; };

View File

@ -19,7 +19,7 @@ pub fn init(
const webgen_config = b.addExecutable(.{ const webgen_config = b.addExecutable(.{
.name = "webgen_config", .name = "webgen_config",
.root_source_file = b.path("src/main.zig"), .root_source_file = b.path("src/main.zig"),
.target = b.host, .target = b.graph.host,
}); });
deps.help_strings.addImport(webgen_config); deps.help_strings.addImport(webgen_config);
@ -48,7 +48,7 @@ pub fn init(
const webgen_actions = b.addExecutable(.{ const webgen_actions = b.addExecutable(.{
.name = "webgen_actions", .name = "webgen_actions",
.root_source_file = b.path("src/main.zig"), .root_source_file = b.path("src/main.zig"),
.target = b.host, .target = b.graph.host,
}); });
deps.help_strings.addImport(webgen_actions); deps.help_strings.addImport(webgen_actions);
@ -77,7 +77,7 @@ pub fn init(
const webgen_commands = b.addExecutable(.{ const webgen_commands = b.addExecutable(.{
.name = "webgen_commands", .name = "webgen_commands",
.root_source_file = b.path("src/main.zig"), .root_source_file = b.path("src/main.zig"),
.target = b.host, .target = b.graph.host,
}); });
deps.help_strings.addImport(webgen_commands); deps.help_strings.addImport(webgen_commands);

View File

@ -13,7 +13,7 @@ pub fn init(b: *std.Build, cfg: *const Config) !HelpStrings {
const exe = b.addExecutable(.{ const exe = b.addExecutable(.{
.name = "helpgen", .name = "helpgen",
.root_source_file = b.path("src/helpgen.zig"), .root_source_file = b.path("src/helpgen.zig"),
.target = b.host, .target = b.graph.host,
}); });
const help_config = config: { const help_config = config: {

View File

@ -320,8 +320,8 @@ pub fn add(
// We always require the system SDK so that our system headers are available. // We always require the system SDK so that our system headers are available.
// This makes things like `os/log.h` available for cross-compiling. // This makes things like `os/log.h` available for cross-compiling.
if (step.rootModuleTarget().isDarwin()) { if (step.rootModuleTarget().os.tag.isDarwin()) {
try @import("apple_sdk").addPaths(b, &step.root_module); try @import("apple_sdk").addPaths(b, step.root_module);
const metallib = self.metallib.?; const metallib = self.metallib.?;
metallib.output.addStepDependencies(&step.step); metallib.output.addStepDependencies(&step.step);
@ -363,7 +363,7 @@ pub fn add(
}).module("zf")); }).module("zf"));
// Mac Stuff // Mac Stuff
if (step.rootModuleTarget().isDarwin()) { if (step.rootModuleTarget().os.tag.isDarwin()) {
const objc_dep = b.dependency("zig_objc", .{ const objc_dep = b.dependency("zig_objc", .{
.target = target, .target = target,
.optimize = optimize, .optimize = optimize,
@ -470,7 +470,7 @@ pub fn add(
} }
if (self.config.wayland) { if (self.config.wayland) {
const scanner = Scanner.create(b.dependency("zig_wayland", .{}), .{ const scanner = Scanner.create(b.dependency("zig_wayland", .{}).builder, .{
.wayland_xml = b.dependency("wayland", .{}).path("protocol/wayland.xml"), .wayland_xml = b.dependency("wayland", .{}).path("protocol/wayland.xml"),
.wayland_protocols = b.dependency("wayland_protocols", .{}).path(""), .wayland_protocols = b.dependency("wayland_protocols", .{}).path(""),
}); });
@ -523,7 +523,7 @@ pub fn add(
const generate_gresource_xml = b.addExecutable(.{ const generate_gresource_xml = b.addExecutable(.{
.name = "generate_gresource_xml", .name = "generate_gresource_xml",
.root_source_file = b.path("src/apprt/gtk/gresource.zig"), .root_source_file = b.path("src/apprt/gtk/gresource.zig"),
.target = b.host, .target = b.graph.host,
}); });
const generate = b.addRunArtifact(generate_gresource_xml); const generate = b.addRunArtifact(generate_gresource_xml);
@ -531,7 +531,7 @@ pub fn add(
const gtk_blueprint_compiler = b.addExecutable(.{ const gtk_blueprint_compiler = b.addExecutable(.{
.name = "gtk_blueprint_compiler", .name = "gtk_blueprint_compiler",
.root_source_file = b.path("src/apprt/gtk/blueprint_compiler.zig"), .root_source_file = b.path("src/apprt/gtk/blueprint_compiler.zig"),
.target = b.host, .target = b.graph.host,
}); });
gtk_blueprint_compiler.linkSystemLibrary2("gtk4", dynamic_link_opts); gtk_blueprint_compiler.linkSystemLibrary2("gtk4", dynamic_link_opts);
gtk_blueprint_compiler.linkSystemLibrary2("libadwaita-1", dynamic_link_opts); gtk_blueprint_compiler.linkSystemLibrary2("libadwaita-1", dynamic_link_opts);
@ -569,7 +569,7 @@ pub fn add(
const gtk_builder_check = b.addExecutable(.{ const gtk_builder_check = b.addExecutable(.{
.name = "gtk_builder_check", .name = "gtk_builder_check",
.root_source_file = b.path("src/apprt/gtk/builder_check.zig"), .root_source_file = b.path("src/apprt/gtk/builder_check.zig"),
.target = b.host, .target = b.graph.host,
}); });
gtk_builder_check.root_module.addOptions("build_options", self.options); gtk_builder_check.root_module.addOptions("build_options", self.options);
gtk_builder_check.root_module.addImport("gtk", gobject.module("gtk4")); gtk_builder_check.root_module.addImport("gtk", gobject.module("gtk4"));
@ -593,7 +593,6 @@ pub fn add(
}); });
const ghostty_resources_c = generate_resources_c.addOutputFileArg("ghostty_resources.c"); const ghostty_resources_c = generate_resources_c.addOutputFileArg("ghostty_resources.c");
generate_resources_c.addFileArg(gresource_xml); generate_resources_c.addFileArg(gresource_xml);
generate_resources_c.extra_file_dependencies = &gresource.dependencies;
step.addCSourceFile(.{ .file = ghostty_resources_c, .flags = &.{} }); step.addCSourceFile(.{ .file = ghostty_resources_c, .flags = &.{} });
const generate_resources_h = b.addSystemCommand(&.{ const generate_resources_h = b.addSystemCommand(&.{
@ -605,7 +604,6 @@ pub fn add(
}); });
const ghostty_resources_h = generate_resources_h.addOutputFileArg("ghostty_resources.h"); const ghostty_resources_h = generate_resources_h.addOutputFileArg("ghostty_resources.h");
generate_resources_h.addFileArg(gresource_xml); generate_resources_h.addFileArg(gresource_xml);
generate_resources_h.extra_file_dependencies = &gresource.dependencies;
step.addIncludePath(ghostty_resources_h.dirname()); step.addIncludePath(ghostty_resources_h.dirname());
} }
}, },

View File

@ -13,11 +13,11 @@ pub fn init(b: *std.Build) !UnicodeTables {
const exe = b.addExecutable(.{ const exe = b.addExecutable(.{
.name = "unigen", .name = "unigen",
.root_source_file = b.path("src/unicode/props.zig"), .root_source_file = b.path("src/unicode/props.zig"),
.target = b.host, .target = b.graph.host,
}); });
const ziglyph_dep = b.dependency("ziglyph", .{ const ziglyph_dep = b.dependency("ziglyph", .{
.target = b.host, .target = b.graph.host,
}); });
exe.root_module.addImport("ziglyph", ziglyph_dep.module("ziglyph")); exe.root_module.addImport("ziglyph", ziglyph_dep.module("ziglyph"));

View File

@ -88,7 +88,7 @@ fn writeBashCompletions(writer: anytype) !void {
\\ \\
); );
for (@typeInfo(Config).Struct.fields) |field| { for (@typeInfo(Config).@"struct".fields) |field| {
if (field.name[0] == '_') continue; if (field.name[0] == '_') continue;
switch (field.type) { switch (field.type) {
bool, ?bool => try writer.writeAll(pad2 ++ "config+=\" '--" ++ field.name ++ " '\"\n"), bool, ?bool => try writer.writeAll(pad2 ++ "config+=\" '--" ++ field.name ++ " '\"\n"),
@ -102,7 +102,7 @@ fn writeBashCompletions(writer: anytype) !void {
\\ \\
); );
for (@typeInfo(Config).Struct.fields) |field| { for (@typeInfo(Config).@"struct".fields) |field| {
if (field.name[0] == '_') continue; if (field.name[0] == '_') continue;
try writer.writeAll(pad3 ++ "--" ++ field.name ++ ") "); try writer.writeAll(pad3 ++ "--" ++ field.name ++ ") ");
@ -118,8 +118,8 @@ fn writeBashCompletions(writer: anytype) !void {
const compgenPrefix = "mapfile -t COMPREPLY < <( compgen -W \""; const compgenPrefix = "mapfile -t COMPREPLY < <( compgen -W \"";
const compgenSuffix = "\" -- \"$cur\" ); _add_spaces ;;"; const compgenSuffix = "\" -- \"$cur\" ); _add_spaces ;;";
switch (@typeInfo(field.type)) { switch (@typeInfo(field.type)) {
.Bool => try writer.writeAll("return ;;"), .bool => try writer.writeAll("return ;;"),
.Enum => |info| { .@"enum" => |info| {
try writer.writeAll(compgenPrefix); try writer.writeAll(compgenPrefix);
for (info.fields, 0..) |f, i| { for (info.fields, 0..) |f, i| {
if (i > 0) try writer.writeAll(" "); if (i > 0) try writer.writeAll(" ");
@ -127,7 +127,7 @@ fn writeBashCompletions(writer: anytype) !void {
} }
try writer.writeAll(compgenSuffix); try writer.writeAll(compgenSuffix);
}, },
.Struct => |info| { .@"struct" => |info| {
if (!@hasDecl(field.type, "parseCLI") and info.layout == .@"packed") { if (!@hasDecl(field.type, "parseCLI") and info.layout == .@"packed") {
try writer.writeAll(compgenPrefix); try writer.writeAll(compgenPrefix);
for (info.fields, 0..) |f, i| { for (info.fields, 0..) |f, i| {
@ -157,13 +157,13 @@ fn writeBashCompletions(writer: anytype) !void {
\\ \\
); );
for (@typeInfo(Action).Enum.fields) |field| { for (@typeInfo(Action).@"enum".fields) |field| {
if (std.mem.eql(u8, "help", field.name)) continue; if (std.mem.eql(u8, "help", field.name)) continue;
if (std.mem.eql(u8, "version", field.name)) continue; if (std.mem.eql(u8, "version", field.name)) continue;
const options = @field(Action, field.name).options(); const options = @field(Action, field.name).options();
// assumes options will never be created with only <_name> members // assumes options will never be created with only <_name> members
if (@typeInfo(options).Struct.fields.len == 0) continue; if (@typeInfo(options).@"struct".fields.len == 0) continue;
var buffer: [field.name.len]u8 = undefined; var buffer: [field.name.len]u8 = undefined;
const bashName: []u8 = buffer[0..field.name.len]; const bashName: []u8 = buffer[0..field.name.len];
@ -174,7 +174,7 @@ fn writeBashCompletions(writer: anytype) !void {
{ {
var count = 0; var count = 0;
for (@typeInfo(options).Struct.fields) |opt| { for (@typeInfo(options).@"struct".fields) |opt| {
if (opt.name[0] == '_') continue; if (opt.name[0] == '_') continue;
if (count > 0) try writer.writeAll(" "); if (count > 0) try writer.writeAll(" ");
switch (opt.type) { switch (opt.type) {
@ -193,12 +193,12 @@ fn writeBashCompletions(writer: anytype) !void {
\\ \\
); );
for (@typeInfo(Action).Enum.fields) |field| { for (@typeInfo(Action).@"enum".fields) |field| {
if (std.mem.eql(u8, "help", field.name)) continue; if (std.mem.eql(u8, "help", field.name)) continue;
if (std.mem.eql(u8, "version", field.name)) continue; if (std.mem.eql(u8, "version", field.name)) continue;
const options = @field(Action, field.name).options(); const options = @field(Action, field.name).options();
if (@typeInfo(options).Struct.fields.len == 0) continue; if (@typeInfo(options).@"struct".fields.len == 0) continue;
// bash doesn't allow variable names containing '-' so replace them // bash doesn't allow variable names containing '-' so replace them
var buffer: [field.name.len]u8 = undefined; var buffer: [field.name.len]u8 = undefined;
@ -207,7 +207,7 @@ fn writeBashCompletions(writer: anytype) !void {
try writer.writeAll(pad3 ++ "+" ++ field.name ++ ")\n"); try writer.writeAll(pad3 ++ "+" ++ field.name ++ ")\n");
try writer.writeAll(pad4 ++ "case $prev in\n"); try writer.writeAll(pad4 ++ "case $prev in\n");
for (@typeInfo(options).Struct.fields) |opt| { for (@typeInfo(options).@"struct".fields) |opt| {
if (opt.name[0] == '_') continue; if (opt.name[0] == '_') continue;
try writer.writeAll(pad5 ++ "--" ++ opt.name ++ ") "); try writer.writeAll(pad5 ++ "--" ++ opt.name ++ ") ");
@ -215,8 +215,8 @@ fn writeBashCompletions(writer: anytype) !void {
const compgenPrefix = "mapfile -t COMPREPLY < <( compgen -W \""; const compgenPrefix = "mapfile -t COMPREPLY < <( compgen -W \"";
const compgenSuffix = "\" -- \"$cur\" ); _add_spaces ;;"; const compgenSuffix = "\" -- \"$cur\" ); _add_spaces ;;";
switch (@typeInfo(opt.type)) { switch (@typeInfo(opt.type)) {
.Bool => try writer.writeAll("return ;;"), .bool => try writer.writeAll("return ;;"),
.Enum => |info| { .@"enum" => |info| {
try writer.writeAll(compgenPrefix); try writer.writeAll(compgenPrefix);
for (info.fields, 0..) |f, i| { for (info.fields, 0..) |f, i| {
if (i > 0) try writer.writeAll(" "); if (i > 0) try writer.writeAll(" ");
@ -224,9 +224,9 @@ fn writeBashCompletions(writer: anytype) !void {
} }
try writer.writeAll(compgenSuffix); try writer.writeAll(compgenSuffix);
}, },
.Optional => |optional| { .optional => |optional| {
switch (@typeInfo(optional.child)) { switch (@typeInfo(optional.child)) {
.Enum => |info| { .@"enum" => |info| {
try writer.writeAll(compgenPrefix); try writer.writeAll(compgenPrefix);
for (info.fields, 0..) |f, i| { for (info.fields, 0..) |f, i| {
if (i > 0) try writer.writeAll(" "); if (i > 0) try writer.writeAll(" ");
@ -271,7 +271,7 @@ fn writeBashCompletions(writer: anytype) !void {
\\ \\
); );
for (@typeInfo(Action).Enum.fields) |field| { for (@typeInfo(Action).@"enum".fields) |field| {
if (std.mem.eql(u8, "help", field.name)) continue; if (std.mem.eql(u8, "help", field.name)) continue;
if (std.mem.eql(u8, "version", field.name)) continue; if (std.mem.eql(u8, "version", field.name)) continue;

View File

@ -25,7 +25,7 @@ fn writeFishCompletions(writer: anytype) !void {
{ {
try writer.writeAll("set -l commands \""); try writer.writeAll("set -l commands \"");
var count: usize = 0; var count: usize = 0;
for (@typeInfo(Action).Enum.fields) |field| { for (@typeInfo(Action).@"enum".fields) |field| {
if (std.mem.eql(u8, "help", field.name)) continue; if (std.mem.eql(u8, "help", field.name)) continue;
if (std.mem.eql(u8, "version", field.name)) continue; if (std.mem.eql(u8, "version", field.name)) continue;
if (count > 0) try writer.writeAll(" "); if (count > 0) try writer.writeAll(" ");
@ -41,7 +41,7 @@ fn writeFishCompletions(writer: anytype) !void {
try writer.writeAll("complete -c ghostty -s e -l help -f\n"); try writer.writeAll("complete -c ghostty -s e -l help -f\n");
try writer.writeAll("complete -c ghostty -n \"not __fish_seen_subcommand_from $commands\" -l version -f\n"); try writer.writeAll("complete -c ghostty -n \"not __fish_seen_subcommand_from $commands\" -l version -f\n");
for (@typeInfo(Config).Struct.fields) |field| { for (@typeInfo(Config).@"struct".fields) |field| {
if (field.name[0] == '_') continue; if (field.name[0] == '_') continue;
try writer.writeAll("complete -c ghostty -n \"not __fish_seen_subcommand_from $commands\" -l "); try writer.writeAll("complete -c ghostty -n \"not __fish_seen_subcommand_from $commands\" -l ");
@ -56,8 +56,8 @@ fn writeFishCompletions(writer: anytype) !void {
else { else {
try writer.writeAll(if (field.type != Config.RepeatablePath) " -f" else " -F"); try writer.writeAll(if (field.type != Config.RepeatablePath) " -f" else " -F");
switch (@typeInfo(field.type)) { switch (@typeInfo(field.type)) {
.Bool => {}, .bool => {},
.Enum => |info| { .@"enum" => |info| {
try writer.writeAll(" -a \""); try writer.writeAll(" -a \"");
for (info.fields, 0..) |f, i| { for (info.fields, 0..) |f, i| {
if (i > 0) try writer.writeAll(" "); if (i > 0) try writer.writeAll(" ");
@ -65,7 +65,7 @@ fn writeFishCompletions(writer: anytype) !void {
} }
try writer.writeAll("\""); try writer.writeAll("\"");
}, },
.Struct => |info| { .@"struct" => |info| {
if (!@hasDecl(field.type, "parseCLI") and info.layout == .@"packed") { if (!@hasDecl(field.type, "parseCLI") and info.layout == .@"packed") {
try writer.writeAll(" -a \""); try writer.writeAll(" -a \"");
for (info.fields, 0..) |f, i| { for (info.fields, 0..) |f, i| {
@ -86,7 +86,7 @@ fn writeFishCompletions(writer: anytype) !void {
{ {
try writer.writeAll("complete -c ghostty -n \"string match -q -- '+*' (commandline -pt)\" -f -a \""); try writer.writeAll("complete -c ghostty -n \"string match -q -- '+*' (commandline -pt)\" -f -a \"");
var count: usize = 0; var count: usize = 0;
for (@typeInfo(Action).Enum.fields) |field| { for (@typeInfo(Action).@"enum".fields) |field| {
if (std.mem.eql(u8, "help", field.name)) continue; if (std.mem.eql(u8, "help", field.name)) continue;
if (std.mem.eql(u8, "version", field.name)) continue; if (std.mem.eql(u8, "version", field.name)) continue;
if (count > 0) try writer.writeAll(" "); if (count > 0) try writer.writeAll(" ");
@ -97,12 +97,12 @@ fn writeFishCompletions(writer: anytype) !void {
try writer.writeAll("\"\n"); try writer.writeAll("\"\n");
} }
for (@typeInfo(Action).Enum.fields) |field| { for (@typeInfo(Action).@"enum".fields) |field| {
if (std.mem.eql(u8, "help", field.name)) continue; if (std.mem.eql(u8, "help", field.name)) continue;
if (std.mem.eql(u8, "version", field.name)) continue; if (std.mem.eql(u8, "version", field.name)) continue;
const options = @field(Action, field.name).options(); const options = @field(Action, field.name).options();
for (@typeInfo(options).Struct.fields) |opt| { for (@typeInfo(options).@"struct".fields) |opt| {
if (opt.name[0] == '_') continue; if (opt.name[0] == '_') continue;
try writer.writeAll("complete -c ghostty -n \"__fish_seen_subcommand_from +" ++ field.name ++ "\" -l "); try writer.writeAll("complete -c ghostty -n \"__fish_seen_subcommand_from +" ++ field.name ++ "\" -l ");
try writer.writeAll(opt.name); try writer.writeAll(opt.name);
@ -114,8 +114,8 @@ fn writeFishCompletions(writer: anytype) !void {
} else try writer.writeAll(" -f"); } else try writer.writeAll(" -f");
switch (@typeInfo(opt.type)) { switch (@typeInfo(opt.type)) {
.Bool => {}, .bool => {},
.Enum => |info| { .@"enum" => |info| {
try writer.writeAll(" -a \""); try writer.writeAll(" -a \"");
for (info.fields, 0..) |f, i| { for (info.fields, 0..) |f, i| {
if (i > 0) try writer.writeAll(" "); if (i > 0) try writer.writeAll(" ");
@ -123,9 +123,9 @@ fn writeFishCompletions(writer: anytype) !void {
} }
try writer.writeAll("\""); try writer.writeAll("\"");
}, },
.Optional => |optional| { .optional => |optional| {
switch (@typeInfo(optional.child)) { switch (@typeInfo(optional.child)) {
.Enum => |info| { .@"enum" => |info| {
try writer.writeAll(" -a \""); try writer.writeAll(" -a \"");
for (info.fields, 0..) |f, i| { for (info.fields, 0..) |f, i| {
if (i > 0) try writer.writeAll(" "); if (i > 0) try writer.writeAll(" ");

View File

@ -45,7 +45,7 @@ fn writeZshCompletions(writer: anytype) !void {
try writer.writeAll(" _arguments \\\n"); try writer.writeAll(" _arguments \\\n");
try writer.writeAll(" \"--help\" \\\n"); try writer.writeAll(" \"--help\" \\\n");
try writer.writeAll(" \"--version\" \\\n"); try writer.writeAll(" \"--version\" \\\n");
for (@typeInfo(Config).Struct.fields) |field| { for (@typeInfo(Config).@"struct".fields) |field| {
if (field.name[0] == '_') continue; if (field.name[0] == '_') continue;
try writer.writeAll(" \"--"); try writer.writeAll(" \"--");
try writer.writeAll(field.name); try writer.writeAll(field.name);
@ -64,8 +64,8 @@ fn writeZshCompletions(writer: anytype) !void {
try writer.writeAll("_files"); // todo check if this is needed try writer.writeAll("_files"); // todo check if this is needed
} else { } else {
switch (@typeInfo(field.type)) { switch (@typeInfo(field.type)) {
.Bool => {}, .bool => {},
.Enum => |info| { .@"enum" => |info| {
try writer.writeAll(equals_required); try writer.writeAll(equals_required);
try writer.writeAll("("); try writer.writeAll("(");
for (info.fields, 0..) |f, i| { for (info.fields, 0..) |f, i| {
@ -74,7 +74,7 @@ fn writeZshCompletions(writer: anytype) !void {
} }
try writer.writeAll(")"); try writer.writeAll(")");
}, },
.Struct => |info| { .@"struct" => |info| {
try writer.writeAll(equals_required); try writer.writeAll(equals_required);
if (!@hasDecl(field.type, "parseCLI") and info.layout == .@"packed") { if (!@hasDecl(field.type, "parseCLI") and info.layout == .@"packed") {
try writer.writeAll("("); try writer.writeAll("(");
@ -138,7 +138,7 @@ fn writeZshCompletions(writer: anytype) !void {
// how to get 'commands' // how to get 'commands'
var count: usize = 0; var count: usize = 0;
const padding = " "; const padding = " ";
for (@typeInfo(Action).Enum.fields) |field| { for (@typeInfo(Action).@"enum".fields) |field| {
if (std.mem.eql(u8, "help", field.name)) continue; if (std.mem.eql(u8, "help", field.name)) continue;
if (std.mem.eql(u8, "version", field.name)) continue; if (std.mem.eql(u8, "version", field.name)) continue;
@ -167,25 +167,25 @@ fn writeZshCompletions(writer: anytype) !void {
); );
{ {
const padding = " "; const padding = " ";
for (@typeInfo(Action).Enum.fields) |field| { for (@typeInfo(Action).@"enum".fields) |field| {
if (std.mem.eql(u8, "help", field.name)) continue; if (std.mem.eql(u8, "help", field.name)) continue;
if (std.mem.eql(u8, "version", field.name)) continue; if (std.mem.eql(u8, "version", field.name)) continue;
const options = @field(Action, field.name).options(); const options = @field(Action, field.name).options();
// assumes options will never be created with only <_name> members // assumes options will never be created with only <_name> members
if (@typeInfo(options).Struct.fields.len == 0) continue; if (@typeInfo(options).@"struct".fields.len == 0) continue;
try writer.writeAll(padding ++ "(+" ++ field.name ++ ")\n"); try writer.writeAll(padding ++ "(+" ++ field.name ++ ")\n");
try writer.writeAll(padding ++ " _arguments \\\n"); try writer.writeAll(padding ++ " _arguments \\\n");
for (@typeInfo(options).Struct.fields) |opt| { for (@typeInfo(options).@"struct".fields) |opt| {
if (opt.name[0] == '_') continue; if (opt.name[0] == '_') continue;
try writer.writeAll(padding ++ " '--"); try writer.writeAll(padding ++ " '--");
try writer.writeAll(opt.name); try writer.writeAll(opt.name);
switch (@typeInfo(opt.type)) { switch (@typeInfo(opt.type)) {
.Bool => {}, .bool => {},
.Enum => |info| { .@"enum" => |info| {
try writer.writeAll(equals_required); try writer.writeAll(equals_required);
try writer.writeAll("("); try writer.writeAll("(");
for (info.fields, 0..) |f, i| { for (info.fields, 0..) |f, i| {
@ -194,10 +194,10 @@ fn writeZshCompletions(writer: anytype) !void {
} }
try writer.writeAll(")"); try writer.writeAll(")");
}, },
.Optional => |optional| { .optional => |optional| {
try writer.writeAll(equals_required); try writer.writeAll(equals_required);
switch (@typeInfo(optional.child)) { switch (@typeInfo(optional.child)) {
.Enum => |info| { .@"enum" => |info| {
try writer.writeAll("("); try writer.writeAll("(");
for (info.fields, 0..) |f, i| { for (info.fields, 0..) |f, i| {
if (i > 0) try writer.writeAll(" "); if (i > 0) try writer.writeAll(" ");

View File

@ -80,7 +80,7 @@ pub const Artifact = enum {
wasm_module, wasm_module,
pub fn detect() Artifact { pub fn detect() Artifact {
if (builtin.target.isWasm()) { if (builtin.target.cpu.arch.isWasm()) {
assert(builtin.output_mode == .Obj); assert(builtin.output_mode == .Obj);
assert(builtin.link_mode == .Static); assert(builtin.link_mode == .Static);
return .wasm_module; return .wasm_module;

View File

@ -39,14 +39,14 @@ pub const State = struct {
/// An enum of the available conditional configuration keys. /// An enum of the available conditional configuration keys.
pub const Key = key: { pub const Key = key: {
const stateInfo = @typeInfo(State).Struct; const stateInfo = @typeInfo(State).@"struct";
var fields: [stateInfo.fields.len]std.builtin.Type.EnumField = undefined; var fields: [stateInfo.fields.len]std.builtin.Type.EnumField = undefined;
for (stateInfo.fields, 0..) |field, i| fields[i] = .{ for (stateInfo.fields, 0..) |field, i| fields[i] = .{
.name = field.name, .name = field.name,
.value = i, .value = i,
}; };
break :key @Type(.{ .Enum = .{ break :key @Type(.{ .@"enum" = .{
.tag_type = std.math.IntFittingRange(0, fields.len - 1), .tag_type = std.math.IntFittingRange(0, fields.len - 1),
.fields = &fields, .fields = &fields,
.decls = &.{}, .decls = &.{},

View File

@ -36,7 +36,7 @@ fn isInternal(name: []const u8) bool {
fn generateKeywords() []const u8 { fn generateKeywords() []const u8 {
@setEvalBranchQuota(5000); @setEvalBranchQuota(5000);
var keywords: []const u8 = ""; var keywords: []const u8 = "";
const config_fields = @typeInfo(Config).Struct.fields; const config_fields = @typeInfo(Config).@"struct".fields;
for (config_fields) |field| { for (config_fields) |field| {
if (isInternal(field.name)) continue; if (isInternal(field.name)) continue;

View File

@ -91,7 +91,7 @@ fn writeSyntax(writer: anytype) !void {
\\syn keyword ghosttyConfigKeyword \\syn keyword ghosttyConfigKeyword
); );
const config_fields = @typeInfo(Config).Struct.fields; const config_fields = @typeInfo(Config).@"struct".fields;
inline for (config_fields) |field| { inline for (config_fields) |field| {
if (field.name[0] == '_') continue; if (field.name[0] == '_') continue;
try writer.print("\n\t\\ {s}", .{field.name}); try writer.print("\n\t\\ {s}", .{field.name});

View File

@ -30,7 +30,7 @@ pub const Library = library.Library;
// If we're targeting wasm then we export some wasm APIs. // If we're targeting wasm then we export some wasm APIs.
comptime { comptime {
if (builtin.target.isWasm()) { if (builtin.target.cpu.arch.isWasm()) {
_ = Atlas.Wasm; _ = Atlas.Wasm;
_ = DeferredFace.Wasm; _ = DeferredFace.Wasm;
_ = face.web_canvas.Wasm; _ = face.web_canvas.Wasm;
@ -45,7 +45,7 @@ pub const options: struct {
// TODO: we need to modify the build config for wasm builds. the issue // TODO: we need to modify the build config for wasm builds. the issue
// is we're sharing the build config options between all exes in build.zig. // is we're sharing the build config options between all exes in build.zig.
// We need to construct it per target. // We need to construct it per target.
.backend = if (builtin.target.isWasm()) .web_canvas else build_config.font_backend, .backend = if (builtin.target.cpu.arch.isWasm()) .web_canvas else build_config.font_backend,
}; };
pub const Backend = enum { pub const Backend = enum {
@ -91,7 +91,7 @@ pub const Backend = enum {
// macOS also supports "coretext_freetype" but there is no scenario // macOS also supports "coretext_freetype" but there is no scenario
// that is the default. It is only used by people who want to // that is the default. It is only used by people who want to
// self-compile Ghostty and prefer the freetype aesthetic. // self-compile Ghostty and prefer the freetype aesthetic.
return if (target.isDarwin()) .coretext else .fontconfig_freetype; return if (target.os.tag.isDarwin()) .coretext else .fontconfig_freetype;
} }
// All the functions below can be called at comptime or runtime to // All the functions below can be called at comptime or runtime to
@ -176,7 +176,7 @@ pub const sprite_index = Collection.Index.initSpecial(.sprite);
test { test {
// For non-wasm we want to test everything we can // For non-wasm we want to test everything we can
if (!comptime builtin.target.isWasm()) { if (!comptime builtin.target.cpu.arch.isWasm()) {
@import("std").testing.refAllDecls(@This()); @import("std").testing.refAllDecls(@This());
return; return;
} }

View File

@ -48,7 +48,7 @@ pub const Impl = enum {
}; };
} }
if (target.isDarwin()) return .metal; if (target.os.tag.isDarwin()) return .metal;
return .opengl; return .opengl;
} }
}; };

View File

@ -3,7 +3,7 @@
const std = @import("std"); const std = @import("std");
const Allocator = std.mem.Allocator; const Allocator = std.mem.Allocator;
const Inspector = @import("../inspector/main.zig").Inspector; const Inspector = @import("../inspector/main.zig").Inspector;
const terminal = @import("../terminal/main.zig"); const terminalpkg = @import("../terminal/main.zig");
const inputpkg = @import("../input.zig"); const inputpkg = @import("../input.zig");
const renderer = @import("../renderer.zig"); const renderer = @import("../renderer.zig");
@ -14,7 +14,7 @@ const renderer = @import("../renderer.zig");
mutex: *std.Thread.Mutex, mutex: *std.Thread.Mutex,
/// The terminal data. /// The terminal data.
terminal: *terminal.Terminal, terminal: *terminalpkg.Terminal,
/// The terminal inspector, if any. This will be null while the inspector /// The terminal inspector, if any. This will be null while the inspector
/// is not active and will be set when it is active. /// is not active and will be set when it is active.
@ -34,7 +34,7 @@ pub const Mouse = struct {
/// The point on the viewport where the mouse currently is. We use /// The point on the viewport where the mouse currently is. We use
/// viewport points to avoid the complexity of mapping the mouse to /// viewport points to avoid the complexity of mapping the mouse to
/// the renderer state. /// the renderer state.
point: ?terminal.point.Coordinate = null, point: ?terminalpkg.point.Coordinate = null,
/// The mods that are currently active for the last mouse event. /// The mods that are currently active for the last mouse event.
/// This could really just be mods in general and we probably will /// This could really just be mods in general and we probably will
@ -80,11 +80,11 @@ pub const Preedit = struct {
/// into the available space. /// into the available space.
pub fn range( pub fn range(
self: *const Preedit, self: *const Preedit,
start: terminal.size.CellCountInt, start: terminalpkg.size.CellCountInt,
max: terminal.size.CellCountInt, max: terminalpkg.size.CellCountInt,
) struct { ) struct {
start: terminal.size.CellCountInt, start: terminalpkg.size.CellCountInt,
end: terminal.size.CellCountInt, end: terminalpkg.size.CellCountInt,
cp_offset: usize, cp_offset: usize,
} { } {
// If our width is greater than the number of cells we have // If our width is greater than the number of cells we have
@ -96,7 +96,7 @@ pub const Preedit = struct {
// Rebuild our width in reverse order. This is because we want // Rebuild our width in reverse order. This is because we want
// to offset by the end cells, not the start cells (if we have to). // to offset by the end cells, not the start cells (if we have to).
var w: terminal.size.CellCountInt = 0; var w: terminalpkg.size.CellCountInt = 0;
for (0..self.codepoints.len) |i| { for (0..self.codepoints.len) |i| {
const reverse_i = self.codepoints.len - i - 1; const reverse_i = self.codepoints.len - i - 1;
const cp = self.codepoints[reverse_i]; const cp = self.codepoints[reverse_i];

View File

@ -8,7 +8,7 @@ const assert = std.debug.assert;
const xev = @import("../global.zig").xev; const xev = @import("../global.zig").xev;
const crash = @import("../crash/main.zig"); const crash = @import("../crash/main.zig");
const internal_os = @import("../os/main.zig"); const internal_os = @import("../os/main.zig");
const renderer = @import("../renderer.zig"); const rendererpkg = @import("../renderer.zig");
const apprt = @import("../apprt.zig"); const apprt = @import("../apprt.zig");
const configpkg = @import("../config.zig"); const configpkg = @import("../config.zig");
const BlockingQueue = @import("../datastruct/main.zig").BlockingQueue; const BlockingQueue = @import("../datastruct/main.zig").BlockingQueue;
@ -23,7 +23,7 @@ const CURSOR_BLINK_INTERVAL = 600;
/// The type used for sending messages to the IO thread. For now this is /// The type used for sending messages to the IO thread. For now this is
/// hardcoded with a capacity. We can make this a comptime parameter in /// hardcoded with a capacity. We can make this a comptime parameter in
/// the future if we want it configurable. /// the future if we want it configurable.
pub const Mailbox = BlockingQueue(renderer.Message, 64); pub const Mailbox = BlockingQueue(rendererpkg.Message, 64);
/// Allocator used for some state /// Allocator used for some state
alloc: std.mem.Allocator, alloc: std.mem.Allocator,
@ -67,10 +67,10 @@ cursor_c_cancel: xev.Completion = .{},
surface: *apprt.Surface, surface: *apprt.Surface,
/// The underlying renderer implementation. /// The underlying renderer implementation.
renderer: *renderer.Renderer, renderer: *rendererpkg.Renderer,
/// Pointer to the shared state that is used to generate the final render. /// Pointer to the shared state that is used to generate the final render.
state: *renderer.State, state: *rendererpkg.State,
/// The mailbox that can be used to send this thread messages. Note /// The mailbox that can be used to send this thread messages. Note
/// this is a blocking queue so if it is full you will get errors (or block). /// this is a blocking queue so if it is full you will get errors (or block).
@ -117,8 +117,8 @@ pub fn init(
alloc: Allocator, alloc: Allocator,
config: *const configpkg.Config, config: *const configpkg.Config,
surface: *apprt.Surface, surface: *apprt.Surface,
renderer_impl: *renderer.Renderer, renderer_impl: *rendererpkg.Renderer,
state: *renderer.State, state: *rendererpkg.State,
app_mailbox: App.Mailbox, app_mailbox: App.Mailbox,
) !Thread { ) !Thread {
// Create our event loop. // Create our event loop.
@ -209,7 +209,7 @@ fn threadMain_(self: *Thread) !void {
self.setQosClass(); self.setQosClass();
// Run our loop start/end callbacks if the renderer cares. // Run our loop start/end callbacks if the renderer cares.
const has_loop = @hasDecl(renderer.Renderer, "loopEnter"); const has_loop = @hasDecl(rendererpkg.Renderer, "loopEnter");
if (has_loop) try self.renderer.loopEnter(self); if (has_loop) try self.renderer.loopEnter(self);
defer if (has_loop) self.renderer.loopExit(); defer if (has_loop) self.renderer.loopExit();
@ -278,7 +278,7 @@ fn setQosClass(self: *const Thread) void {
fn startDrawTimer(self: *Thread) void { fn startDrawTimer(self: *Thread) void {
// If our renderer doesn't support animations then we never run this. // If our renderer doesn't support animations then we never run this.
if (!@hasDecl(renderer.Renderer, "hasAnimations")) return; if (!@hasDecl(rendererpkg.Renderer, "hasAnimations")) return;
if (!self.renderer.hasAnimations()) return; if (!self.renderer.hasAnimations()) return;
if (self.config.custom_shader_animation == .false) return; if (self.config.custom_shader_animation == .false) return;
@ -442,7 +442,7 @@ fn drainMailbox(self: *Thread) !void {
.inspector => |v| self.flags.has_inspector = v, .inspector => |v| self.flags.has_inspector = v,
.macos_display_id => |v| { .macos_display_id => |v| {
if (@hasDecl(renderer.Renderer, "setMacOSDisplayID")) { if (@hasDecl(rendererpkg.Renderer, "setMacOSDisplayID")) {
try self.renderer.setMacOSDisplayID(v); try self.renderer.setMacOSDisplayID(v);
} }
}, },
@ -466,8 +466,8 @@ fn drawFrame(self: *Thread, now: bool) void {
// If we're doing single-threaded GPU calls then we just wake up the // If we're doing single-threaded GPU calls then we just wake up the
// app thread to redraw at this point. // app thread to redraw at this point.
if (renderer.Renderer == renderer.OpenGL and if (rendererpkg.Renderer == rendererpkg.OpenGL and
renderer.OpenGL.single_threaded_draw) rendererpkg.OpenGL.single_threaded_draw)
{ {
_ = self.app_mailbox.push( _ = self.app_mailbox.push(
.{ .redraw_surface = self.surface }, .{ .redraw_surface = self.surface },

View File

@ -56,7 +56,7 @@ const std_size = Page.layout(std_capacity).total_size;
/// allocator because we need memory that is zero-initialized and page-aligned. /// allocator because we need memory that is zero-initialized and page-aligned.
const PagePool = std.heap.MemoryPoolAligned( const PagePool = std.heap.MemoryPoolAligned(
[std_size]u8, [std_size]u8,
std.mem.page_size, std.heap.page_size_min,
); );
/// List of pins, known as "tracked" pins. These are pins that are kept /// List of pins, known as "tracked" pins. These are pins that are kept
@ -1977,7 +1977,7 @@ fn createPageExt(
else else
try page_alloc.alignedAlloc( try page_alloc.alignedAlloc(
u8, u8,
std.mem.page_size, std.heap.page_size_min,
layout.total_size, layout.total_size,
); );
errdefer if (pooled) errdefer if (pooled)

View File

@ -11,7 +11,7 @@ const Allocator = std.mem.Allocator;
const unicode = @import("../unicode/main.zig"); const unicode = @import("../unicode/main.zig");
const ansi = @import("ansi.zig"); const ansi = @import("ansi.zig");
const modes = @import("modes.zig"); const modespkg = @import("modes.zig");
const charsets = @import("charsets.zig"); const charsets = @import("charsets.zig");
const csi = @import("csi.zig"); const csi = @import("csi.zig");
const hyperlink = @import("hyperlink.zig"); const hyperlink = @import("hyperlink.zig");
@ -20,7 +20,7 @@ const point = @import("point.zig");
const sgr = @import("sgr.zig"); const sgr = @import("sgr.zig");
const Tabstops = @import("Tabstops.zig"); const Tabstops = @import("Tabstops.zig");
const color = @import("color.zig"); const color = @import("color.zig");
const mouse_shape = @import("mouse_shape.zig"); const mouse_shape_pkg = @import("mouse_shape.zig");
const size = @import("size.zig"); const size = @import("size.zig");
const pagepkg = @import("page.zig"); const pagepkg = @import("page.zig");
@ -87,10 +87,10 @@ color_palette: struct {
previous_char: ?u21 = null, previous_char: ?u21 = null,
/// The modes that this terminal currently has active. /// The modes that this terminal currently has active.
modes: modes.ModeState = .{}, modes: modespkg.ModeState = .{},
/// The most recently set mouse shape for the terminal. /// The most recently set mouse shape for the terminal.
mouse_shape: mouse_shape.MouseShape = .text, mouse_shape: mouse_shape_pkg.MouseShape = .text,
/// These are just a packed set of flags we may set on the terminal. /// These are just a packed set of flags we may set on the terminal.
flags: packed struct { flags: packed struct {
@ -196,7 +196,7 @@ pub const Options = struct {
/// The default mode state. When the terminal gets a reset, it /// The default mode state. When the terminal gets a reset, it
/// will revert back to this state. /// will revert back to this state.
default_modes: modes.ModePacked = .{}, default_modes: modespkg.ModePacked = .{},
}; };
/// Initialize a new terminal. /// Initialize a new terminal.

View File

@ -118,7 +118,6 @@ fn HashMapUnmanaged(
const Self = @This(); const Self = @This();
comptime { comptime {
std.hash_map.verifyContext(Context, K, K, u64, false);
assert(@alignOf(Metadata) == 1); assert(@alignOf(Metadata) == 1);
} }
@ -510,8 +509,6 @@ fn HashMapUnmanaged(
/// from this function. To encourage that, this function is /// from this function. To encourage that, this function is
/// marked as inline. /// marked as inline.
inline fn getIndex(self: Self, key: anytype, ctx: anytype) ?usize { inline fn getIndex(self: Self, key: anytype, ctx: anytype) ?usize {
comptime std.hash_map.verifyContext(@TypeOf(ctx), @TypeOf(key), K, Hash, false);
if (self.header().size == 0) { if (self.header().size == 0) {
return null; return null;
} }
@ -519,8 +516,6 @@ fn HashMapUnmanaged(
// If you get a compile error on this line, it means that your generic hash // If you get a compile error on this line, it means that your generic hash
// function is invalid for these parameters. // function is invalid for these parameters.
const hash = ctx.hash(key); const hash = ctx.hash(key);
// verifyContext can't verify the return type of generic hash functions,
// so we need to double-check it here.
if (@TypeOf(hash) != Hash) { if (@TypeOf(hash) != Hash) {
@compileError("Context " ++ @typeName(@TypeOf(ctx)) ++ " has a generic hash function that returns the wrong type! " ++ @typeName(Hash) ++ " was expected, but found " ++ @typeName(@TypeOf(hash))); @compileError("Context " ++ @typeName(@TypeOf(ctx)) ++ " has a generic hash function that returns the wrong type! " ++ @typeName(Hash) ++ " was expected, but found " ++ @typeName(@TypeOf(hash)));
} }

View File

@ -8,7 +8,7 @@ const std = @import("std");
pub const FlagStack = struct { pub const FlagStack = struct {
const len = 8; const len = 8;
flags: [len]Flags = .{.{}} ** len, flags: [len]Flags = .{Flags{}} ** len,
idx: u3 = 0, idx: u3 = 0,
/// Return the current stack value /// Return the current stack value

View File

@ -83,7 +83,7 @@ pub const Page = struct {
comptime { comptime {
// The alignment of our members. We want to ensure that the page // The alignment of our members. We want to ensure that the page
// alignment is always divisible by this. // alignment is always divisible by this.
assert(std.mem.page_size % @max( assert(std.heap.page_size_min % @max(
@alignOf(Row), @alignOf(Row),
@alignOf(Cell), @alignOf(Cell),
style.Set.base_align, style.Set.base_align,
@ -93,7 +93,7 @@ pub const Page = struct {
/// The backing memory for the page. A page is always made up of a /// The backing memory for the page. A page is always made up of a
/// a single contiguous block of memory that is aligned on a page /// a single contiguous block of memory that is aligned on a page
/// boundary and is a multiple of the system page size. /// boundary and is a multiple of the system page size.
memory: []align(std.mem.page_size) u8, memory: []align(std.heap.page_size_min) u8,
/// The array of rows in the page. The rows are always in row order /// The array of rows in the page. The rows are always in row order
/// (i.e. index 0 is the top row, index 1 is the row below that, etc.) /// (i.e. index 0 is the top row, index 1 is the row below that, etc.)
@ -198,7 +198,7 @@ pub const Page = struct {
// (small but meaningful for this path) and because a private // (small but meaningful for this path) and because a private
// anonymous mmap is guaranteed on Linux and macOS to be zeroed, // anonymous mmap is guaranteed on Linux and macOS to be zeroed,
// which is a critical property for us. // which is a critical property for us.
assert(l.total_size % std.mem.page_size == 0); assert(l.total_size % std.heap.page_size_min == 0);
const backing = try posix.mmap( const backing = try posix.mmap(
null, null,
l.total_size, l.total_size,
@ -611,7 +611,7 @@ pub const Page = struct {
/// Clone the entire contents of this page. /// Clone the entire contents of this page.
/// ///
/// The buffer must be at least the size of self.memory. /// The buffer must be at least the size of self.memory.
pub fn cloneBuf(self: *const Page, buf: []align(std.mem.page_size) u8) Page { pub fn cloneBuf(self: *const Page, buf: []align(std.heap.page_size_min) u8) Page {
assert(buf.len >= self.memory.len); assert(buf.len >= self.memory.len);
// The entire concept behind a page is that everything is stored // The entire concept behind a page is that everything is stored
@ -1721,7 +1721,7 @@ pub const Page = struct {
const dirty_start = alignForward(usize, cells_end, @alignOf(usize)); const dirty_start = alignForward(usize, cells_end, @alignOf(usize));
const dirty_end: usize = dirty_start + (dirty_usize_length * @sizeOf(usize)); const dirty_end: usize = dirty_start + (dirty_usize_length * @sizeOf(usize));
const styles_layout = style.Set.layout(cap.styles); const styles_layout: style.Set.Layout = .init(cap.styles);
const styles_start = alignForward(usize, dirty_end, style.Set.base_align); const styles_start = alignForward(usize, dirty_end, style.Set.base_align);
const styles_end = styles_start + styles_layout.total_size; const styles_end = styles_start + styles_layout.total_size;
@ -1739,7 +1739,7 @@ pub const Page = struct {
const string_end = string_start + string_layout.total_size; const string_end = string_start + string_layout.total_size;
const hyperlink_count = @divFloor(cap.hyperlink_bytes, @sizeOf(hyperlink.Set.Item)); const hyperlink_count = @divFloor(cap.hyperlink_bytes, @sizeOf(hyperlink.Set.Item));
const hyperlink_set_layout = hyperlink.Set.layout(@intCast(hyperlink_count)); const hyperlink_set_layout: hyperlink.Set.Layout = .init(@intCast(hyperlink_count));
const hyperlink_set_start = alignForward(usize, string_end, hyperlink.Set.base_align); const hyperlink_set_start = alignForward(usize, string_end, hyperlink.Set.base_align);
const hyperlink_set_end = hyperlink_set_start + hyperlink_set_layout.total_size; const hyperlink_set_end = hyperlink_set_start + hyperlink_set_layout.total_size;
@ -1755,7 +1755,7 @@ pub const Page = struct {
const hyperlink_map_start = alignForward(usize, hyperlink_set_end, hyperlink.Map.base_align); const hyperlink_map_start = alignForward(usize, hyperlink_set_end, hyperlink.Map.base_align);
const hyperlink_map_end = hyperlink_map_start + hyperlink_map_layout.total_size; const hyperlink_map_end = hyperlink_map_start + hyperlink_map_layout.total_size;
const total_size = alignForward(usize, hyperlink_map_end, std.mem.page_size); const total_size = alignForward(usize, hyperlink_map_end, std.heap.page_size_min);
return .{ return .{
.total_size = total_size, .total_size = total_size,
@ -2124,12 +2124,12 @@ pub const Cell = packed struct(u64) {
// .styles = 128, // .styles = 128,
// .grapheme_bytes = 1024, // .grapheme_bytes = 1024,
// }).total_size, // }).total_size,
// std.mem.page_size, // std.heap.page_size_min,
// ); // );
// //
// std.log.warn("total_size={} pages={}", .{ // std.log.warn("total_size={} pages={}", .{
// total_size, // total_size,
// total_size / std.mem.page_size, // total_size / std.heap.page_size_min,
// }); // });
// } // }
// //
@ -2139,7 +2139,7 @@ pub const Cell = packed struct(u64) {
// // so we fail a test if it changes. // // so we fail a test if it changes.
// const total_size = Page.layout(std_capacity).total_size; // const total_size = Page.layout(std_capacity).total_size;
// try testing.expectEqual(@as(usize, 524_288), total_size); // 512 KiB // try testing.expectEqual(@as(usize, 524_288), total_size); // 512 KiB
// //const pages = total_size / std.mem.page_size; // //const pages = total_size / std.heap.page_size_min;
// } // }
test "Cell is zero by default" { test "Cell is zero by default" {

View File

@ -132,6 +132,14 @@ pub fn RefCountedSet(
/// An instance of the context structure. /// An instance of the context structure.
context: Context, context: Context,
pub const Layout = struct {
cap: usize,
table_cap: usize,
table_mask: Id,
table_start: usize,
items_start: usize,
total_size: usize,
/// Returns the memory layout for the given base offset and /// Returns the memory layout for the given base offset and
/// desired capacity. The layout can be used by the caller to /// desired capacity. The layout can be used by the caller to
/// determine how much memory to allocate, and the layout must /// determine how much memory to allocate, and the layout must
@ -147,7 +155,7 @@ pub fn RefCountedSet(
/// ///
/// The returned layout `cap` property will be 1 more than the number /// The returned layout `cap` property will be 1 more than the number
/// of items that the set can actually store, since ID 0 is reserved. /// of items that the set can actually store, since ID 0 is reserved.
pub fn layout(cap: usize) Layout { pub fn init(cap: usize) Layout {
// Experimentally, this load factor works quite well. // Experimentally, this load factor works quite well.
const load_factor = 0.8125; const load_factor = 0.8125;
@ -185,14 +193,6 @@ pub fn RefCountedSet(
.total_size = total_size, .total_size = total_size,
}; };
} }
pub const Layout = struct {
cap: usize,
table_cap: usize,
table_mask: Id,
table_start: usize,
items_start: usize,
total_size: usize,
}; };
pub fn init(base: OffsetBuf, l: Layout, context: Context) Self { pub fn init(base: OffsetBuf, l: Layout, context: Context) Self {

View File

@ -233,12 +233,10 @@ test "encode" {
try src.encode(buf_stream.writer()); try src.encode(buf_stream.writer());
const expected = const expected =
\\ghostty|xterm-ghostty|Ghostty, "ghostty|xterm-ghostty|Ghostty\n" ++
\\ am, "\tam,\n" ++
\\ ccc@, "\tccc@,\n" ++
\\ colors#256, "\tcolors#256,\n" ++
\\ bel=^G, "\tbel=^G,\n\n";
\\
;
try std.testing.expectEqualStrings(@as([]const u8, expected), buf_stream.getWritten()); try std.testing.expectEqualStrings(@as([]const u8, expected), buf_stream.getWritten());
} }

View File

@ -16,7 +16,7 @@ const termio = @import("../termio.zig");
const Command = @import("../Command.zig"); const Command = @import("../Command.zig");
const Pty = @import("../pty.zig").Pty; const Pty = @import("../pty.zig").Pty;
const StreamHandler = @import("stream_handler.zig").StreamHandler; const StreamHandler = @import("stream_handler.zig").StreamHandler;
const terminal = @import("../terminal/main.zig"); const terminalpkg = @import("../terminal/main.zig");
const terminfo = @import("../terminfo/main.zig"); const terminfo = @import("../terminfo/main.zig");
const xev = @import("../global.zig").xev; const xev = @import("../global.zig").xev;
const renderer = @import("../renderer.zig"); const renderer = @import("../renderer.zig");
@ -41,7 +41,7 @@ config: DerivedConfig,
/// The terminal emulator internal state. This is the abstract "terminal" /// The terminal emulator internal state. This is the abstract "terminal"
/// that manages input, grid updating, etc. and is renderer-agnostic. It /// that manages input, grid updating, etc. and is renderer-agnostic. It
/// just stores internal state about a grid. /// just stores internal state about a grid.
terminal: terminal.Terminal, terminal: terminalpkg.Terminal,
/// The shared render state /// The shared render state
renderer_state: *renderer.State, renderer_state: *renderer.State,
@ -64,7 +64,7 @@ mailbox: termio.Mailbox,
/// The stream parser. This parses the stream of escape codes and so on /// The stream parser. This parses the stream of escape codes and so on
/// from the child process and calls callbacks in the stream handler. /// from the child process and calls callbacks in the stream handler.
terminal_stream: terminal.Stream(StreamHandler), terminal_stream: terminalpkg.Stream(StreamHandler),
/// Last time the cursor was reset. This is used to prevent message /// Last time the cursor was reset. This is used to prevent message
/// flooding with cursor resets. /// flooding with cursor resets.
@ -76,9 +76,9 @@ last_cursor_reset: ?std.time.Instant = null,
pub const DerivedConfig = struct { pub const DerivedConfig = struct {
arena: ArenaAllocator, arena: ArenaAllocator,
palette: terminal.color.Palette, palette: terminalpkg.color.Palette,
image_storage_limit: usize, image_storage_limit: usize,
cursor_style: terminal.CursorStyle, cursor_style: terminalpkg.CursorStyle,
cursor_blink: ?bool, cursor_blink: ?bool,
cursor_color: ?configpkg.Config.Color, cursor_color: ?configpkg.Config.Color,
cursor_invert: bool, cursor_invert: bool,
@ -128,8 +128,8 @@ pub const DerivedConfig = struct {
/// to run a child process. /// to run a child process.
pub fn init(self: *Termio, alloc: Allocator, opts: termio.Options) !void { pub fn init(self: *Termio, alloc: Allocator, opts: termio.Options) !void {
// The default terminal modes based on our config. // The default terminal modes based on our config.
const default_modes: terminal.ModePacked = modes: { const default_modes: terminalpkg.ModePacked = modes: {
var modes: terminal.ModePacked = .{}; var modes: terminalpkg.ModePacked = .{};
// Setup our initial grapheme cluster support if enabled. We use a // Setup our initial grapheme cluster support if enabled. We use a
// switch to ensure we get a compiler error if more cases are added. // switch to ensure we get a compiler error if more cases are added.
@ -145,7 +145,7 @@ pub fn init(self: *Termio, alloc: Allocator, opts: termio.Options) !void {
}; };
// Create our terminal // Create our terminal
var term = try terminal.Terminal.init(alloc, opts: { var term = try terminalpkg.Terminal.init(alloc, opts: {
const grid_size = opts.size.grid(); const grid_size = opts.size.grid();
break :opts .{ break :opts .{
.cols = grid_size.columns, .cols = grid_size.columns,
@ -510,7 +510,7 @@ pub fn clearScreen(self: *Termio, td: *ThreadData, history: bool) !void {
} }
/// Scroll the viewport /// Scroll the viewport
pub fn scrollViewport(self: *Termio, scroll: terminal.Terminal.ScrollViewport) !void { pub fn scrollViewport(self: *Termio, scroll: terminalpkg.Terminal.ScrollViewport) !void {
self.renderer_state.mutex.lock(); self.renderer_state.mutex.lock();
defer self.renderer_state.mutex.unlock(); defer self.renderer_state.mutex.unlock();
try self.terminal.scrollViewport(scroll); try self.terminal.scrollViewport(scroll);