gtk: rebind is-split after moving split cross-tree

It turns out we never unbound the split from its original tree after
moving, which means `is-split` in particular is desynced and leads to
hilarious artifacts like how `unfocused-split-*` options just stop
working properly. I only realized this is a thing after the naïve
drag handle config option didn't work properly. Fun!
This commit is contained in:
Leah Amelia Chen
2026-08-09 12:02:44 +08:00
parent 65a3e666ef
commit 850ca8c7b1
2 changed files with 17 additions and 6 deletions

View File

@@ -239,12 +239,7 @@ pub const SplitTree = extern struct {
}
// Bind is-split property for new surface
_ = self.as(gobject.Object).bindProperty(
"is-split",
surface.as(gobject.Object),
"is-split",
.{ .sync_create = true },
);
surface.bindIsSplit(self);
// Create our tree
var single_tree = try Surface.Tree.init(alloc, surface);
@@ -452,6 +447,9 @@ pub const SplitTree = extern struct {
// Finally, set the final tree structures for both tree widgets
source_tree_widget.setTree(&new_source_tree);
self.setTree(&after_split);
// Re-bind vital properties like `is-split`
source.bindIsSplit(self);
}
}

View File

@@ -691,6 +691,7 @@ pub const Surface = extern struct {
// True if the current surface is a split, this is used to apply
// unfocused-split-* options
is_split: bool = false,
is_split_binding: ?*gobject.Binding = null,
action_group: ?*gio.SimpleActionGroup = null,
@@ -847,6 +848,18 @@ pub const Surface = extern struct {
return @intFromBool(config.@"bell-features".border);
}
pub fn bindIsSplit(self: *Self, tree: *SplitTree) void {
const priv = self.private();
if (priv.is_split_binding) |bind| bind.unbind();
priv.is_split_binding = tree.as(gobject.Object).bindProperty(
"is-split",
self.as(gobject.Object),
"is-split",
.{ .sync_create = true },
);
}
/// Callback used to determine whether unfocused-split-fill / unfocused-split-opacity
/// should be applied to the surface
fn closureShouldUnfocusedSplitBeShown(