diff options
author | Matthias Clasen <mclasen@redhat.com> | 2021-11-05 18:54:06 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2021-11-08 14:17:42 -0500 |
commit | 4c029af6cdd655d365ab6112857a8ea4ce6c7dcd (patch) | |
tree | 236a851df35fdbac39f215f6dcefc87ae7f1978f /gtk/gtktextview.c | |
parent | 1c6efea370b0c8e00e23d5f438777a44a1e8c094 (diff) | |
download | gtk+-4c029af6cdd655d365ab6112857a8ea4ce6c7dcd.tar.gz |
textview: Don't leave embedded children behind
When scrolling embedded widgets out of view,
they sometimes get left behind because we don't
reallocated them. To avoid that, move _all_ children
out of view in size_allocate, and let the current
child allocation plumbing move the visible ones
back in place.
Diffstat (limited to 'gtk/gtktextview.c')
-rw-r--r-- | gtk/gtktextview.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index 340d12b2d9..db23e9ad86 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -4409,6 +4409,8 @@ gtk_text_view_allocate_children (GtkTextView *text_view) { const AnchoredChild *child = iter->data; GtkTextIter child_loc; + GtkRequisition child_req; + GtkAllocation allocation; /* We need to force-validate the regions containing children. */ gtk_text_buffer_get_iter_at_child_anchor (get_buffer (text_view), @@ -4429,6 +4431,15 @@ gtk_text_view_allocate_children (GtkTextView *text_view) } gtk_text_layout_validate_yrange (priv->layout, &child_loc, 0, 1); + + gtk_widget_get_preferred_size (child->widget, &child_req, NULL); + + allocation.x = - child_req.width; + allocation.y = - child_req.height; + allocation.width = child_req.width; + allocation.height = child_req.height; + + gtk_widget_size_allocate (child->widget, &allocation, -1); } } |