[gtk+] GtkGrid: Add forgotten RTL flipping



commit 7a65db0402562ac1339a71d875275b2ac2c72f76
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Mar 30 02:24:00 2011 -0400

    GtkGrid: Add forgotten RTL flipping
    
    How did we manage to add a non-RTL savy container in GTK+ 3.0 ?

 gtk/gtkgrid.c    |    4 ++++
 tests/testgrid.c |    3 +++
 2 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkgrid.c b/gtk/gtkgrid.c
index 4719857..440b4d5 100644
--- a/gtk/gtkgrid.c
+++ b/gtk/gtkgrid.c
@@ -1195,6 +1195,10 @@ gtk_grid_request_allocate_children (GtkGridRequest *request)
       child_allocation.width = MAX (1, width);
       child_allocation.height = MAX (1, height);
 
+      if (gtk_widget_get_direction (GTK_WIDGET (request->grid)) == GTK_TEXT_DIR_RTL)
+        child_allocation.x = allocation.x + allocation.width
+                             - (child_allocation.x - allocation.x) - child_allocation.width;
+
       gtk_widget_size_allocate (child->widget, &child_allocation);
     }
 }
diff --git a/tests/testgrid.c b/tests/testgrid.c
index a59aefe..f9e85bb 100644
--- a/tests/testgrid.c
+++ b/tests/testgrid.c
@@ -252,6 +252,9 @@ main (int argc, char *argv[])
 {
   gtk_init (NULL, NULL);
 
+  if (g_getenv ("RTL"))
+    gtk_widget_set_default_direction (GTK_TEXT_DIR_RTL);
+
   simple_grid ();
   text_grid ();
   box_comparison ();



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