mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-09-17 19:24:52 +00:00
Merge pull request #822 from gpanders/split-resizing
macos: implement split resizing
This commit is contained in:
@@ -92,6 +92,9 @@ pub const App = struct {
|
||||
/// Focus the previous/next split (if any).
|
||||
focus_split: ?*const fn (SurfaceUD, input.SplitFocusDirection) callconv(.C) void = null,
|
||||
|
||||
/// Resize the current split.
|
||||
resize_split: ?*const fn (SurfaceUD, input.SplitResizeDirection, u16) callconv(.C) void = null,
|
||||
|
||||
/// Zoom the current split.
|
||||
toggle_split_zoom: ?*const fn (SurfaceUD) callconv(.C) void = null,
|
||||
|
||||
@@ -384,6 +387,15 @@ pub const Surface = struct {
|
||||
func(self.opts.userdata, direction);
|
||||
}
|
||||
|
||||
pub fn resizeSplit(self: *const Surface, direction: input.SplitResizeDirection, amount: u16) void {
|
||||
const func = self.app.opts.resize_split orelse {
|
||||
log.info("runtime embedder does not support resize split", .{});
|
||||
return;
|
||||
};
|
||||
|
||||
func(self.opts.userdata, direction, amount);
|
||||
}
|
||||
|
||||
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", .{});
|
||||
@@ -1374,6 +1386,14 @@ pub const CAPI = struct {
|
||||
ptr.gotoSplit(direction);
|
||||
}
|
||||
|
||||
/// Resize the current split by moving the split divider in the given
|
||||
/// direction. `direction` specifies which direction the split divider will
|
||||
/// move relative to the focused split. `amount` is a fractional value
|
||||
/// between 0 and 1 that specifies by how much the divider will move.
|
||||
export fn ghostty_surface_split_resize(ptr: *Surface, direction: input.SplitResizeDirection, amount: u16) void {
|
||||
ptr.resizeSplit(direction, amount);
|
||||
}
|
||||
|
||||
/// Invoke an action on the surface.
|
||||
export fn ghostty_surface_binding_action(
|
||||
ptr: *Surface,
|
||||
|
||||
Reference in New Issue
Block a user