[gnome-shell/wip/carlosg/appgrid-navigation: 29/29] st/scrollview: Apply correct fade_edges_left/right effect uniforms in RTL




commit ca6499d8e8cbd517ceee3daa43a204bbc37e74ca
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sat Feb 27 20:23:19 2021 +0100

    st/scrollview: Apply correct fade_edges_left/right effect uniforms in RTL
    
    When the setting is false, we apply anyway depending on the adjustment
    value. Look for the right value corresponding to that side as per the
    locale.

 src/st/st-scroll-view-fade.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/src/st/st-scroll-view-fade.c b/src/st/st-scroll-view-fade.c
index 3ca7313372..b387e384a5 100644
--- a/src/st/st-scroll-view-fade.c
+++ b/src/st/st-scroll-view-fade.c
@@ -94,7 +94,7 @@ st_scroll_view_fade_paint_target (ClutterOffscreenEffect *effect,
   gdouble value, lower, upper, page_size;
   ClutterActor *vscroll = st_scroll_view_get_vscroll_bar (ST_SCROLL_VIEW (self->actor));
   ClutterActor *hscroll = st_scroll_view_get_hscroll_bar (ST_SCROLL_VIEW (self->actor));
-  gboolean h_scroll_visible, v_scroll_visible;
+  gboolean h_scroll_visible, v_scroll_visible, rtl;
 
   ClutterActorBox allocation, content_box, paint_box;
   ClutterMargin *content_padding;
@@ -158,8 +158,15 @@ st_scroll_view_fade_paint_target (ClutterOffscreenEffect *effect,
 
   st_adjustment_get_values (self->hadjustment, &value, &lower, &upper, NULL, NULL, &page_size);
   value = (value - lower) / (upper - page_size - lower);
-  clutter_shader_effect_set_uniform (shader, "fade_edges_left", G_TYPE_INT, 1, self->fade_edges ? value >= 
0.0 : value > 0.0);
-  clutter_shader_effect_set_uniform (shader, "fade_edges_right", G_TYPE_INT, 1, self->fade_edges ? value <= 
1.0 : value < 1.0);
+  rtl = clutter_actor_get_text_direction (self->actor) == CLUTTER_TEXT_DIRECTION_RTL;
+  clutter_shader_effect_set_uniform (shader, "fade_edges_left", G_TYPE_INT, 1,
+                                     self->fade_edges ?
+                                     value >= 0.0 :
+                                     (rtl ? value < 1.0 : value > 0.0));
+  clutter_shader_effect_set_uniform (shader, "fade_edges_right", G_TYPE_INT, 1,
+                                     self->fade_edges ?
+                                     value <= 1.0 :
+                                     (rtl ? value > 0.0 : value < 1.0));
 
   clutter_shader_effect_set_uniform (shader, "fade_offset_top", G_TYPE_FLOAT, 1, ABS 
(self->fade_margins.top));
   clutter_shader_effect_set_uniform (shader, "fade_offset_bottom", G_TYPE_FLOAT, 1, ABS 
(self->fade_margins.bottom));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]