[gnome-shell] scroll-view: Make scrollbar position locale aware
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] scroll-view: Make scrollbar position locale aware
- Date: Thu, 24 Feb 2011 12:04:06 +0000 (UTC)
commit d15122c4b2a5714f2516b26a915ef384f3ae3cfc
Author: Florian Müllner <fmuellner gnome org>
Date: Thu Feb 24 01:34:44 2011 +0100
scroll-view: Make scrollbar position locale aware
In RTL locales, the vertical scrollbar should be located on the
left, so take the widget's text direction into account when
allocating the view's elements.
https://bugzilla.gnome.org/show_bug.cgi?id=643156
src/st/st-scroll-view.c | 36 ++++++++++++++++++++++++++++++------
1 files changed, 30 insertions(+), 6 deletions(-)
---
diff --git a/src/st/st-scroll-view.c b/src/st/st-scroll-view.c
index c56182e..3f7c12a 100644
--- a/src/st/st-scroll-view.c
+++ b/src/st/st-scroll-view.c
@@ -595,9 +595,17 @@ st_scroll_view_allocate (ClutterActor *actor,
/* Vertical scrollbar */
if (CLUTTER_ACTOR_IS_VISIBLE (priv->vscroll))
{
- child_box.x1 = content_box.x2 - sb_width;
+ if (st_widget_get_direction (ST_WIDGET (actor)) == ST_TEXT_DIRECTION_RTL)
+ {
+ child_box.x1 = content_box.x1;
+ child_box.x2 = content_box.x1 + sb_width;
+ }
+ else
+ {
+ child_box.x1 = content_box.x2 - sb_width;
+ child_box.x2 = content_box.x2;
+ }
child_box.y1 = content_box.y1;
- child_box.x2 = content_box.x2;
child_box.y2 = content_box.y2 - (hscrollbar_visible ? sb_height : 0);
clutter_actor_allocate (priv->vscroll, &child_box, flags);
@@ -606,9 +614,17 @@ st_scroll_view_allocate (ClutterActor *actor,
/* Horizontal scrollbar */
if (CLUTTER_ACTOR_IS_VISIBLE (priv->hscroll))
{
- child_box.x1 = content_box.x1;
+ if (st_widget_get_direction (ST_WIDGET (actor)) == ST_TEXT_DIRECTION_RTL)
+ {
+ child_box.x1 = content_box.x1 + (vscrollbar_visible ? sb_width : 0);
+ child_box.x2 = content_box.x2;
+ }
+ else
+ {
+ child_box.x1 = content_box.x1;
+ child_box.x2 = content_box.x2 - (vscrollbar_visible ? sb_width : 0);
+ }
child_box.y1 = content_box.y2 - sb_height;
- child_box.x2 = content_box.x2 - (vscrollbar_visible ? sb_width : 0);
child_box.y2 = content_box.y2;
clutter_actor_allocate (priv->hscroll, &child_box, flags);
@@ -623,9 +639,17 @@ st_scroll_view_allocate (ClutterActor *actor,
sb_width = 0;
/* Child */
- child_box.x1 = content_box.x1;
+ if (st_widget_get_direction (ST_WIDGET (actor)) == ST_TEXT_DIRECTION_RTL)
+ {
+ child_box.x1 = content_box.x1 + sb_width;
+ child_box.x2 = content_box.x2;
+ }
+ else
+ {
+ child_box.x1 = content_box.x1;
+ child_box.x2 = content_box.x2 - sb_width;
+ }
child_box.y1 = content_box.y1;
- child_box.x2 = content_box.x2 - sb_width;
child_box.y2 = content_box.y2 - sb_height;
if (priv->child)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]