st/scroll-view: Make fade effect take ClutterMargin

Instead of taking just vertical/horizontal offsets, take a ClutterMargin
to allow us set the fade offsets on each direction specifically. Also,
handle negative values in margins, the fade effect will run in the negative
space left by the scrollview padding instead. Another difference now is
that areas outside the extents of the effect will be transparent, instead
of the effect ending abruptly past the given extents.

This will be used by the app grid, in order to selectively let see either
of next/prev pages while navigating.

While at it, fix code style issues in st_scroll_view_update_fade_effect(),
and clean up unused variables from the GLSL code.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1630>
This commit is contained in:
Carlos Garnacho
2021-02-03 12:07:34 +01:00
committed by Marge Bot
parent 8cb3825d48
commit f60a469a34
5 changed files with 89 additions and 105 deletions

View File

@ -264,7 +264,13 @@ var BaseAppView = GObject.registerClass({
return;
}
this._scrollView.update_fade_effect(vOffset, hOffset);
this._scrollView.update_fade_effect(
new Clutter.Margin({
left: hOffset,
right: hOffset,
top: vOffset,
bottom: vOffset,
}));
}
_createGrid() {