[gnome-shell] StScrollViewFade: Fix scrollbar size handling
- From: Adel Gadllah <agadllah src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] StScrollViewFade: Fix scrollbar size handling
- Date: Wed, 29 Jun 2011 16:50:18 +0000 (UTC)
commit 620330db8f7d4952336f6176fb8ab89aa1af19cf
Author: Adel Gadllah <adel gadllah gmail com>
Date: Sat Jun 4 23:35:24 2011 +0200
StScrollViewFade: Fix scrollbar size handling
Only skip the areas of the scrollbars when they are invisible
and add take the horizontal scrollbar into account as well
when calculating the faded area.
https://bugzilla.gnome.org/show_bug.cgi?id=651866
src/st/st-scroll-view-fade.c | 20 +++++++++++++++++---
1 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/src/st/st-scroll-view-fade.c b/src/st/st-scroll-view-fade.c
index 74e430d..e5d5bed 100644
--- a/src/st/st-scroll-view-fade.c
+++ b/src/st/st-scroll-view-fade.c
@@ -40,6 +40,7 @@ static const gchar *fade_glsl_shader =
"uniform float height;\n"
"uniform float width;\n"
"uniform float scrollbar_width;\n"
+"uniform float scrollbar_height;\n"
"uniform float offset_bottom;\n"
"uniform float offset_top;\n"
"uniform bool rtl;\n"
@@ -52,10 +53,10 @@ static const gchar *fade_glsl_shader =
" float ratio = 1.0;\n"
" float fade_bottom_start = height - offset_bottom;\n"
" float ratio_top = y / offset_top;\n"
-" float ratio_bottom = (height - y)/(height - fade_bottom_start);\n"
+" float ratio_bottom = (height - scrollbar_height - y)/(height - scrollbar_height - fade_bottom_start);\n"
" bool in_scroll_area = ((rtl && x > scrollbar_width) || (!rtl && x < (width - scrollbar_width)));\n"
" bool fade_top = y < offset_top && in_scroll_area;\n"
-" bool fade_bottom = y > fade_bottom_start && in_scroll_area;\n"
+" bool fade_bottom = y > fade_bottom_start && in_scroll_area && (y < (height - scrollbar_height));\n"
"\n"
" if (fade_top) {\n"
" ratio = ratio_top;\n"
@@ -81,6 +82,7 @@ struct _StScrollViewFade
gint height_uniform;
gint width_uniform;
gint scrollbar_width_uniform;
+ gint scrollbar_height_uniform;
gint offset_top_uniform;
gint offset_bottom_uniform;
gint rtl_uniform;
@@ -145,6 +147,8 @@ st_scroll_view_fade_pre_paint (ClutterEffect *effect)
cogl_program_get_uniform_location (self->program, "width");
self->scrollbar_width_uniform =
cogl_program_get_uniform_location (self->program, "scrollbar_width");
+ self->scrollbar_height_uniform =
+ cogl_program_get_uniform_location (self->program, "scrollbar_height");
self->rtl_uniform =
cogl_program_get_uniform_location (self->program, "rtl");
self->offset_top_uniform =
@@ -177,6 +181,13 @@ 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;
+
+ g_object_get (ST_SCROLL_VIEW (self->actor),
+ "hscrollbar-visible", &h_scroll_visible,
+ "vscrollbar-visible", &v_scroll_visible,
+ NULL);
if (self->program == COGL_INVALID_HANDLE)
goto out;
@@ -204,7 +215,9 @@ st_scroll_view_fade_paint_target (ClutterOffscreenEffect *effect)
if (self->width_uniform > -1)
cogl_program_set_uniform_1f (self->program, self->width_uniform, clutter_actor_get_width (self->actor));
if (self->scrollbar_width_uniform > -1)
- cogl_program_set_uniform_1f (self->program, self->scrollbar_width_uniform, clutter_actor_get_width (vscroll));
+ cogl_program_set_uniform_1f (self->program, self->scrollbar_width_uniform, v_scroll_visible ? clutter_actor_get_width (vscroll) : 0);
+ if (self->scrollbar_height_uniform > -1)
+ cogl_program_set_uniform_1f (self->program, self->scrollbar_height_uniform, h_scroll_visible ? clutter_actor_get_height (hscroll) : 0);
if (self->rtl_uniform > -1)
cogl_program_set_uniform_1i (self->program, self->rtl_uniform, (st_widget_get_direction (ST_WIDGET (self->actor)) == ST_TEXT_DIRECTION_RTL));
@@ -416,6 +429,7 @@ st_scroll_view_fade_init (StScrollViewFade *self)
self->height_uniform = -1;
self->width_uniform = -1;
self->scrollbar_width_uniform = -1;
+ self->scrollbar_height_uniform = -1;
self->rtl_uniform = -1;
self->offset_top_uniform = -1;
self->offset_bottom_uniform = -1;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]