summaryrefslogtreecommitdiff
path: root/gtk/gtklistbase.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2020-06-24 05:42:38 +0200
committerBenjamin Otte <otte@redhat.com>2020-06-26 07:13:32 +0200
commit724c9361f38ccc8f318c77b1997952a0629e5445 (patch)
tree7d8f28e89536be41177fbbeaa32c1aec82932837 /gtk/gtklistbase.c
parent147388e69a77bee60e32200e52f7555b50100f76 (diff)
downloadgtk+-724c9361f38ccc8f318c77b1997952a0629e5445.tar.gz
listbase: Allocate gridview items properly on RTL
We need to flip the items.
Diffstat (limited to 'gtk/gtklistbase.c')
-rw-r--r--gtk/gtklistbase.c49
1 files changed, 32 insertions, 17 deletions
diff --git a/gtk/gtklistbase.c b/gtk/gtklistbase.c
index 2568b0604e..05df60b30f 100644
--- a/gtk/gtklistbase.c
+++ b/gtk/gtklistbase.c
@@ -1334,7 +1334,7 @@ update_autoscroll (GtkListBase *self,
/**
* gtk_list_base_size_allocate_child:
* @self: The listbase
- * @child:
+ * @child: The child
* @x: top left coordinate in the across direction
* @y: top right coordinate in the along direction
* @width: size in the across direction
@@ -1356,26 +1356,41 @@ gtk_list_base_size_allocate_child (GtkListBase *self,
if (gtk_list_base_get_orientation (GTK_LIST_BASE (self)) == GTK_ORIENTATION_VERTICAL)
{
- child_allocation.x = x;
- child_allocation.y = y;
- child_allocation.width = width;
- child_allocation.height = height;
- }
- else if (_gtk_widget_get_direction (GTK_WIDGET (self)) == GTK_TEXT_DIR_LTR)
- {
- child_allocation.x = y;
- child_allocation.y = x;
- child_allocation.width = height;
- child_allocation.height = width;
+ if (_gtk_widget_get_direction (GTK_WIDGET (self)) == GTK_TEXT_DIR_LTR)
+ {
+ child_allocation.x = x;
+ child_allocation.y = y;
+ child_allocation.width = width;
+ child_allocation.height = height;
+ }
+ else
+ {
+ int mirror_point = gtk_widget_get_width (GTK_WIDGET (self));
+
+ child_allocation.x = mirror_point - x - width;
+ child_allocation.y = y;
+ child_allocation.width = width;
+ child_allocation.height = height;
+ }
}
else
{
- int mirror_point = gtk_widget_get_width (GTK_WIDGET (self));
+ if (_gtk_widget_get_direction (GTK_WIDGET (self)) == GTK_TEXT_DIR_LTR)
+ {
+ child_allocation.x = y;
+ child_allocation.y = x;
+ child_allocation.width = height;
+ child_allocation.height = width;
+ }
+ else
+ {
+ int mirror_point = gtk_widget_get_width (GTK_WIDGET (self));
- child_allocation.x = mirror_point - y - height;
- child_allocation.y = x;
- child_allocation.width = height;
- child_allocation.height = width;
+ child_allocation.x = mirror_point - y - height;
+ child_allocation.y = x;
+ child_allocation.width = height;
+ child_allocation.height = width;
+ }
}
gtk_widget_size_allocate (child, &child_allocation, -1);