st: Make StScrollables' paint volume reflect the unconstrained view
And constrain it in StScrollView instead (instead of falling back to an
infinite paint volume, as the actor as paint/pick impls, but no
corresponding get_paint_volume one).
Fixes artifacts with the AppView (and possibly other places) when paint
volumes are aggressively cached.
(cherry picked from commit 4bf033a885
)
This commit is contained in:
parent
6a796675bd
commit
ddb309815c
@ -490,7 +490,7 @@ st_box_layout_get_paint_volume (ClutterActor *actor,
|
|||||||
ClutterPaintVolume *volume)
|
ClutterPaintVolume *volume)
|
||||||
{
|
{
|
||||||
StBoxLayout *self = ST_BOX_LAYOUT (actor);
|
StBoxLayout *self = ST_BOX_LAYOUT (actor);
|
||||||
gdouble x, y;
|
gdouble x, y, lower, upper;
|
||||||
StBoxLayoutPrivate *priv = self->priv;
|
StBoxLayoutPrivate *priv = self->priv;
|
||||||
StThemeNode *theme_node = st_widget_get_theme_node (ST_WIDGET (actor));
|
StThemeNode *theme_node = st_widget_get_theme_node (ST_WIDGET (actor));
|
||||||
ClutterActorBox allocation_box;
|
ClutterActorBox allocation_box;
|
||||||
@ -505,13 +505,42 @@ st_box_layout_get_paint_volume (ClutterActor *actor,
|
|||||||
* our paint volume on that. */
|
* our paint volume on that. */
|
||||||
if (priv->hadjustment || priv->vadjustment)
|
if (priv->hadjustment || priv->vadjustment)
|
||||||
{
|
{
|
||||||
|
gdouble width, height;
|
||||||
|
|
||||||
clutter_actor_get_allocation_box (actor, &allocation_box);
|
clutter_actor_get_allocation_box (actor, &allocation_box);
|
||||||
st_theme_node_get_content_box (theme_node, &allocation_box, &content_box);
|
st_theme_node_get_content_box (theme_node, &allocation_box, &content_box);
|
||||||
origin.x = content_box.x1 - allocation_box.x1;
|
origin.x = content_box.x1 - allocation_box.x1;
|
||||||
origin.y = content_box.y1 - allocation_box.y2;
|
origin.y = content_box.y1 - allocation_box.y2;
|
||||||
origin.z = 0.f;
|
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);
|
if (priv->hadjustment)
|
||||||
|
{
|
||||||
|
g_object_get (priv->hadjustment,
|
||||||
|
"lower", &lower,
|
||||||
|
"upper", &upper,
|
||||||
|
NULL);
|
||||||
|
width = upper - lower;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
width = content_box.x2 - content_box.x1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (priv->vadjustment)
|
||||||
|
{
|
||||||
|
g_object_get (priv->vadjustment,
|
||||||
|
"lower", &lower,
|
||||||
|
"upper", &upper,
|
||||||
|
NULL);
|
||||||
|
height = upper - lower;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
height = content_box.y2 - content_box.y1;
|
||||||
|
}
|
||||||
|
|
||||||
|
clutter_paint_volume_set_width (volume, width);
|
||||||
|
clutter_paint_volume_set_height (volume, height);
|
||||||
}
|
}
|
||||||
else if (!CLUTTER_ACTOR_CLASS (st_box_layout_parent_class)->get_paint_volume (actor, volume))
|
else if (!CLUTTER_ACTOR_CLASS (st_box_layout_parent_class)->get_paint_volume (actor, volume))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -304,6 +304,13 @@ st_scroll_view_pick (ClutterActor *actor,
|
|||||||
clutter_actor_paint (priv->vscroll);
|
clutter_actor_paint (priv->vscroll);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
st_scroll_view_get_paint_volume (ClutterActor *actor,
|
||||||
|
ClutterPaintVolume *volume)
|
||||||
|
{
|
||||||
|
return clutter_paint_volume_set_from_allocation (volume, actor);
|
||||||
|
}
|
||||||
|
|
||||||
static double
|
static double
|
||||||
get_scrollbar_width (StScrollView *scroll,
|
get_scrollbar_width (StScrollView *scroll,
|
||||||
gfloat for_height)
|
gfloat for_height)
|
||||||
@ -793,6 +800,7 @@ st_scroll_view_class_init (StScrollViewClass *klass)
|
|||||||
|
|
||||||
actor_class->paint = st_scroll_view_paint;
|
actor_class->paint = st_scroll_view_paint;
|
||||||
actor_class->pick = st_scroll_view_pick;
|
actor_class->pick = st_scroll_view_pick;
|
||||||
|
actor_class->get_paint_volume = st_scroll_view_get_paint_volume;
|
||||||
actor_class->get_preferred_width = st_scroll_view_get_preferred_width;
|
actor_class->get_preferred_width = st_scroll_view_get_preferred_width;
|
||||||
actor_class->get_preferred_height = st_scroll_view_get_preferred_height;
|
actor_class->get_preferred_height = st_scroll_view_get_preferred_height;
|
||||||
actor_class->allocate = st_scroll_view_allocate;
|
actor_class->allocate = st_scroll_view_allocate;
|
||||||
|
Loading…
Reference in New Issue
Block a user