]> Pileus Git - ~andy/gtk/commitdiff
TextView: Properly render background
authorAlexander Larsson <alexl@redhat.com>
Fri, 1 Mar 2013 11:23:59 +0000 (12:23 +0100)
committerAlexander Larsson <alexl@redhat.com>
Fri, 1 Mar 2013 11:50:20 +0000 (12:50 +0100)
We always need to render the background, as the window
background is not always set (i.e. during gtk_widget_draw()) or
when its partially visible.

https://bugzilla.gnome.org/show_bug.cgi?id=694925

gtk/gtktextview.c

index 5845aae439478a168fd191bf0acf82a63b0bdefc..48b6441a33a6a8b7041a630ff724909a86414330 100644 (file)
@@ -5153,9 +5153,22 @@ gtk_text_view_draw (GtkWidget *widget,
 {
   GSList *tmp_list;
   GdkWindow *window;
-  
+  GtkStyleContext *context;
+
+  context = gtk_widget_get_style_context (widget);
+
   if (gtk_cairo_should_draw_window (cr, gtk_widget_get_window (widget)))
-    gtk_text_view_draw_focus (widget, cr);
+    {
+      gtk_style_context_save (context);
+      gtk_style_context_add_class (context, GTK_STYLE_CLASS_VIEW);
+      gtk_render_background (context, cr,
+                            0, 0,
+                            gtk_widget_get_allocated_width (widget),
+                            gtk_widget_get_allocated_height (widget));
+      gtk_style_context_restore (context);
+
+      gtk_text_view_draw_focus (widget, cr);
+    }
 
   window = gtk_text_view_get_window (GTK_TEXT_VIEW (widget),
                                      GTK_TEXT_WINDOW_TEXT);