apprt/gtk-ng: proper split operations

This commit is contained in:
Mitchell Hashimoto
2025-08-09 12:21:24 -07:00
parent 34be4de018
commit 9ad92d2c3d

View File

@@ -148,10 +148,10 @@ pub const SplitTree = extern struct {
const actions = .{
// All of these will eventually take a target surface parameter.
// For now all our targets originate from the focused surface.
.{ "new-left", actionNew, null },
.{ "new-right", actionNew, null },
.{ "new-up", actionNew, null },
.{ "new-down", actionNew, null },
.{ "new-left", actionNewLeft, null },
.{ "new-right", actionNewRight, null },
.{ "new-up", actionNewUp, null },
.{ "new-down", actionNewDown, null },
};
// We need to collect our actions into a group since we're just
@@ -405,7 +405,21 @@ pub const SplitTree = extern struct {
//---------------------------------------------------------------
// Signal handlers
pub fn actionNew(
pub fn actionNewLeft(
_: *gio.SimpleAction,
parameter_: ?*glib.Variant,
self: *Self,
) callconv(.c) void {
_ = parameter_;
self.newSplit(
.left,
self.getActiveSurface(),
) catch |err| {
log.warn("new split failed error={}", .{err});
};
}
pub fn actionNewRight(
_: *gio.SimpleAction,
parameter_: ?*glib.Variant,
self: *Self,
@@ -419,6 +433,34 @@ pub const SplitTree = extern struct {
};
}
pub fn actionNewUp(
_: *gio.SimpleAction,
parameter_: ?*glib.Variant,
self: *Self,
) callconv(.c) void {
_ = parameter_;
self.newSplit(
.up,
self.getActiveSurface(),
) catch |err| {
log.warn("new split failed error={}", .{err});
};
}
pub fn actionNewDown(
_: *gio.SimpleAction,
parameter_: ?*glib.Variant,
self: *Self,
) callconv(.c) void {
_ = parameter_;
self.newSplit(
.down,
self.getActiveSurface(),
) catch |err| {
log.warn("new split failed error={}", .{err});
};
}
fn propSurfaceFocused(
surface: *Surface,
_: *gobject.ParamSpec,