Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/App.zig
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ const App = @This();

const std = @import("std");
const builtin = @import("builtin");
const assert = @import("quirks.zig").inlineAssert;
const assert = @import("quirks").inlineAssert;
const Allocator = std.mem.Allocator;
const apprt = @import("apprt.zig");
const Surface = @import("Surface.zig");
const input = @import("input.zig");
const configpkg = @import("config.zig");
const Config = configpkg.Config;
const BlockingQueue = @import("datastruct/main.zig").BlockingQueue;
const BlockingQueue = @import("datastruct").BlockingQueue;
const renderer = @import("renderer.zig");
const font = @import("font/main.zig");
const global = @import("global.zig");
Expand Down
2 changes: 1 addition & 1 deletion src/Surface.zig
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub const Message = apprt.surface.Message;

const std = @import("std");
const builtin = @import("builtin");
const assert = @import("quirks.zig").inlineAssert;
const assert = @import("quirks").inlineAssert;
const Allocator = std.mem.Allocator;
const ArenaAllocator = std.heap.ArenaAllocator;
const global = @import("global.zig");
Expand Down
2 changes: 1 addition & 1 deletion src/apprt/action.zig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const std = @import("std");
const build_config = @import("../build_config.zig");
const assert = @import("../quirks.zig").inlineAssert;
const assert = @import("quirks").inlineAssert;
const apprt = @import("../apprt.zig");
const configpkg = @import("../config.zig");
const input = @import("../input.zig");
Expand Down
2 changes: 1 addition & 1 deletion src/apprt/embedded.zig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

const std = @import("std");
const builtin = @import("builtin");
const assert = @import("../quirks.zig").inlineAssert;
const assert = @import("quirks").inlineAssert;
const Allocator = std.mem.Allocator;
const objc = @import("objc");
const apprt = @import("../apprt.zig");
Expand Down
2 changes: 1 addition & 1 deletion src/apprt/gtk/cgroup.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/// transient systemd scopes.
const std = @import("std");
const Allocator = std.mem.Allocator;
const assert = @import("../../quirks.zig").inlineAssert;
const assert = @import("quirks").inlineAssert;

const gio = @import("gio");
const glib = @import("glib");
Expand Down
2 changes: 1 addition & 1 deletion src/apprt/gtk/class/application.zig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const builtin = @import("builtin");
const std = @import("std");
const assert = @import("../../../quirks.zig").inlineAssert;
const assert = @import("quirks").inlineAssert;
const Allocator = std.mem.Allocator;
const adw = @import("adw");
const gdk = @import("gdk");
Expand Down
2 changes: 1 addition & 1 deletion src/apprt/gtk/class/global_shortcuts.zig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const std = @import("std");
const assert = @import("../../../quirks.zig").inlineAssert;
const assert = @import("quirks").inlineAssert;
const Allocator = std.mem.Allocator;
const gio = @import("gio");
const glib = @import("glib");
Expand Down
2 changes: 1 addition & 1 deletion src/apprt/gtk/class/imgui_widget.zig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const std = @import("std");
const assert = @import("../../../quirks.zig").inlineAssert;
const assert = @import("quirks").inlineAssert;

const cimgui = @import("dcimgui");
const gl = @import("opengl");
Expand Down
2 changes: 1 addition & 1 deletion src/apprt/gtk/class/split_tree.zig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const std = @import("std");
const assert = @import("../../../quirks.zig").inlineAssert;
const assert = @import("quirks").inlineAssert;
const Allocator = std.mem.Allocator;
const adw = @import("adw");
const gio = @import("gio");
Expand Down
48 changes: 45 additions & 3 deletions src/apprt/gtk/class/surface.zig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const std = @import("std");
const assert = @import("../../../quirks.zig").inlineAssert;
const assert = @import("quirks").inlineAssert;
const Allocator = std.mem.Allocator;
const adw = @import("adw");
const gdk = @import("gdk");
Expand All @@ -11,7 +11,7 @@ const gtk = @import("gtk");
const apprt = @import("../../../apprt.zig");
const build_config = @import("../../../build_config.zig");
const configpkg = @import("../../../config.zig");
const datastruct = @import("../../../datastruct/main.zig");
const datastruct = @import("datastruct");
const font = @import("../../../font/main.zig");
const input = @import("../../../input.zig");
const internal_os = @import("../../../os/main.zig");
Expand Down Expand Up @@ -41,6 +41,48 @@ const gtk_version = @import("../gtk_version.zig");

