[gtk+] TextView: Properly render background



commit b5ee44b419a5daa01605af8cd419b03d9e21926c
Author: Alexander Larsson <alexl redhat com>
Date:   Fri Mar 1 12:23:59 2013 +0100

    TextView: Properly render background
    
    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 |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 5845aae..48b6441 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -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);


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