[gtk+/gtk-3-0] GtkGrid: Add forgotten RTL flipping



commit be19d1ae1439f0b389024a89d5e9b6ab1c4a604b
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 bd305f6..56f6c16 100644
--- a/gtk/gtkgrid.c
+++ b/gtk/gtkgrid.c
@@ -1207,6 +1207,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]