const log = std.log.scoped(.gtk_ghostty_surface);

fn splitTreeGetGObjectType(comptime Self: type, comptime View: type) fn () callconv(.c) usize {
return gobject.ext.defineBoxed(
Self,
.{
// To get the type name we get the non-qualified type name
// of the view and append that to `GhosttySplitTree`.
.name = name: {
const type_name = @typeName(View);
const last = if (std.mem.lastIndexOfScalar(
u8,
type_name,
'.',
)) |idx|
type_name[idx + 1 ..]
else
type_name;
assert(last.len > 0);
break :name "GhosttySplitTree" ++ last;
},

.funcs = .{
.copy = &struct {
fn copy(self: *Self) callconv(.c) *Self {
const ptr = glib.ext.create(Self);
ptr.* = if (self.nodes.len == 0)
.empty
else
self.clone(self.arena.child_allocator) catch @panic("oom");
return ptr;
}
}.copy,
.free = &struct {
fn free(self: *Self) callconv(.c) void {
self.deinit();
glib.ext.destroy(self);
}
}.free,
},
},
);
}

pub const Surface = extern struct {
const Self = @This();
parent_instance: Parent,
Expand All @@ -58,7 +100,7 @@ pub const Surface = extern struct {
});

/// A SplitTree implementation that stores surfaces.
pub const Tree = datastruct.SplitTree(Self);
pub const Tree = datastruct.SplitTree(Self, splitTreeGetGObjectType);

pub const properties = struct {
/// This property is set to true when the bell is ringing. Note that
Expand Down
2 changes: 1 addition & 1 deletion src/apprt/gtk/class/window.zig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const std = @import("std");
const build_config = @import("../../../build_config.zig");
const assert = @import("../../../quirks.zig").inlineAssert;
const assert = @import("quirks").inlineAssert;
const adw = @import("adw");
const gdk = @import("gdk");
const gio = @import("gio");
Expand Down
2 changes: 1 addition & 1 deletion src/apprt/gtk/ext.zig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//! helpers.

const std = @import("std");
const assert = @import("../../quirks.zig").inlineAssert;
const assert = @import("quirks").inlineAssert;
const testing = std.testing;

const glib = @import("glib");
Expand Down
2 changes: 1 addition & 1 deletion src/apprt/gtk/ext/actions.zig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const std = @import("std");

const assert = @import("../../../quirks.zig").inlineAssert;
const assert = @import("quirks").inlineAssert;
const testing = std.testing;

const gio = @import("gio");
Expand Down
2 changes: 1 addition & 1 deletion src/apprt/gtk/media.zig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const std = @import("std");
const assert = @import("../../quirks.zig").inlineAssert;
const assert = @import("quirks").inlineAssert;

const log = std.log.scoped(.gtk_media);

Expand Down
2 changes: 1 addition & 1 deletion src/apprt/ipc.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//! process.
const std = @import("std");
const Allocator = std.mem.Allocator;
const assert = @import("../quirks.zig").inlineAssert;
const assert = @import("quirks").inlineAssert;
const lib = @import("../lib/main.zig");

pub const Errors = error{
Expand Down
2 changes: 1 addition & 1 deletion src/apprt/surface.zig
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const Surface = @import("../Surface.zig");
const renderer = @import("../renderer.zig");
const terminal = @import("../terminal/main.zig");
const Config = @import("../config.zig").Config;
const MessageData = @import("../datastruct/main.zig").MessageData;
const MessageData = @import("datastruct").MessageData;

/// The message types that can be sent to a single surface.
pub const Message = union(enum) {
Expand Down
2 changes: 2 additions & 0 deletions src/build/GhosttyDocs.zig
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const GhosttyDocs = @This();
const std = @import("std");
const Config = @import("Config.zig");
const SharedDeps = @import("SharedDeps.zig");
const internal = @import("internal.zig");

steps: []*std.Build.Step,

Expand Down Expand Up @@ -35,6 +36,7 @@ pub fn init(
}),
});
deps.help_strings.addImport(generate_markdown);
internal.add(generate_markdown.root_module);

