[gtksourceview/gnome-3-18] GutterRendererText: save/restore StyleContext when getting color



commit 22d6aec0d72b02f754ee57607cc1c7604e7d11a3
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Wed Nov 25 15:21:39 2015 +0100

    GutterRendererText: save/restore StyleContext when getting color

 gtksourceview/gtksourcegutterrenderertext.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/gtksourceview/gtksourcegutterrenderertext.c b/gtksourceview/gtksourcegutterrenderertext.c
index d6706ba..ff1b2a0 100644
--- a/gtksourceview/gtksourcegutterrenderertext.c
+++ b/gtksourceview/gtksourcegutterrenderertext.c
@@ -65,7 +65,15 @@ create_layout (GtkSourceGutterRendererText *renderer,
        layout = gtk_widget_create_pango_layout (widget, NULL);
 
        context = gtk_widget_get_style_context (widget);
-       gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &color);
+
+       gtk_style_context_save (context);
+       gtk_style_context_set_state (context, GTK_STATE_FLAG_NORMAL);
+
+       gtk_style_context_get_color (context,
+                                    gtk_style_context_get_state (context),
+                                    &color);
+
+       gtk_style_context_restore (context);
 
        attr = pango_attr_foreground_new (color.red * 65535,
                                          color.green * 65535,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]