From: Nick Bowler Date: Sun, 15 Mar 2009 05:37:35 +0000 (-0400) Subject: Make constrain play a bit better with y-positioning of the side. X-Git-Url: http://git.draconx.ca/gitweb/aspectbin.git/commitdiff_plain/517728cbd0252105c73544c1f9c1f5cc2f80a70c Make constrain play a bit better with y-positioning of the side. --- diff --git a/aspectbin.c b/aspectbin.c index 07fca93..6e14677 100644 --- a/aspectbin.c +++ b/aspectbin.c @@ -73,7 +73,7 @@ static void aspect_bin_class_init(AspectBinClass *class) PROP_CONSTRAIN, g_param_spec_boolean("constrain", "Constrain", - "Only expand the side to be as large as the body.", + "Try not to place the side beyond the body's edges.", FALSE, G_PARAM_READWRITE)); gtk_container_class_install_child_property(container_class, @@ -295,10 +295,16 @@ aspect_bin_size_allocate(GtkWidget *widget, GtkAllocation *allocation) } asize.y = (allocation->height - asize.height) * abin->body_align + 0.5; - csize.y = (allocation->height - csize.height) * abin->side_align + 0.5; - if (abin->constrain) { - csize.y = MIN(asize.y, allocation->height - csize.height); + if (abin->constrain && csize.height <= asize.height) { + csize.y = asize.y + (asize.height-csize.height) + * abin->side_align + 0.5; + } else if (abin->constrain) { + csize.y = (allocation->height - csize.height) + * abin->body_align + 0.5; + } else { + csize.y = (allocation->height - csize.height) + * abin->side_align + 0.5; } if (abin->body)