gtk3/0001-GtkGrid-Add-forgotten-RTL-flipping.patch

44 lines
1.3 KiB
Diff
Raw Normal View History

From 20ab58d79910d1829dadfbb717c354cf74a043b1 Mon Sep 17 00:00:00 2001
From: Matthias Clasen <mclasen@redhat.com>
Date: Wed, 30 Mar 2011 02:24:00 -0400
Subject: [PATCH] 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 ();
--
1.7.4.2