commit 31927abe2c609e29c8226ecc9bd54c5d811128b7
Author: Xan Lopez <xan@niraikanai.(none)>
Date:   Sat Feb 3 00:31:35 2007 +0200

    Fix frame positioning with ythickness != 2.

diff --git a/gtk/gtkframe.c b/gtk/gtkframe.c
index db697c3..957c93c 100644
--- a/gtk/gtkframe.c
+++ b/gtk/gtkframe.c
@@ -493,6 +493,11 @@ gtk_frame_get_shadow_type (GtkFrame *frame)
   return frame->shadow_type;
 }
 
+
+#define EPSILON 1e-10
+
+#define IS_ZERO(x) (((x) < EPSILON)? TRUE : FALSE) 
+
 static void
 gtk_frame_paint (GtkWidget    *widget,
 		 GdkRectangle *area)
@@ -523,21 +528,26 @@ gtk_frame_paint (GtkWidget    *widget,
 	  else
 	    xalign = 1 - frame->label_xalign;
 
-	  height_extra = MAX (0, child_requisition.height - widget->style->ythickness);
-	  g_print ("height extra %d\n", height_extra);
-	  height_extra *= (1 - frame->label_yalign);
+	  height_extra = MAX (0, child_requisition.height - widget->style->ythickness)
+	    - frame->label_yalign * child_requisition.height;
 	  y -= height_extra;
 	  height += height_extra;
 	  
 	  x2 = widget->style->xthickness + (frame->child_allocation.width - child_requisition.width - 2 * LABEL_PAD - 2 * LABEL_SIDE_PAD) * xalign + LABEL_SIDE_PAD;
-
 	  
-	  gtk_paint_shadow_gap (widget->style, widget->window,
-				widget->state, frame->shadow_type,
-				area, widget, "frame",
-				x, y, width, height,
-				GTK_POS_TOP, 
-				x2, child_requisition.width + 2 * LABEL_PAD);
+	  /* If the label is completely over or under the frame we can omit the gap */
+	  if (IS_ZERO (frame->label_yalign) || frame->label_yalign == 1.0)
+	    gtk_paint_shadow (widget->style, widget->window,
+			      widget->state, frame->shadow_type,
+			      area, widget, "frame",
+			      x, y, width, height);
+	  else
+	    gtk_paint_shadow_gap (widget->style, widget->window,
+				  widget->state, frame->shadow_type,
+				  area, widget, "frame",
+				  x, y, width, height,
+				  GTK_POS_TOP, 
+				  x2, child_requisition.width + 2 * LABEL_PAD);
 	}
        else
 	 gtk_paint_shadow (widget->style, widget->window,
@@ -575,7 +585,7 @@ gtk_frame_size_request (GtkWidget      *widget,
 
       requisition->width = child_requisition.width + 2 * LABEL_PAD + 2 * LABEL_SIDE_PAD;
       requisition->height =
-	MAX (0, child_requisition.height - GTK_WIDGET (widget)->style->ythickness);
+	MAX (0, child_requisition.height - widget->style->ythickness);
     }
   else
     {
