mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 15:56:13 +03:00
apprt/glfw: update to new reload config action
This commit is contained in:
@ -200,6 +200,8 @@ pub const App = struct {
|
|||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
|
|
||||||
|
.reload_config => try self.reloadConfig(target, value),
|
||||||
|
|
||||||
// Unimplemented
|
// Unimplemented
|
||||||
.new_split,
|
.new_split,
|
||||||
.goto_split,
|
.goto_split,
|
||||||
@ -236,16 +238,34 @@ pub const App = struct {
|
|||||||
/// successful return.
|
/// successful return.
|
||||||
///
|
///
|
||||||
/// The returned pointer value is only valid for a stable self pointer.
|
/// The returned pointer value is only valid for a stable self pointer.
|
||||||
pub fn reloadConfig(self: *App) !?*const Config {
|
fn reloadConfig(
|
||||||
|
self: *App,
|
||||||
|
target: apprt.action.Target,
|
||||||
|
opts: apprt.action.ReloadConfig,
|
||||||
|
) !void {
|
||||||
|
if (opts.soft) {
|
||||||
|
switch (target) {
|
||||||
|
.app => try self.app.updateConfig(self, &self.config),
|
||||||
|
.surface => |core_surface| try core_surface.updateConfig(
|
||||||
|
&self.config,
|
||||||
|
),
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Load our configuration
|
// Load our configuration
|
||||||
var config = try Config.load(self.app.alloc);
|
var config = try Config.load(self.app.alloc);
|
||||||
errdefer config.deinit();
|
errdefer config.deinit();
|
||||||
|
|
||||||
|
// Call into our app to update
|
||||||
|
switch (target) {
|
||||||
|
.app => try self.app.updateConfig(self, &config),
|
||||||
|
.surface => |core_surface| try core_surface.updateConfig(&config),
|
||||||
|
}
|
||||||
|
|
||||||
// Update the existing config, be sure to clean up the old one.
|
// Update the existing config, be sure to clean up the old one.
|
||||||
self.config.deinit();
|
self.config.deinit();
|
||||||
self.config = config;
|
self.config = config;
|
||||||
|
|
||||||
return &self.config;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Toggle the window to fullscreen mode.
|
/// Toggle the window to fullscreen mode.
|
||||||
|
Reference in New Issue
Block a user