From fdfd76774e9e2e0b704f455026f63e93f42d3c04 Mon Sep 17 00:00:00 2001 From: Corey Berla Date: Tue, 29 Nov 2022 20:00:48 -0800 Subject: [PATCH] treeexpander: Scroll to expanded item If the anchor is below the expanded item, the expanded item will go out of view if there are sufficient children items. This is not ideal, so make sure to scroll to the item to ensure it remains in view. --- gtk/gtktreeexpander.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gtk/gtktreeexpander.c b/gtk/gtktreeexpander.c index d2cce546a3..a89a51eb0b 100644 --- a/gtk/gtktreeexpander.c +++ b/gtk/gtktreeexpander.c @@ -503,11 +503,17 @@ gtk_tree_expander_toggle_expand (GtkWidget *widget, GVariant *parameter) { GtkTreeExpander *self = GTK_TREE_EXPANDER (widget); + gboolean expand; if (self->list_row == NULL) return; - gtk_tree_list_row_set_expanded (self->list_row, !gtk_tree_list_row_get_expanded (self->list_row)); + expand = !gtk_tree_list_row_get_expanded (self->list_row); + + if (expand) + gtk_widget_activate_action (widget, "listitem.scroll-to", NULL); + + gtk_tree_list_row_set_expanded (self->list_row, expand); } static gboolean -- 2.30.2