Re: Alignment bug in label




Damon Chaplin <damon@karuna.freeserve.co.uk> writes:

> If you open the font selection dialog in testgtk (latest CVS) the
> 'Reset Filter' button is not aligned properly.
> 
> This is the code to create it:
> 
>   fontsel->filter_button = gtk_button_new_with_label(_("Reset Filter"));
>   gtk_misc_set_padding (GTK_MISC (GTK_BIN (fontsel->filter_button)->child),
> 			16, 0);
> 
> It should be centered, shouldn't it?

Thanks for the report. The following patch seems to fix it.

                                        Owen

Index: gtklabel.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtklabel.c,v
retrieving revision 1.38
diff -u -r1.38 gtklabel.c
--- gtklabel.c	1999/01/12 15:12:05	1.38
+++ gtklabel.c	1999/01/12 20:37:31
@@ -921,12 +921,12 @@
       gdk_gc_set_clip_rectangle (widget->style->fg_gc[widget->state], &event->area);
       
       x = widget->allocation.x + misc->xpad +
-	(widget->allocation.width - label->max_width) 
+	(widget->allocation.width - label->max_width - 2 * misc->xpad) 
 	* misc->xalign + 0.5;
       
       y = (widget->allocation.y
 	   + (widget->allocation.height
-	      - widget->requisition.height) * misc->yalign
+	      - widget->requisition.height - 2 * misc->ypad) * misc->yalign
 	   + misc->ypad + 0.5);
       for (word = label->words; word; word = word->next)
 	{



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