From cdd76a3b0b571bebb7be61cb7c1bfd5988a42641 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 2 Nov 2023 11:07:12 -0700 Subject: [PATCH] apprt/gtk: alternate approach to setting pane children --- src/apprt/gtk/Split.zig | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/apprt/gtk/Split.zig b/src/apprt/gtk/Split.zig index a15697fba..fcf7f5d05 100644 --- a/src/apprt/gtk/Split.zig +++ b/src/apprt/gtk/Split.zig @@ -204,17 +204,12 @@ pub fn replace( const pos = c.gtk_paned_get_position(self.paned); defer c.gtk_paned_set_position(self.paned, pos); - if (ptr == &self.top_left) { - c.gtk_paned_set_start_child( - @ptrCast(self.paned), - self.top_left.widget(), - ); - } else { - c.gtk_paned_set_end_child( - @ptrCast(self.paned), - self.bottom_right.widget(), - ); - } + // We have to set both to null. If we overwrite the pane with + // the same value, then GTK bugs out (the GL area unrealizes + // and never rerealizes). + c.gtk_paned_set_start_child(@ptrCast(self.paned), null); + c.gtk_paned_set_end_child(@ptrCast(self.paned), null); + self.updateChildren(); } /// Update the paned children to represent the current state.