diff options
author | Cosimo Cecchi <cosimoc@gnome.org> | 2015-07-01 14:32:12 -0700 |
---|---|---|
committer | Cosimo Cecchi <cosimoc@gnome.org> | 2015-07-01 16:09:23 -0700 |
commit | a9b45e7c3cadfd90ad2ae92f9f3014b0d324c134 (patch) | |
tree | a2f95b6be7bca1fd6da64de4ce073987f6e1c2af /gtk/gtklayout.c | |
parent | 380ebbf76d526897633bc1ea4336180677632245 (diff) | |
download | gtk+-a9b45e7c3cadfd90ad2ae92f9f3014b0d324c134.tar.gz |
layout: add a comment for gtk_style_context_set_background()
And wrap it with G_GNUC_IGNORE_DEPRECATIONS.
Unfortunately we can't stop rendering the background altogether here.
Also, refactor some common code in a single function.
Diffstat (limited to 'gtk/gtklayout.c')
-rw-r--r-- | gtk/gtklayout.c | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/gtk/gtklayout.c b/gtk/gtklayout.c index dd8f68ed10..26b74f2981 100644 --- a/gtk/gtklayout.c +++ b/gtk/gtklayout.c @@ -858,6 +858,25 @@ gtk_layout_init (GtkLayout *layout) /* Widget methods */ +static void +set_background (GtkWidget *widget) +{ + GtkLayoutPrivate *priv; + + if (gtk_widget_get_realized (widget)) + { + priv = GTK_LAYOUT (widget)->priv; + + /* We still need to call gtk_style_context_set_background() here for + * GtkLayout, since subclasses like EelCanvas depend on a background to + * be set since the beginning of the draw() implementation. + * This should be revisited next time we have a major API break. + */ + G_GNUC_BEGIN_IGNORE_DEPRECATIONS; + gtk_style_context_set_background (gtk_widget_get_style_context (widget), priv->bin_window); + G_GNUC_END_IGNORE_DEPRECATIONS; + } +} static void gtk_layout_realize (GtkWidget *widget) @@ -903,7 +922,7 @@ gtk_layout_realize (GtkWidget *widget) priv->bin_window = gdk_window_new (window, &attributes, attributes_mask); gtk_widget_register_window (widget, priv->bin_window); - gtk_style_context_set_background (gtk_widget_get_style_context (widget), priv->bin_window); + set_background (widget); tmp_list = priv->children; while (tmp_list) @@ -918,15 +937,9 @@ gtk_layout_realize (GtkWidget *widget) static void gtk_layout_style_updated (GtkWidget *widget) { - GtkLayoutPrivate *priv; - GTK_WIDGET_CLASS (gtk_layout_parent_class)->style_updated (widget); - if (gtk_widget_get_realized (widget)) - { - priv = GTK_LAYOUT (widget)->priv; - gtk_style_context_set_background (gtk_widget_get_style_context (widget), priv->bin_window); - } + set_background (widget); } static void |