[gtk+/wip/background-rework: 16/25] toolpalette: don't call gtk_style_context_set_background()



commit fa2cd167d11f6358918c92614288b99ec5f743b4
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Sat Jun 27 12:52:58 2015 -0700

    toolpalette: don't call gtk_style_context_set_background()

 gtk/gtktoolpalette.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtktoolpalette.c b/gtk/gtktoolpalette.c
index 4d25292..70ca79f 100644
--- a/gtk/gtktoolpalette.c
+++ b/gtk/gtktoolpalette.c
@@ -740,9 +740,6 @@ gtk_tool_palette_realize (GtkWidget *widget)
   gtk_widget_set_window (widget, window);
   gtk_widget_register_window (widget, window);
 
-  gtk_style_context_set_background (gtk_widget_get_style_context (widget),
-                                    window);
-
   gtk_container_forall (GTK_CONTAINER (widget),
                         (GtkCallback) gtk_widget_set_parent_window,
                         window);
@@ -761,6 +758,18 @@ gtk_tool_palette_adjustment_value_changed (GtkAdjustment *adjustment,
   gtk_tool_palette_size_allocate (widget, &allocation);
 }
 
+static gboolean
+gtk_tool_palette_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_palette_parent_class)->draw (widget, cr);
+}
+
 static void
 gtk_tool_palette_add (GtkContainer *container,
                       GtkWidget    *child)
@@ -914,6 +923,7 @@ gtk_tool_palette_class_init (GtkToolPaletteClass *cls)
   wclass->get_preferred_height= gtk_tool_palette_get_preferred_height;
   wclass->size_allocate       = gtk_tool_palette_size_allocate;
   wclass->realize             = gtk_tool_palette_realize;
+  wclass->draw                = gtk_tool_palette_draw;
 
   cclass->add                 = gtk_tool_palette_add;
   cclass->remove              = gtk_tool_palette_remove;


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