const gen_config = config: {
var copy = deps.config.*;
Expand Down
2 changes: 2 additions & 0 deletions src/build/GhosttyResources.zig
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const assert = std.debug.assert;
const Config = @import("Config.zig");
const RunStep = std.Build.Step.Run;
const SharedDeps = @import("SharedDeps.zig");
const internal = @import("internal.zig");

steps: []*std.Build.Step,

Expand All @@ -26,6 +27,7 @@ pub fn init(b: *std.Build, cfg: *const Config, deps: *const SharedDeps) !Ghostty
});

deps.help_strings.addImport(build_data_exe);
internal.add(build_data_exe.root_module);

// Terminfo
terminfo: {
Expand Down
4 changes: 4 additions & 0 deletions src/build/GhosttyWebdata.zig
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const GhosttyWebdata = @This();

const std = @import("std");
const SharedDeps = @import("SharedDeps.zig");
const internal = @import("internal.zig");

steps: []*std.Build.Step,

Expand All @@ -26,6 +27,7 @@ pub fn init(
}),
});
deps.help_strings.addImport(webgen_config);
internal.add(webgen_config.root_module);

{
const buildconfig = config: {
Expand Down Expand Up @@ -57,6 +59,7 @@ pub fn init(
}),
});
deps.help_strings.addImport(webgen_actions);
internal.add(webgen_actions.root_module);

{
const buildconfig = config: {
Expand Down Expand Up @@ -88,6 +91,7 @@ pub fn init(
}),
});
deps.help_strings.addImport(webgen_commands);
internal.add(webgen_commands.root_module);

{
const buildconfig = config: {
Expand Down
3 changes: 3 additions & 0 deletions src/build/GhosttyZig.zig
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const std = @import("std");
const Config = @import("Config.zig");
const SharedDeps = @import("SharedDeps.zig");
const TerminalBuildOptions = @import("../terminal/build_options.zig").Options;
const internal = @import("internal.zig");

/// The `_c`-suffixed modules are built with the C ABI enabled.
vt: *std.Build.Module,
Expand Down Expand Up @@ -137,6 +138,8 @@ fn initVt(
// We need uucode for grapheme break support
vt.addImport("uucode", deps.uucode_mod);

internal.add(vt);

// If SIMD is enabled, add all our SIMD dependencies.
if (cfg.simd) {
try SharedDeps.addSimd(b, vt, simd_libs);
Expand Down
4 changes: 4 additions & 0 deletions src/build/HelpStrings.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ const HelpStrings = @This();

const std = @import("std");
const Config = @import("Config.zig");
const SharedDeps = @import("SharedDeps.zig");
const internal = @import("internal.zig");

/// The "helpgen" exe.
exe: *std.Build.Step.Compile,
Expand Down Expand Up @@ -30,6 +32,8 @@ pub fn init(b: *std.Build, cfg: *const Config) !HelpStrings {
try help_config.addOptions(options);
exe.root_module.addOptions("build_options", options);

internal.add(exe.root_module);

const help_run = b.addRunArtifact(exe);

// Generated Zig files have to end with .zig
Expand Down
3 changes: 3 additions & 0 deletions src/build/SharedDeps.zig
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const UnicodeTables = @import("UnicodeTables.zig");
const GhosttyFrameData = @import("GhosttyFrameData.zig");
const DistResource = @import("GhosttyDist.zig").Resource;
const gtk_helpers = @import("gtk.zig");
const internal = @import("internal.zig");

config: *const Config,

Expand Down Expand Up @@ -184,6 +185,8 @@ pub fn add(
// Every exe needs the uucode module
step.root_module.addImport("uucode", self.uucode_mod);

internal.add(step.root_module);

// C imports for locale constants and functions
{
const c = b.addTranslateC(.{
Expand Down
Loading
Loading