macos: add key binding for equalizing split sizes

This commit is contained in:
Gregory Anders
2023-11-07 16:15:46 -06:00
parent 36dd5ef4ee
commit cd01340cce
12 changed files with 103 additions and 4 deletions

View File

@@ -95,6 +95,9 @@ pub const App = struct {
/// Resize the current split.
resize_split: ?*const fn (SurfaceUD, input.SplitResizeDirection, u16) callconv(.C) void = null,
/// Equalize all splits in the current window
equalize_splits: ?*const fn (SurfaceUD) callconv(.C) void = null,
/// Zoom the current split.
toggle_split_zoom: ?*const fn (SurfaceUD) callconv(.C) void = null,
@@ -396,6 +399,15 @@ pub const Surface = struct {
func(self.opts.userdata, direction, amount);
}
pub fn equalizeSplits(self: *const Surface) void {
const func = self.app.opts.equalize_splits orelse {
log.info("runtime embedder does not support equalize splits", .{});
return;
};
func(self.opts.userdata);
}
pub fn toggleSplitZoom(self: *const Surface) void {
const func = self.app.opts.toggle_split_zoom orelse {
log.info("runtime embedder does not support split zoom", .{});
@@ -1388,6 +1400,11 @@ pub const CAPI = struct {
ptr.resizeSplit(direction, amount);
}
/// Equalize the size of all splits in the current window.
export fn ghostty_surface_split_equalize(ptr: *Surface) void {
ptr.equalizeSplits();
}
/// Invoke an action on the surface.
export fn ghostty_surface_binding_action(
ptr: *Surface,