From 33c074c738b5e92e3c7efebeca7083db98c4dc72 Mon Sep 17 00:00:00 2001 From: Julian Sparber Date: Thu, 7 Dec 2023 17:37:35 +0100 Subject: [PATCH] st/scroll-view: Allow removing edge fade Remove the fade effect when the css property `-st-vfade-offset` is removed from a widget. The effect isn't added when the property never existed. Part-of: --- src/st/st-scroll-view.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/st/st-scroll-view.c b/src/st/st-scroll-view.c index 8c7636126..1da7ce91f 100644 --- a/src/st/st-scroll-view.c +++ b/src/st/st-scroll-view.c @@ -720,24 +720,20 @@ static void st_scroll_view_style_changed (StWidget *widget) { StScrollView *self = ST_SCROLL_VIEW (widget); - gboolean has_vfade, has_hfade; double vfade_offset = 0.0; double hfade_offset = 0.0; StThemeNode *theme_node = st_widget_get_theme_node (widget); - has_vfade = st_theme_node_lookup_length (theme_node, "-st-vfade-offset", FALSE, &vfade_offset); - has_hfade = st_theme_node_lookup_length (theme_node, "-st-hfade-offset", FALSE, &hfade_offset); - if (has_vfade || has_hfade) - { - st_scroll_view_update_fade_effect (self, - &(ClutterMargin) { - .top = vfade_offset, - .bottom = vfade_offset, - .left = hfade_offset, - .right = hfade_offset, - }); - } + st_theme_node_lookup_length (theme_node, "-st-vfade-offset", FALSE, &vfade_offset); + st_theme_node_lookup_length (theme_node, "-st-hfade-offset", FALSE, &hfade_offset); + st_scroll_view_update_fade_effect (self, + &(ClutterMargin) { + .top = vfade_offset, + .bottom = vfade_offset, + .left = hfade_offset, + .right = hfade_offset, + }); ST_WIDGET_CLASS (st_scroll_view_parent_class)->style_changed (widget); }