From 59629fa9e2aef1b03c60d8ec5e6467129c187bfa Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Wed, 26 Nov 2014 18:10:36 -0800 Subject: [PATCH] gtklabel: Optimize GtkStyleContext usage --- gtk/gtklabel.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c index 4c6417d887..b07f40c130 100644 --- a/gtk/gtklabel.c +++ b/gtk/gtklabel.c @@ -3426,6 +3426,8 @@ gtk_label_update_layout_attributes (GtkLabel *label) attrs = pango_attr_list_new (); + gtk_style_context_save (context); + for (list = priv->select_info->links; list; list = list->next) { GtkLabelLink *link = list->data; @@ -3442,6 +3444,7 @@ gtk_label_update_layout_attributes (GtkLabel *label) else state |= GTK_STATE_FLAG_LINK; + gtk_style_context_set_state (context, state); gtk_style_context_get_color (context, state, &link_color); attribute = pango_attr_foreground_new (link_color.red * 65535, @@ -3451,6 +3454,8 @@ gtk_label_update_layout_attributes (GtkLabel *label) attribute->end_index = link->end; pango_attr_list_insert (attrs, attribute); } + + gtk_style_context_restore (context); } else if (priv->markup_attrs && priv->attrs) attrs = pango_attr_list_new ();