]> Pileus Git - ~andy/gtk/commitdiff
label: Compute label offset properly for wrapped justified labels
authorBenjamin Otte <otte@redhat.com>
Thu, 5 May 2011 15:30:58 +0000 (17:30 +0200)
committerBenjamin Otte <otte@redhat.com>
Thu, 5 May 2011 15:33:44 +0000 (17:33 +0200)
label offsets were computed wrong for wrapped or ellipsized labels that
were right- or center-justified and had excess space available.

gtk/gtklabel.c

index 3b6504e3469bc57362bbb39d7484a5df09b6bcbf..9b9752bc2d2eca084be7775d6926d0680360d391 100644 (file)
@@ -3949,12 +3949,7 @@ get_layout_location (GtkLabel  *label,
 
   gtk_widget_get_allocation (widget, &allocation);
 
-  x = floor (allocation.x + xpad + xalign * (allocation.width - req_width));
-
-  if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
-    x = MAX (x, allocation.x + xpad);
-  else
-    x = MIN (x, allocation.x + allocation.width - xpad);
+  x = floor (allocation.x + xpad + xalign * (allocation.width - req_width) - logical.x);
 
 
   /* bgo#315462 - For single-line labels, *do* align the requisition with