st-widget: Add a proper paint, add st_widget_paint_background

Since we want to paint children by default in StWidget, we need to
provide a way for custom subclasses to paint their CSS backgrounds
without painting children... introducing st_widget_paint_background.

Additionally, remove any custom paint/pick handlers added by subclasses
of StWidget that just painted their children. This will cause double
painting if left alone.

This also removes the hacky things that some subclasses of StBin did
to prevent their one child to be painted by StBin.

https://bugzilla.gnome.org/show_bug.cgi?id=670034
This commit is contained in:
Jasper St. Pierre
2012-02-13 16:41:29 -05:00
parent a9f728d2a7
commit 64b2c5d1b4
14 changed files with 35 additions and 199 deletions

View File

@ -341,28 +341,44 @@ st_widget_get_preferred_height (ClutterActor *self,
st_theme_node_adjust_preferred_height (theme_node, min_height_p, natural_height_p);
}
static void
st_widget_paint (ClutterActor *actor)
/**
* st_widget_paint_background:
* @widget: The #StWidget
*
* Paint the background of the widget. This is meant to be called by
* subclasses of StWiget that need to paint the background without
* painting children.
*/
void
st_widget_paint_background (StWidget *widget)
{
StWidget *self = ST_WIDGET (actor);
StThemeNode *theme_node;
ClutterActorBox allocation;
guint8 opacity;
theme_node = st_widget_get_theme_node (self);
theme_node = st_widget_get_theme_node (widget);
clutter_actor_get_allocation_box (actor, &allocation);
clutter_actor_get_allocation_box (CLUTTER_ACTOR (widget), &allocation);
opacity = clutter_actor_get_paint_opacity (actor);
opacity = clutter_actor_get_paint_opacity (CLUTTER_ACTOR (widget));
if (self->priv->transition_animation)
st_theme_node_transition_paint (self->priv->transition_animation,
if (widget->priv->transition_animation)
st_theme_node_transition_paint (widget->priv->transition_animation,
&allocation,
opacity);
else
st_theme_node_paint (theme_node, &allocation, opacity);
}
static void
st_widget_paint (ClutterActor *actor)
{
st_widget_paint_background (ST_WIDGET (actor));
/* Chain up so we paint children. */
CLUTTER_ACTOR_CLASS (st_widget_parent_class)->paint (actor);
}
static void
st_widget_parent_set (ClutterActor *widget,
ClutterActor *old_parent)