From ddb309815c406e91e1dd563d55be18535cc3cf84 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Wed, 16 May 2018 21:57:38 +0000 Subject: [PATCH] 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 4bf033a8853591e9f739b2a067009698e476f7e9) --- src/st/st-box-layout.c | 35 ++++++++++++++++++++++++++++++++--- src/st/st-scroll-view.c | 8 ++++++++ 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/src/st/st-box-layout.c b/src/st/st-box-layout.c index ffb74770c..12fe86910 100644 --- a/src/st/st-box-layout.c +++ b/src/st/st-box-layout.c @@ -490,7 +490,7 @@ st_box_layout_get_paint_volume (ClutterActor *actor, ClutterPaintVolume *volume) { StBoxLayout *self = ST_BOX_LAYOUT (actor); - gdouble x, y; + gdouble x, y, lower, upper; StBoxLayoutPrivate *priv = self->priv; StThemeNode *theme_node = st_widget_get_theme_node (ST_WIDGET (actor)); ClutterActorBox allocation_box; @@ -505,13 +505,42 @@ st_box_layout_get_paint_volume (ClutterActor *actor, * our paint volume on that. */ if (priv->hadjustment || priv->vadjustment) { + gdouble width, height; + 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); + + 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)) return FALSE; diff --git a/src/st/st-scroll-view.c b/src/st/st-scroll-view.c index bb26f540b..fc0db1c99 100644 --- a/src/st/st-scroll-view.c +++ b/src/st/st-scroll-view.c @@ -304,6 +304,13 @@ st_scroll_view_pick (ClutterActor *actor, 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 get_scrollbar_width (StScrollView *scroll, gfloat for_height) @@ -793,6 +800,7 @@ st_scroll_view_class_init (StScrollViewClass *klass) actor_class->paint = st_scroll_view_paint; 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_height = st_scroll_view_get_preferred_height; actor_class->allocate = st_scroll_view_allocate;