From 5cbc55578fb16d862cc0fa34433a90dcb70a0789 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 28 Oct 2020 20:18:54 -0400 Subject: [PATCH] textview: Update child allocations This was accidentally lost when display line caching was introduced. --- gtk/gtktextlayout.c | 9 +++++++++ gtk/gtktextlayoutprivate.h | 6 +++++- gtk/gtktextlinedisplaycache.c | 6 ++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/gtk/gtktextlayout.c b/gtk/gtktextlayout.c index e6c5b5b280..57983ae6b7 100644 --- a/gtk/gtktextlayout.c +++ b/gtk/gtktextlayout.c @@ -2002,6 +2002,13 @@ allocate_child_widgets (GtkTextLayout *text_layout, pango_layout_iter_free (run_iter); } +void +gtk_text_layout_update_children (GtkTextLayout *text_layout, + GtkTextLineDisplay *display) +{ + allocate_child_widgets (text_layout, display); +} + static void convert_color (GdkRGBA *result, PangoAttrColor *attr) @@ -2663,6 +2670,8 @@ gtk_text_layout_create_display (GtkTextLayout *layout, if (tags != NULL) g_ptr_array_free (tags, TRUE); + display->has_children = saw_widget; + if (saw_widget) allocate_child_widgets (layout, display); diff --git a/gtk/gtktextlayoutprivate.h b/gtk/gtktextlayoutprivate.h index 2f0c7122f1..368cfd0940 100644 --- a/gtk/gtktextlayoutprivate.h +++ b/gtk/gtktextlayoutprivate.h @@ -214,13 +214,15 @@ struct _GtkTextLineDisplay GtkTextLine *line; GdkRectangle block_cursor; + guint cursors_invalid : 1; guint has_block_cursor : 1; guint cursor_at_line_end : 1; guint size_only : 1; + guint pg_bg_rgba_set : 1; + guint has_children : 1; GdkRGBA pg_bg_rgba; - guint pg_bg_rgba_set : 1; }; #ifdef GTK_COMPILATION @@ -337,6 +339,8 @@ GtkTextLineDisplay *gtk_text_layout_create_display (GtkTextLayout *layout, void gtk_text_layout_update_display_cursors (GtkTextLayout *layout, GtkTextLine *line, GtkTextLineDisplay *display); +void gtk_text_layout_update_children (GtkTextLayout *layout, + GtkTextLineDisplay *display); gboolean _gtk_text_layout_get_block_cursor (GtkTextLayout *layout, GdkRectangle *pos); gboolean gtk_text_layout_clamp_iter_to_vrange (GtkTextLayout *layout, diff --git a/gtk/gtktextlinedisplaycache.c b/gtk/gtktextlinedisplaycache.c index 27f05ad660..677de11572 100644 --- a/gtk/gtktextlinedisplaycache.c +++ b/gtk/gtktextlinedisplaycache.c @@ -294,6 +294,9 @@ gtk_text_line_display_cache_get (GtkTextLineDisplayCache *cache, if (!size_only && display->line == cache->cursor_line) gtk_text_layout_update_display_cursors (layout, display->line, display); + if (!size_only && display->has_children) + gtk_text_layout_update_children (layout, display); + /* Move to front of MRU */ g_queue_unlink (&cache->mru, &display->mru_link); g_queue_push_head_link (&cache->mru, &display->mru_link); @@ -322,6 +325,9 @@ gtk_text_line_display_cache_get (GtkTextLineDisplayCache *cache, if (line == cache->cursor_line) gtk_text_layout_update_display_cursors (layout, line, display); + if (display->has_children) + gtk_text_layout_update_children (layout, display); + gtk_text_line_display_cache_take_display (cache, gtk_text_line_display_ref (display), layout);