[sushi] font-widget: always render background when drawing



commit ec524548722d1b4475852c9b1e710e4b8c61c333
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Mon Mar 4 18:19:24 2013 -0500

    font-widget: always render background when drawing
    
    This is needed if we want crossfades and transitions with GdStack to
    work properly.

 src/libsushi/sushi-font-widget.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/src/libsushi/sushi-font-widget.c b/src/libsushi/sushi-font-widget.c
index 2d6f237..76634fc 100644
--- a/src/libsushi/sushi-font-widget.c
+++ b/src/libsushi/sushi-font-widget.c
@@ -474,13 +474,20 @@ sushi_font_widget_draw (GtkWidget *drawing_area,
   GdkRGBA color;
   GtkBorder padding;
   GtkStateFlags state;
-  gint allocated_height;
+  gint allocated_width, allocated_height;
 
   if (face == NULL)
     goto end;
 
   context = gtk_widget_get_style_context (drawing_area);
   state = gtk_style_context_get_state (context);
+
+  allocated_width = gtk_widget_get_allocated_width (drawing_area);
+  allocated_height = gtk_widget_get_allocated_height (drawing_area);
+
+  gtk_render_background (context, cr,
+                         0, 0, allocated_width, allocated_height);
+
   gtk_style_context_get_color (context, state, &color);
   gtk_style_context_get_padding (context, state, &padding);
 
@@ -492,8 +499,6 @@ sushi_font_widget_draw (GtkWidget *drawing_area,
   cairo_set_font_face (cr, font);
   cairo_font_face_destroy (font);
 
-  allocated_height = gtk_widget_get_allocated_height (drawing_area);
-
   /* draw text */
 
   if (self->priv->font_name != NULL) {
@@ -596,6 +601,9 @@ sushi_font_widget_init (SushiFontWidget *self)
 
   if (err != FT_Err_Ok)
     g_error ("Unable to initialize FreeType");
+
+  gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (self)),
+                               GTK_STYLE_CLASS_VIEW);
 }
 
 static void


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