[gtk+/wip/otte/tokenizer: 2/42] boxgadget: Put empty space in front on RTL
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/otte/tokenizer: 2/42] boxgadget: Put empty space in front on RTL
- Date: Sun, 20 Mar 2016 05:01:11 +0000 (UTC)
commit cc44e594bf9b948f070f8f9aaf42c21681aecae1
Author: Benjamin Otte <otte redhat com>
Date: Fri Mar 4 04:05:45 2016 +0100
boxgadget: Put empty space in front on RTL
https://bugzilla.gnome.org/show_bug.cgi?id=762945
gtk/gtkboxgadget.c | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkboxgadget.c b/gtk/gtkboxgadget.c
index 6533b6e..fbe1bea 100644
--- a/gtk/gtkboxgadget.c
+++ b/gtk/gtkboxgadget.c
@@ -111,7 +111,7 @@ gtk_box_gadget_measure_child (GObject *child,
}
}
-static void
+static gint
gtk_box_gadget_distribute (GtkBoxGadget *gadget,
gint for_size,
gint size,
@@ -140,13 +140,13 @@ gtk_box_gadget_distribute (GtkBoxGadget *gadget,
if G_UNLIKELY (size < 0)
{
g_critical ("%s: assertion 'size >= 0' failed in %s", G_STRFUNC, G_OBJECT_TYPE_NAME
(gtk_css_gadget_get_owner (GTK_CSS_GADGET (gadget))));
- return;
+ return 0;
}
size = gtk_distribute_natural_allocation (size, priv->children->len, sizes);
if (size <= 0 || n_expand == 0)
- return;
+ return MAX (0, size);
for (i = 0 ; i < priv->children->len; i++)
{
@@ -162,6 +162,7 @@ gtk_box_gadget_distribute (GtkBoxGadget *gadget,
n_expand--;
}
+ return size;
}
static void
@@ -389,7 +390,14 @@ gtk_box_gadget_allocate (GtkCssGadget *gadget,
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
{
- gtk_box_gadget_distribute (GTK_BOX_GADGET (gadget), allocation->height, allocation->width, sizes);
+ int extra = gtk_box_gadget_distribute (GTK_BOX_GADGET (gadget), allocation->height, allocation->width,
sizes);
+
+ /* put empty space at the front */
+ if (gtk_widget_get_direction (gtk_css_gadget_get_owner (gadget)) == GTK_TEXT_DIR_RTL)
+ {
+ child_allocation.x += extra;
+ child_allocation.width -= extra;
+ }
if (priv->allocate_reverse)
child_allocation.x = allocation->x + allocation->width;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]