defer channel tree scrolling until realized

This commit is contained in:
2026-09-14 04:11:23 -06:00
parent d7aebb784d
commit e94ffd9d79

View File

@@ -300,6 +300,14 @@ cv_tree_focus (chan *ch)
path = gtk_tree_model_get_path (model, &ch->iter);
if (path)
{
if (!gtk_widget_get_realized (GTK_WIDGET (tree)))
{
/* Layout changes can restore focus before the new tree is realized.
* Let GTK track the row and scroll once its geometry is available. */
gtk_tree_view_scroll_to_cell (tree, path, NULL, TRUE, 0.5, 0.5);
}
else
{
/* This full section does what
* gtk_tree_view_scroll_to_cell (tree, path, NULL, TRUE, 0.5, 0.5);
@@ -322,6 +330,7 @@ cv_tree_focus (chan *ch)
dest_y = 0;
gtk_tree_view_scroll_to_point (tree, -1, dest_y);
}
}
/* theft done, now make it focused like */
gtk_tree_view_set_cursor (tree, path, NULL, FALSE);
gtk_tree_path_free (path);