]> Pileus Git - ~andy/gtk/commitdiff
textview: Set background on the widget's window
authorCarlos Garnacho <carlosg@gnome.org>
Thu, 12 Jan 2012 02:05:54 +0000 (03:05 +0100)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 24 Feb 2012 03:29:31 +0000 (22:29 -0500)
The widget window is usually covered by the bin_window.
Its background color will become relevant when we introduce
kinetic scrolling with overshooting.

gtk/gtktextview.c

index 808bdd6a5c70f34f0a6ddd3452a6813203396a39..9f787462df0757c8a2d33734a9aadf8d641fdc80 100644 (file)
@@ -3984,12 +3984,10 @@ gtk_text_view_realize (GtkWidget *widget)
   GtkTextView *text_view;
   GtkTextViewPrivate *priv;
   GtkStyleContext *context;
-  GtkStateFlags state;
   GdkWindow *window;
   GdkWindowAttr attributes;
   gint attributes_mask;
   GSList *tmp_list;
-  GdkRGBA color;
 
   text_view = GTK_TEXT_VIEW (widget);
   priv = text_view->priv;
@@ -4015,10 +4013,11 @@ gtk_text_view_realize (GtkWidget *widget)
   gdk_window_set_user_data (window, widget);
 
   context = gtk_widget_get_style_context (widget);
-  state = gtk_widget_get_state_flags (widget);
 
-  gtk_style_context_get_background_color (context, state, &color);
-  gdk_window_set_background_rgba (window, &color);
+  gtk_style_context_save (context);
+  gtk_style_context_add_class (context, GTK_STYLE_CLASS_VIEW);
+  gtk_style_context_set_background (context, window);
+  gtk_style_context_restore (context);
 
   text_window_realize (priv->text_window, widget);
 
@@ -4118,16 +4117,14 @@ gtk_text_view_set_background (GtkTextView *text_view)
   gtk_style_context_save (context);
   gtk_style_context_add_class (context, GTK_STYLE_CLASS_VIEW);
 
-  gtk_style_context_get_background_color (context, state, &color);
-  gdk_window_set_background_rgba (priv->text_window->bin_window, &color);
+  gtk_style_context_set_background (context, priv->text_window->bin_window);
+  gtk_style_context_set_background (context, gtk_widget_get_window (widget));
 
   gtk_style_context_restore (context);
 
   /* Set lateral panes background */
   gtk_style_context_get_background_color (context, state, &color);
 
-  gdk_window_set_background_rgba (gtk_widget_get_window (widget), &color);
-
   if (priv->left_window)
     gdk_window_set_background_rgba (priv->left_window->bin_window, &color);