From 34e365e11a87cce53f243bccaff00da236894089 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 2 Nov 2020 08:07:56 -0500 Subject: [PATCH] listbase: Don't hand out invalid positions gtk_list_base_get_position_from_allocation relies on the rbtree allocations being valid, and thus can't really be used more than once before doing a size_allocate. We generally queue a resize when we invalidate the rbtree in response to handling input events, so we can use the resize_needed flag as a proxy for the tree being invalid. This change prevents the jumpy scrolling that is currently happening when we manage to get two scroll events during a single frame cycle, where the scrollbar sometimes jumps to the other end of a long list. --- gtk/gtklistbase.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gtk/gtklistbase.c b/gtk/gtklistbase.c index ed4f84ad2a..73d401c075 100644 --- a/gtk/gtklistbase.c +++ b/gtk/gtklistbase.c @@ -132,6 +132,9 @@ gtk_list_base_get_position_from_allocation (GtkListBase *self, guint *pos, cairo_rectangle_int_t *area) { + if (widget->priv->resize_needed) + return FALSE; + return GTK_LIST_BASE_GET_CLASS (self)->get_position_from_allocation (self, across, along, pos, area); }