gtk+ r20146 - in trunk: . gtk



Author: jap
Date: Sun May 25 12:29:19 2008
New Revision: 20146
URL: http://svn.gnome.org/viewvc/gtk+?rev=20146&view=rev

Log:
2008-05-25  Jan Arne Petersen  <jpetersen jpetersen org>

	* gtk/gtklabel.c: (get_layout_location): Subtract logical.x from x to
	fix the wrong position for right and center justified labels with
	logical.x > 0 (#530255).



Modified:
   trunk/ChangeLog
   trunk/gtk/gtklabel.c

Modified: trunk/gtk/gtklabel.c
==============================================================================
--- trunk/gtk/gtklabel.c	(original)
+++ trunk/gtk/gtklabel.c	Sun May 25 12:29:19 2008
@@ -2661,6 +2661,7 @@
   GtkLabelPrivate *priv;
   gfloat xalign;
   gint req_width, x, y;
+  PangoRectangle logical;
   
   misc = GTK_MISC (label);
   widget = GTK_WIDGET (label);
@@ -2671,13 +2672,13 @@
   else
     xalign = 1.0 - misc->xalign;
 
+  pango_layout_get_pixel_extents (label->layout, NULL, &logical);
+
   if (label->ellipsize || priv->width_chars > 0)
     {
       int width;
-      PangoRectangle logical;
 
       width = pango_layout_get_width (label->layout);
-      pango_layout_get_pixel_extents (label->layout, NULL, &logical);
 
       req_width = logical.width;
       if (width != -1)
@@ -2694,6 +2695,7 @@
     x = MAX (x, widget->allocation.x + misc->xpad);
   else
     x = MIN (x, widget->allocation.x + widget->allocation.width - misc->xpad);
+  x -= logical.x;
 
   y = floor (widget->allocation.y + (gint)misc->ypad 
              + MAX (((widget->allocation.height - widget->requisition.height) * misc->yalign),



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