[gnome-builder] column-layout: reverse layout for RTL languages
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] column-layout: reverse layout for RTL languages
- Date: Mon, 10 Oct 2016 22:37:54 +0000 (UTC)
commit 690f9f0d2c2f7299faffc7523fa94887761ce3ad
Author: Christian Hergert <chergert redhat com>
Date: Mon Oct 10 15:35:24 2016 -0700
column-layout: reverse layout for RTL languages
Rather than make the layout more complex when under an RTL
language, we can just flip things around right before we
size allocate our children.
This seems to be the minimal number of strokes to support
RTL for this widget.
https://bugzilla.gnome.org/show_bug.cgi?id=772700
contrib/egg/egg-column-layout.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/contrib/egg/egg-column-layout.c b/contrib/egg/egg-column-layout.c
index 7a3ebd2..dc8cb11 100644
--- a/contrib/egg/egg-column-layout.c
+++ b/contrib/egg/egg-column-layout.c
@@ -266,6 +266,22 @@ egg_column_layout_size_allocate (GtkWidget *widget,
egg_column_layout_layout (self, allocation->width, allocation->height, &tallest_column);
+ /*
+ * If we are on a RTL language, flip all our allocations around so
+ * we move from right to left. This is easier than adding all the
+ * complexity to directions during layout time.
+ */
+ if (GTK_TEXT_DIR_RTL == gtk_widget_get_direction (widget))
+ {
+ for (i = 0; i < priv->children->len; i++)
+ {
+ EggColumnLayoutChild *child;
+
+ child = &g_array_index (priv->children, EggColumnLayoutChild, i);
+ child->alloc.x = allocation->x + allocation->width - child->alloc.x - child->alloc.width;
+ }
+ }
+
for (i = 0; i < priv->children->len; i++)
{
EggColumnLayoutChild *child;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]