st: Account for children in StWidget's get_paint_volume
Now that StWidget is a group of sorts, it needs to account for its children in its paint volume. Unfortunately, this causes havoc for StBoxLayout, so it needs fixing - it's unknown why it worked when chaining up to near-identical code in StContainer. https://bugzilla.gnome.org/show_bug.cgi?id=670034
This commit is contained in:
parent
e7f0b1dc59
commit
be3eb308b9
@ -991,8 +991,25 @@ st_box_layout_get_paint_volume (ClutterActor *actor,
|
||||
{
|
||||
StBoxLayout *self = ST_BOX_LAYOUT (actor);
|
||||
gdouble x, y;
|
||||
StBoxLayoutPrivate *priv = self->priv;
|
||||
StThemeNode *theme_node = st_widget_get_theme_node (ST_WIDGET (actor));
|
||||
ClutterActorBox allocation_box;
|
||||
ClutterActorBox content_box;
|
||||
ClutterVertex origin;
|
||||
|
||||
if (!CLUTTER_ACTOR_CLASS (st_box_layout_parent_class)->get_paint_volume (actor, volume))
|
||||
/* When have an adjustment we are clipped to the content box, so base
|
||||
* our paint volume on that. */
|
||||
if (priv->hadjustment || priv->vadjustment)
|
||||
{
|
||||
clutter_actor_get_allocation_box (actor, &allocation_box);
|
||||
st_theme_node_get_content_box (theme_node, &allocation_box, &content_box);
|
||||
origin.x = content_box.x1 - allocation_box.x1;
|
||||
origin.y = content_box.y1 - allocation_box.y2;
|
||||
origin.z = 0.f;
|
||||
clutter_paint_volume_set_width (volume, content_box.x2 - content_box.x1);
|
||||
clutter_paint_volume_set_height (volume, content_box.y2 - content_box.y1);
|
||||
}
|
||||
else if (!CLUTTER_ACTOR_CLASS (st_box_layout_parent_class)->get_paint_volume (actor, volume))
|
||||
return FALSE;
|
||||
|
||||
/* When scrolled, st_box_layout_apply_transform() includes the scroll offset
|
||||
@ -1003,8 +1020,6 @@ st_box_layout_get_paint_volume (ClutterActor *actor,
|
||||
get_border_paint_offsets (self, &x, &y);
|
||||
if (x != 0 || y != 0)
|
||||
{
|
||||
ClutterVertex origin;
|
||||
|
||||
clutter_paint_volume_get_origin (volume, &origin);
|
||||
origin.x += x;
|
||||
origin.y += y;
|
||||
|
@ -30,37 +30,6 @@
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE (StContainer, st_container, ST_TYPE_WIDGET);
|
||||
|
||||
static gboolean
|
||||
st_container_get_paint_volume (ClutterActor *actor,
|
||||
ClutterPaintVolume *volume)
|
||||
{
|
||||
if (!CLUTTER_ACTOR_CLASS (st_container_parent_class)->get_paint_volume (actor, volume))
|
||||
return FALSE;
|
||||
|
||||
if (!clutter_actor_get_clip_to_allocation (actor))
|
||||
{
|
||||
ClutterActor *child;
|
||||
|
||||
/* Based on ClutterGroup/ClutterBox; include the children's
|
||||
* paint volumes, since they may paint outside our allocation.
|
||||
*/
|
||||
for (child = clutter_actor_get_first_child (actor);
|
||||
child != NULL;
|
||||
child = clutter_actor_get_next_sibling (child))
|
||||
{
|
||||
const ClutterPaintVolume *child_volume;
|
||||
|
||||
child_volume = clutter_actor_get_transformed_paint_volume (child, actor);
|
||||
if (!child_volume)
|
||||
return FALSE;
|
||||
|
||||
clutter_paint_volume_union (volume, child_volume);
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
st_container_init (StContainer *container)
|
||||
{
|
||||
@ -69,7 +38,4 @@ st_container_init (StContainer *container)
|
||||
static void
|
||||
st_container_class_init (StContainerClass *klass)
|
||||
{
|
||||
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
|
||||
|
||||
actor_class->get_paint_volume = st_container_get_paint_volume;
|
||||
}
|
||||
|
@ -713,6 +713,26 @@ st_widget_get_paint_volume (ClutterActor *self,
|
||||
clutter_paint_volume_set_width (volume, paint_box.x2 - paint_box.x1);
|
||||
clutter_paint_volume_set_height (volume, paint_box.y2 - paint_box.y1);
|
||||
|
||||
if (!clutter_actor_get_clip_to_allocation (self))
|
||||
{
|
||||
ClutterActor *child;
|
||||
/* Based on ClutterGroup/ClutterBox; include the children's
|
||||
* paint volumes, since they may paint outside our allocation.
|
||||
*/
|
||||
for (child = clutter_actor_get_first_child (self);
|
||||
child != NULL;
|
||||
child = clutter_actor_get_next_sibling (child))
|
||||
{
|
||||
const ClutterPaintVolume *child_volume;
|
||||
|
||||
child_volume = clutter_actor_get_transformed_paint_volume (child, self);
|
||||
if (!child_volume)
|
||||
return FALSE;
|
||||
|
||||
clutter_paint_volume_union (volume, child_volume);
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user