[gtk+] tree-view: don't use gtk_style_context_set_background()
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] tree-view: don't use gtk_style_context_set_background()
- Date: Tue, 20 Nov 2012 18:42:32 +0000 (UTC)
commit ddceddaa84222f3f2b40fe5ce3b04dc7ddf6cace
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Tue Nov 20 12:43:37 2012 -0500
tree-view: don't use gtk_style_context_set_background()
Render a background with gtk_render_background() in draw() instead.
Note that we still use gtk_style_context_set_background() for the header
window.
https://bugzilla.gnome.org/show_bug.cgi?id=688744
gtk/gtktreeview.c | 32 +++++++++++++++-----------------
1 files changed, 15 insertions(+), 17 deletions(-)
---
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 2b78b5a..15648f5 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -1768,6 +1768,9 @@ gtk_tree_view_init (GtkTreeView *tree_view)
gtk_tree_view_do_set_vadjustment (tree_view, NULL);
gtk_tree_view_do_set_hadjustment (tree_view, NULL);
+
+ gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (tree_view)),
+ GTK_STYLE_CLASS_VIEW);
}
@@ -2190,13 +2193,6 @@ gtk_tree_view_ensure_background (GtkTreeView *tree_view)
GtkStyleContext *context;
context = gtk_widget_get_style_context (GTK_WIDGET (tree_view));
-
- gtk_style_context_save (context);
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_VIEW);
- gtk_style_context_set_background (context, tree_view->priv->bin_window);
- gtk_style_context_set_background (context, gtk_widget_get_window (GTK_WIDGET (tree_view)));
- gtk_style_context_restore (context);
-
gtk_style_context_set_background (context, tree_view->priv->header_window);
}
@@ -5349,24 +5345,23 @@ gtk_tree_view_draw (GtkWidget *widget,
{
GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
GtkWidget *button;
+ GtkStyleContext *context;
+
+ context = gtk_widget_get_style_context (widget);
+ gtk_render_background (context, cr,
+ 0, 0,
+ gtk_widget_get_allocated_width (widget),
+ gtk_widget_get_allocated_height (widget));
if (gtk_cairo_should_draw_window (cr, tree_view->priv->bin_window))
{
- GtkStyleContext *context;
GList *tmp_list;
- context = gtk_widget_get_style_context (widget);
-
cairo_save (cr);
- gtk_style_context_save (context);
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_VIEW);
-
gtk_cairo_transform_to_window (cr, widget, tree_view->priv->bin_window);
-
gtk_tree_view_bin_draw (widget, cr);
- gtk_style_context_restore (context);
cairo_restore (cr);
/* We can't just chain up to Container::draw as it will try to send the
@@ -5383,6 +5378,9 @@ gtk_tree_view_draw (GtkWidget *widget,
}
}
+ gtk_style_context_save (context);
+ gtk_style_context_remove_class (context, GTK_STYLE_CLASS_VIEW);
+
if (gtk_cairo_should_draw_window (cr, tree_view->priv->header_window))
{
GList *list;
@@ -5411,6 +5409,8 @@ gtk_tree_view_draw (GtkWidget *widget,
button, cr);
}
+ gtk_style_context_restore (context);
+
return FALSE;
}
@@ -14564,8 +14564,6 @@ gtk_tree_view_create_row_drag_icon (GtkTreeView *tree_view,
context = gtk_widget_get_style_context (widget);
gtk_style_context_save (context);
-
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_VIEW);
gtk_style_context_add_region (context, GTK_STYLE_REGION_COLUMN, 0);
gtk_widget_style_get (widget,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]