listbase: Allocate gridview items properly on RTL

We need to flip the items.
This commit is contained in:
Benjamin Otte 2020-06-24 05:42:38 +02:00
parent 147388e69a
commit 724c9361f3

View File

@ -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);