changeset 15953:65b5b2b9b5bc

merge of '7172b457b2254aea4fdb335f5cb8b43dcbb127f5' and '8977225fd5865020bc47afb7012cf60d2b21e6ae'
author Evan Schoenberg <evan.s@dreskin.net>
date Tue, 27 Mar 2007 04:21:53 +0000
parents 9214184b9d10 (diff) b4ab4812838a (current diff)
children dbb87bc732fa
files
diffstat 2 files changed, 15 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/finch/libgnt/gntbox.c	Tue Mar 27 04:20:55 2007 +0000
+++ b/finch/libgnt/gntbox.c	Tue Mar 27 04:21:53 2007 +0000
@@ -352,11 +352,6 @@
 	GntBox *box = GNT_BOX(widget);
 	int wchange, hchange;
 
-	if (widget->priv.width != width && !GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_GROW_X))
-		return FALSE;
-	if (widget->priv.height != height && !GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_GROW_Y))
-		return FALSE;
-
 	if (!box->list)
 		return TRUE;
 
@@ -387,13 +382,21 @@
 				gnt_widget_get_size(GNT_WIDGET(i->data), &tw, &th);
 				if (box->vertical)
 				{
-					if (!gnt_widget_confirm_size(i->data, tw - wchange, th))
-						return FALSE;
+					if (!gnt_widget_confirm_size(i->data, tw - wchange, th)) {
+						/* If we are decreasing the size and the widget is going
+						 * to be too large to fit into the box, then do not allow
+						 * resizing. */
+						if (wchange > 0 && tw >= widget->priv.width)
+							return FALSE;
+					}
 				}
 				else
 				{
-					if (!gnt_widget_confirm_size(i->data, tw, th - hchange))
+					if (!gnt_widget_confirm_size(i->data, tw, th - hchange)) {
+						if (hchange > 0 && th >= widget->priv.height)
+							return FALSE;
 						return FALSE;
+					}
 				}
 			}
 #if 0
@@ -562,17 +565,6 @@
 {
 	b->list = g_list_append(b->list, widget);
 	widget->parent = GNT_WIDGET(b);
-
-	if (b->vertical)
-	{
-		if (!GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_GROW_X))
-			GNT_WIDGET_UNSET_FLAGS(GNT_WIDGET(b), GNT_WIDGET_GROW_X);
-	}
-	else
-	{
-		if (!GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_GROW_Y))
-			GNT_WIDGET_UNSET_FLAGS(GNT_WIDGET(b), GNT_WIDGET_GROW_Y);
-	}
 }
 
 void gnt_box_set_title(GntBox *b, const char *title)
--- a/finch/libgnt/gntwidget.c	Tue Mar 27 04:20:55 2007 +0000
+++ b/finch/libgnt/gntwidget.c	Tue Mar 27 04:21:53 2007 +0000
@@ -75,11 +75,13 @@
 static gboolean
 gnt_widget_dummy_confirm_size(GntWidget *widget, int width, int height)
 {
+	gboolean shadow;
 	if (width < widget->priv.minw || height < widget->priv.minh)
 		return FALSE;
-	if (widget->priv.width != width && !GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_GROW_X))
+	shadow = gnt_widget_has_shadow(widget);
+	if (widget->priv.width + shadow != width && !GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_GROW_X))
 		return FALSE;
-	if (widget->priv.height != height && !GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_GROW_Y))
+	if (widget->priv.height + shadow != height && !GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_GROW_Y))
 		return FALSE;
 	return TRUE;
 }