[gtk+] gtkbox: fix positioning of center widget



commit ad9019c2c930f0a7310d3861e1bff82758e576b4
Author: Paolo Borelli <pborelli gnome org>
Date:   Mon Feb 17 23:19:10 2014 +0100

    gtkbox: fix positioning of center widget

 gtk/gtkbox.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c
index 19bb0f9..0620081 100644
--- a/gtk/gtkbox.c
+++ b/gtk/gtkbox.c
@@ -1137,7 +1137,11 @@ gtk_box_size_allocate_with_center (GtkWidget     *widget,
     }
 
   /* Allocate the center widget */
-  center_pos = (box_size - center_size) / 2;
+  if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
+    center_pos = allocation->x + (box_size - center_size) / 2;
+  else
+    center_pos = allocation->y + (box_size - center_size) / 2;
+
   if (center_pos < side[GTK_PACK_START])
     center_pos = side[GTK_PACK_START];
   else if (center_pos + center_size > side[GTK_PACK_END])


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]