mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-07-27 19:16:27 +00:00
apprt: switch to reload_config action that calls update_config API
This commit is contained in:
@@ -47,11 +47,6 @@ pub const App = struct {
|
||||
/// Callback called to handle an action.
|
||||
action: *const fn (*App, apprt.Target.C, apprt.Action.C) callconv(.C) void,
|
||||
|
||||
/// Reload the configuration and return the new configuration.
|
||||
/// The old configuration can be freed immediately when this is
|
||||
/// called.
|
||||
reload_config: *const fn (AppUD) callconv(.C) ?*const Config,
|
||||
|
||||
/// Read the clipboard value. The return value must be preserved
|
||||
/// by the host until the next call. If there is no valid clipboard
|
||||
/// value then this should return null.
|
||||
@@ -375,16 +370,6 @@ pub const App = struct {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn reloadConfig(self: *App) !?*const Config {
|
||||
// Reload
|
||||
if (self.opts.reload_config(self.opts.userdata)) |new| {
|
||||
self.config = new;
|
||||
return self.config;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
pub fn wakeup(self: App) void {
|
||||
self.opts.wakeup(self.opts.userdata);
|
||||
}
|
||||
@@ -1374,10 +1359,14 @@ pub const CAPI = struct {
|
||||
};
|
||||
}
|
||||
|
||||
/// Reload the configuration.
|
||||
export fn ghostty_app_reload_config(v: *App) void {
|
||||
_ = v.core_app.reloadConfig(v) catch |err| {
|
||||
log.err("error reloading config err={}", .{err});
|
||||
/// Update the configuration to the provided config. This will propagate
|
||||
/// to all surfaces as well.
|
||||
export fn ghostty_app_update_config(
|
||||
v: *App,
|
||||
config: *const Config,
|
||||
) void {
|
||||
v.core_app.updateConfig(v, config) catch |err| {
|
||||
log.err("error updating config err={}", .{err});
|
||||
return;
|
||||
};
|
||||
}
|
||||
@@ -1434,6 +1423,17 @@ pub const CAPI = struct {
|
||||
return surface.newSurfaceOptions();
|
||||
}
|
||||
|
||||
/// Update the configuration to the provided config for only this surface.
|
||||
export fn ghostty_surface_update_config(
|
||||
surface: *Surface,
|
||||
config: *const Config,
|
||||
) void {
|
||||
surface.core_surface.updateConfig(config) catch |err| {
|
||||
log.err("error updating config err={}", .{err});
|
||||
return;
|
||||
};
|
||||
}
|
||||
|
||||
/// Returns true if the surface needs to confirm quitting.
|
||||
export fn ghostty_surface_needs_confirm_quit(surface: *Surface) bool {
|
||||
return surface.core_surface.needsConfirmQuit();
|
||||
|
||||
Reference in New Issue
Block a user