Merge branch 'matthiasc/for-master' into 'master'

textview: Update child allocations

See merge request GNOME/gtk!2757
This commit is contained in:
Matthias Clasen 2020-10-29 11:21:30 +00:00
commit 90fde9c939
3 changed files with 20 additions and 1 deletions

View File

@ -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);

View File

@ -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,

View File

@ -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);