[gtk/style-context-redux: 2/4] gskpango: Stop using style context getters



commit a8ecb1a5047c0c557b8b5537555a8611c5f812d4
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Jan 18 09:50:04 2020 -0500

    gskpango: Stop using style context getters
    
    Just go to the css nodes directly.

 gtk/gskpango.c | 26 +++++++++++---------------
 1 file changed, 11 insertions(+), 15 deletions(-)
---
diff --git a/gtk/gskpango.c b/gtk/gskpango.c
index ae7bbb3672..7bdd78f45c 100644
--- a/gtk/gskpango.c
+++ b/gtk/gskpango.c
@@ -307,7 +307,6 @@ static void
 gsk_pango_renderer_prepare_run (PangoRenderer  *renderer,
                                 PangoLayoutRun *run)
 {
-  GtkStyleContext *context;
   GskPangoRenderer *crenderer = GSK_PANGO_RENDERER (renderer);
   GdkRGBA *bg_rgba = NULL;
   GdkRGBA *fg_rgba = NULL;
@@ -315,8 +314,6 @@ gsk_pango_renderer_prepare_run (PangoRenderer  *renderer,
 
   PANGO_RENDERER_CLASS (gsk_pango_renderer_parent_class)->prepare_run (renderer, run);
 
-  appearance = get_item_appearance (run->item);
-
   if (appearance == NULL)
     return;
 
@@ -332,22 +329,21 @@ gsk_pango_renderer_prepare_run (PangoRenderer  *renderer,
   if (crenderer->state == GSK_PANGO_RENDERER_SELECTED &&
       GTK_IS_TEXT_VIEW (crenderer->widget))
     {
-      GtkCssNode *selection_node;
-
-      selection_node = gtk_text_view_get_selection_node ((GtkTextView *)crenderer->widget);
-      gtk_style_context_save_to_node (context, selection_node);
+      GtkCssNode *node;
+      GtkCssValue *value;
 
-      gtk_style_context_get (context,
-                             "color", &fg_rgba,
-                             NULL);
-
-      gtk_style_context_restore (context);
+      node = gtk_text_view_get_selection_node ((GtkTextView *)crenderer->widget);
+      value = gtk_css_node_get_value (selection_node, GTK_CSS_PROPERTY_COLOR);
+      fg_rgba = _gtk_css_rgba_value_get_rgba (value);
     }
   else if (crenderer->state == GSK_PANGO_RENDERER_CURSOR && gtk_widget_has_focus (crenderer->widget))
     {
-      gtk_style_context_get (context,
-                             "background-color", &fg_rgba,
-                             NULL);
+      GtkCssNode *node;
+      GtkCssValue *value;
+
+      node = gtk_widget_get_css_node (widget);
+      value = gtk_css_node_get_value (priv->cssnode, GTK_CSS_PROPERTY_BACKGROUND_COLOR);
+      fg_rgba = _gtk_css_rgba_value_get_rgba (value);
     }
   else
     fg_rgba = appearance->fg_rgba;


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