From 50c4fdbacd20a48e39a6b633eaad6822566411c2 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Wed, 26 Nov 2014 18:10:21 -0800 Subject: [PATCH] gtktextdisplay: Optimize GtkStyleContext usage --- gtk/gtktextdisplay.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gtk/gtktextdisplay.c b/gtk/gtktextdisplay.c index 420db81fff..6be8fe2c8c 100644 --- a/gtk/gtktextdisplay.c +++ b/gtk/gtktextdisplay.c @@ -587,14 +587,18 @@ render_para (GtkTextRenderer *text_renderer, screen_width = line_display->total_width; context = gtk_widget_get_style_context (text_renderer->widget); - state = gtk_widget_get_state_flags (text_renderer->widget); + gtk_style_context_save (context); + state = gtk_style_context_get_state (context); state |= GTK_STATE_FLAG_SELECTED; + gtk_style_context_set_state (context, state); G_GNUC_BEGIN_IGNORE_DEPRECATIONS gtk_style_context_get_background_color (context, state, &selection); G_GNUC_END_IGNORE_DEPRECATIONS + gtk_style_context_restore (context); + do { PangoLayoutLine *line = pango_layout_iter_get_line_readonly (iter);