Merge pull request #794 from hqnna/main

Add option to enable or disable libadwaita
This commit is contained in:
Mitchell Hashimoto
2023-11-02 22:14:59 -07:00
committed by GitHub
3 changed files with 22 additions and 11 deletions

View File

@@ -19,6 +19,7 @@ const internal_os = @import("../../os/main.zig");
const Config = configpkg.Config;
const CoreApp = @import("../../App.zig");
const CoreSurface = @import("../../Surface.zig");
const build_options = @import("build_options");
const Surface = @import("Surface.zig");
const Window = @import("Window.zig");
@@ -53,7 +54,7 @@ pub fn init(core_app: *CoreApp, opts: Options) !App {
_ = opts;
// Initialize libadwaita
c.adw_init();
if (build_options.libadwaita) c.adw_init();
// Load our configuration
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
c.adw_style_manager_set_color_scheme(
c.adw_style_manager_get_default(),
switch (config.@"window-theme") {
.system => c.ADW_COLOR_SCHEME_PREFER_LIGHT,
.dark => c.ADW_COLOR_SCHEME_FORCE_DARK,
.light => c.ADW_COLOR_SCHEME_FORCE_LIGHT,
},
);
if (build_options.libadwaita) {
c.adw_style_manager_set_color_scheme(
c.adw_style_manager_get_default(),
switch (config.@"window-theme") {
.system => c.ADW_COLOR_SCHEME_PREFER_LIGHT,
.dark => c.ADW_COLOR_SCHEME_FORCE_DARK,
.light => c.ADW_COLOR_SCHEME_FORCE_LIGHT,
},
);
}
// The "none" cursor is used for hiding the cursor
const cursor_none = c.gdk_cursor_new_from_name("none", null);