summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-11-02 08:07:56 -0500
committerMatthias Clasen <mclasen@redhat.com>2020-11-02 08:11:35 -0500
commit34e365e11a87cce53f243bccaff00da236894089 (patch)
tree0cb9c9bb7d7f2d3ac05f46a2c688cc4d8238eff4
parentefc314196d639a6216add81b440495a556f2183e (diff)
downloadgtk+-try-to-fix-list-scrolling.tar.gz
listbase: Don't hand out invalid positionstry-to-fix-list-scrolling
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.
-rw-r--r--gtk/gtklistbase.c3
1 files changed, 3 insertions, 0 deletions
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);
}