toolitemgroup: don't use gtk_style_context_set_background()
authorCosimo Cecchi <cosimoc@gnome.org>
Sat, 27 Jun 2015 19:59:59 +0000 (12:59 -0700)
committerCosimo Cecchi <cosimoc@gnome.org>
Wed, 1 Jul 2015 23:09:23 +0000 (16:09 -0700)
gtk/gtktoolitemgroup.c

index 94655b753688ad9a962313121a3e037692ecfa3d..785785d641749a3a615787a28c6243cee5541917 100644 (file)
@@ -1215,13 +1215,10 @@ gtk_tool_item_group_realize (GtkWidget *widget)
   GdkWindowAttr attributes;
   gint attributes_mask;
   guint border_width;
-  GtkStyleContext *context;
 
   gtk_widget_set_realized (widget, TRUE);
 
   border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
-  context = gtk_widget_get_style_context (widget);
-
   gtk_widget_get_allocation (widget, &allocation);
 
   attributes.window_type = GDK_WINDOW_CHILD;
@@ -1243,8 +1240,6 @@ gtk_tool_item_group_realize (GtkWidget *widget)
 
   gtk_widget_register_window (widget, window);
 
-  gtk_style_context_set_background (context, window);
-
   gtk_container_forall (GTK_CONTAINER (widget),
                         (GtkCallback) gtk_widget_set_parent_window,
                         window);
@@ -1263,6 +1258,18 @@ gtk_tool_item_group_unrealize (GtkWidget *widget)
   GTK_WIDGET_CLASS (gtk_tool_item_group_parent_class)->unrealize (widget);
 }
 
+static gboolean
+gtk_tool_item_group_draw (GtkWidget *widget,
+                          cairo_t   *cr)
+{
+  gtk_render_background (gtk_widget_get_style_context (widget), cr,
+                         0, 0,
+                         gtk_widget_get_allocated_width (widget),
+                         gtk_widget_get_allocated_height (widget));
+
+  return GTK_WIDGET_CLASS (gtk_tool_item_group_parent_class)->draw (widget, cr);
+}
+
 static void
 gtk_tool_item_group_style_updated (GtkWidget *widget)
 {
@@ -1584,6 +1591,7 @@ gtk_tool_item_group_class_init (GtkToolItemGroupClass *cls)
   wclass->unrealize            = gtk_tool_item_group_unrealize;
   wclass->style_updated        = gtk_tool_item_group_style_updated;
   wclass->screen_changed       = gtk_tool_item_group_screen_changed;
+  wclass->draw                 = gtk_tool_item_group_draw;
 
   cclass->add                = gtk_tool_item_group_add;
   cclass->remove             = gtk_tool_item_group_remove;