insufficient deprecation note for gtk_widget_get_style
Submitted by Stefan Sauer (gstreamer, gtkdoc dev)
Link to original bug (#744517)
Description
Right now I am using this code to paint my clutter-canvas in a color matching the UI-theme:
GtkStyle *style = gtk_widget_get_style (self->priv->canvas_widget); GdkColor *c = &style->base[GTK_STATE_NORMAL]; ClutterColor stage_color = { c->red >> 8, c->green >> 8, c->blue >> 8, 0xff }; clutter_stage_set_color (CLUTTER_STAGE (self->priv->stage), &stage_color);
Unfortuantely gtk_widget_get_style() is deprecated and tells me I should use GtkStyleContext. Voila:
GtkStyleContext *style = gtk_widget_get_style_context (
self->priv->canvas_widget);
GdkRGBA c;
// this seems th be always black
gtk_style_context_get_background_color (style, GTK_STATE_NORMAL, &c);
ClutterColor stage_color = {
c.red * 256, c.green * 256, c.blue * 256, c.alpha * 256
};
clutter_stage_set_color (CLUTTER_STAGE (self->priv->stage), &stage_color);
But gtk_style_context_get_background_color() is also not recommended (bug #742198). So I am a bit short on what I am supposed to do here.