summaryrefslogtreecommitdiff
path: root/src/apprt
diff options
context:
space:
mode:
authorrhodes-b <59537185+rhodes-b@users.noreply.github.com>2025-09-21 22:59:42 -0500
committerrhodes-b <59537185+rhodes-b@users.noreply.github.com>2025-09-21 22:59:42 -0500
commitfd9014952fce6151bd0070cabd648dbdc7c7227a (patch)
treea3e71e313c8046b1fc5e43c00015bb2cf47ac61d /src/apprt
parent4e7f847d039bf4b3be721ffded46ef75521f3a3d (diff)
use getter to notify is-split property
Diffstat (limited to 'src/apprt')
-rw-r--r--src/apprt/gtk/class/split_tree.zig29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/apprt/gtk/class/split_tree.zig b/src/apprt/gtk/class/split_tree.zig
index 35161b4d6..69a4e40f3 100644
--- a/src/apprt/gtk/class/split_tree.zig
+++ b/src/apprt/gtk/class/split_tree.zig
@@ -125,7 +125,7 @@ pub const SplitTree = extern struct {
Self,
bool,
.{
- .setter = setIsSplit,
+ .getter = getIsSplit,
},
),
},
@@ -541,10 +541,16 @@ pub const SplitTree = extern struct {
));
}
- fn setIsSplit(self: *Self, v: bool) void {
- const priv = self.private();
- priv.is_split = v;
- self.as(gobject.Object).notifyByPspec(properties.@"is-split".impl.param_spec);
+ fn getIsSplit(self: *Self) bool {
+ const tree: *const Surface.Tree = self.private().tree orelse &.empty;
+ if (tree.isEmpty()) return false;
+
+ const root_handle: Surface.Tree.Node.Handle = .root;
+ const root = tree.nodes[root_handle.idx()];
+ return switch (root) {
+ .leaf => false,
+ .split => true,
+ };
}
//---------------------------------------------------------------
@@ -844,16 +850,6 @@ pub const SplitTree = extern struct {
));
}
- // Determine if tree has more than one surface
- const root_handle: Surface.Tree.Node.Handle = .root;
- const root = tree.nodes[root_handle.idx()];
- const is_split: bool = switch (root) {
- .leaf => false,
- .split => true,
- };
-
- self.setIsSplit(is_split);
-
// If we have a last focused surface, we need to refocus it, because
// during the frame between setting the bin to null and rebuilding,
// GTK will reset our focus state (as it should!)
@@ -862,6 +858,9 @@ pub const SplitTree = extern struct {
v.grabFocus();
}
+ // Our split status may have changed
+ self.as(gobject.Object).notifyByPspec(properties.@"is-split".impl.param_spec);
+
// Our active surface may have changed
self.as(gobject.Object).notifyByPspec(properties.@"active-surface".impl.param_spec);