[gtk+] box: Fix RTL styling



commit 36678306a01f7c3e1ca7dca3253f82b79d77248a
Author: Benjamin Otte <otte redhat com>
Date:   Tue May 12 18:27:19 2015 +0200

    box: Fix RTL styling

 gtk/gtkbox.c |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c
index 3a2fb5a..53a52a2 100644
--- a/gtk/gtkbox.c
+++ b/gtk/gtkbox.c
@@ -1448,11 +1448,28 @@ gtk_box_invalidate_order_foreach (GtkWidget *widget,
 }
 
 static void
+gtk_box_invalidate_order_foreach_reverse (GtkWidget *widget,
+                                          gpointer   prev)
+{
+  GtkCssNode **previous = prev;
+  GtkCssNode *cur = gtk_widget_get_css_node (widget);
+
+  if (*previous)
+    gtk_css_node_set_before (cur, *previous);
+
+  *previous = cur;
+}
+
+static void
 gtk_box_invalidate_order (GtkBox *box)
 {
   GtkCssNode *previous = NULL;
+
   gtk_container_foreach (GTK_CONTAINER (box),
-                         gtk_box_invalidate_order_foreach,
+                         (box->priv->orientation == GTK_ORIENTATION_HORIZONTAL
+                          && gtk_widget_get_direction (GTK_WIDGET (box)) == GTK_TEXT_DIR_RTL)
+                         ? gtk_box_invalidate_order_foreach_reverse
+                         : gtk_box_invalidate_order_foreach,
                          &previous);
 }
 


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