[gtk+] toolitemgroup: don't use gtk_style_context_set_background()



commit 06b943fec91ff9f1d612473901a0af049857f8e9
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Sat Jun 27 12:59:59 2015 -0700

    toolitemgroup: don't use gtk_style_context_set_background()

 gtk/gtktoolitemgroup.c |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtktoolitemgroup.c b/gtk/gtktoolitemgroup.c
index 94655b7..785785d 100644
--- a/gtk/gtktoolitemgroup.c
+++ b/gtk/gtktoolitemgroup.c
@@ -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;


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