mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-04-22 01:18:36 +03:00
Merge pull request #794 from hqnna/main
Add option to enable or disable libadwaita
This commit is contained in:
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
@ -132,7 +132,7 @@ jobs:
|
|||||||
run: nix develop -c zig build -Dapp-runtime=none test
|
run: nix develop -c zig build -Dapp-runtime=none test
|
||||||
|
|
||||||
- name: Test GTK Build
|
- name: Test GTK Build
|
||||||
run: nix develop -c zig build -Dapp-runtime=gtk
|
run: nix develop -c zig build -Dapp-runtime=gtk -Dgtk-libadwaita=true
|
||||||
|
|
||||||
- name: Test GLFW Build
|
- name: Test GLFW Build
|
||||||
run: nix develop -c zig build -Dapp-runtime=glfw
|
run: nix develop -c zig build -Dapp-runtime=glfw
|
||||||
|
10
build.zig
10
build.zig
@ -39,6 +39,7 @@ var flatpak: bool = false;
|
|||||||
var app_runtime: apprt.Runtime = .none;
|
var app_runtime: apprt.Runtime = .none;
|
||||||
var renderer_impl: renderer.Impl = .opengl;
|
var renderer_impl: renderer.Impl = .opengl;
|
||||||
var font_backend: font.Backend = .freetype;
|
var font_backend: font.Backend = .freetype;
|
||||||
|
var libadwaita: bool = false;
|
||||||
|
|
||||||
pub fn build(b: *std.Build) !void {
|
pub fn build(b: *std.Build) !void {
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
@ -87,6 +88,12 @@ pub fn build(b: *std.Build) !void {
|
|||||||
"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 apprt.Runtime.default(target);
|
) orelse apprt.Runtime.default(target);
|
||||||
|
|
||||||
|
libadwaita = b.option(
|
||||||
|
bool,
|
||||||
|
"gtk-libadwaita",
|
||||||
|
"Enables the use of libadwaita when using the gtk rendering backend.",
|
||||||
|
) orelse true;
|
||||||
|
|
||||||
renderer_impl = b.option(
|
renderer_impl = b.option(
|
||||||
renderer.Impl,
|
renderer.Impl,
|
||||||
"renderer",
|
"renderer",
|
||||||
@ -203,6 +210,7 @@ pub fn build(b: *std.Build) !void {
|
|||||||
exe_options.addOption(apprt.Runtime, "app_runtime", app_runtime);
|
exe_options.addOption(apprt.Runtime, "app_runtime", app_runtime);
|
||||||
exe_options.addOption(font.Backend, "font_backend", font_backend);
|
exe_options.addOption(font.Backend, "font_backend", font_backend);
|
||||||
exe_options.addOption(renderer.Impl, "renderer", renderer_impl);
|
exe_options.addOption(renderer.Impl, "renderer", renderer_impl);
|
||||||
|
exe_options.addOption(bool, "libadwaita", libadwaita);
|
||||||
|
|
||||||
// Exe
|
// Exe
|
||||||
if (exe_) |exe| {
|
if (exe_) |exe| {
|
||||||
@ -819,7 +827,7 @@ fn addDeps(
|
|||||||
|
|
||||||
.gtk => {
|
.gtk => {
|
||||||
step.linkSystemLibrary2("gtk4", dynamic_link_opts);
|
step.linkSystemLibrary2("gtk4", dynamic_link_opts);
|
||||||
step.linkSystemLibrary2("adwaita-1", dynamic_link_opts);
|
if (libadwaita) step.linkSystemLibrary2("adwaita-1", dynamic_link_opts);
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ const internal_os = @import("../../os/main.zig");
|
|||||||
const Config = configpkg.Config;
|
const Config = configpkg.Config;
|
||||||
const CoreApp = @import("../../App.zig");
|
const CoreApp = @import("../../App.zig");
|
||||||
const CoreSurface = @import("../../Surface.zig");
|
const CoreSurface = @import("../../Surface.zig");
|
||||||
|
const build_options = @import("build_options");
|
||||||
|
|
||||||
const Surface = @import("Surface.zig");
|
const Surface = @import("Surface.zig");
|
||||||
const Window = @import("Window.zig");
|
const Window = @import("Window.zig");
|
||||||
@ -53,7 +54,7 @@ pub fn init(core_app: *CoreApp, opts: Options) !App {
|
|||||||
_ = opts;
|
_ = opts;
|
||||||
|
|
||||||
// Initialize libadwaita
|
// Initialize libadwaita
|
||||||
c.adw_init();
|
if (build_options.libadwaita) c.adw_init();
|
||||||
|
|
||||||
// Load our configuration
|
// Load our configuration
|
||||||
var config = try Config.load(core_app.alloc);
|
var config = try Config.load(core_app.alloc);
|
||||||
@ -67,14 +68,16 @@ pub fn init(core_app: *CoreApp, opts: Options) !App {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set the style based on our configuration file
|
// Set the style based on our configuration file
|
||||||
c.adw_style_manager_set_color_scheme(
|
if (build_options.libadwaita) {
|
||||||
c.adw_style_manager_get_default(),
|
c.adw_style_manager_set_color_scheme(
|
||||||
switch (config.@"window-theme") {
|
c.adw_style_manager_get_default(),
|
||||||
.system => c.ADW_COLOR_SCHEME_PREFER_LIGHT,
|
switch (config.@"window-theme") {
|
||||||
.dark => c.ADW_COLOR_SCHEME_FORCE_DARK,
|
.system => c.ADW_COLOR_SCHEME_PREFER_LIGHT,
|
||||||
.light => c.ADW_COLOR_SCHEME_FORCE_LIGHT,
|
.dark => c.ADW_COLOR_SCHEME_FORCE_DARK,
|
||||||
},
|
.light => c.ADW_COLOR_SCHEME_FORCE_LIGHT,
|
||||||
);
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// The "none" cursor is used for hiding the cursor
|
// The "none" cursor is used for hiding the cursor
|
||||||
const cursor_none = c.gdk_cursor_new_from_name("none", null);
|
const cursor_none = c.gdk_cursor_new_from_name("none", null);
|
||||||
|
Reference in New Issue
Block a user