Use the previously unused window->need_resize flag to mark if a window's

Mon May 11 21:04:51 1998  Owen Taylor  <otaylor@gtk.org>

	* gtk/gtkwindow.c (gtk_real_window_move_resize): Use the
	previously unused window->need_resize flag to mark if a window's
	descendents changed size while the window was not visible. In this
	case, when the window becomes visible, we reallocate everything,
	since we didn't keep track of what actually changed.

	(Fixes bug where changing the popdown strings of a
	combo to something of the same length caused them to
	blank out, as reported by Todd Dukes <tdukes@ibmoto.com>)
This commit is contained in:
Owen Taylor 1998-05-12 01:02:22 +00:00 committed by Owen Taylor
parent 075cb4320d
commit 962386fb82

View File

@ -1002,11 +1002,9 @@ gtk_window_need_resize (GtkContainer *container)
return return_val;
if (GTK_WIDGET_VISIBLE (container))
{
window->need_resize = TRUE;
return_val = gtk_window_move_resize (GTK_WIDGET (window));
window->need_resize = FALSE;
}
return_val = gtk_window_move_resize (GTK_WIDGET (window));
else
window->need_resize = TRUE;
return return_val;
}
@ -1019,13 +1017,17 @@ gtk_real_window_move_resize (GtkWindow *window,
gint height)
{
GtkWidget *widget;
gboolean needed_resize;
g_return_val_if_fail (window != NULL, FALSE);
g_return_val_if_fail (GTK_IS_WINDOW (window), FALSE);
g_return_val_if_fail ((x != NULL) || (y != NULL), FALSE);
widget = GTK_WIDGET (window);
needed_resize = window->need_resize;
window->need_resize = FALSE;
if ((widget->requisition.width == 0) ||
(widget->requisition.height == 0))
{
@ -1065,6 +1067,21 @@ gtk_real_window_move_resize (GtkWindow *window,
widget->requisition.width,
widget->requisition.height);
}
else if (needed_resize)
{
/* The windows contents changed size while it was not
* visible, so reallocate everything, since we didn't
* keep track of what changed
*/
GtkAllocation allocation;
allocation.x = 0;
allocation.y = 0;
allocation.width = widget->requisition.width;
allocation.height = widget->requisition.height;
gtk_widget_size_allocate (widget, &allocation);
}
else
{
/* The window hasn't changed size but one of its children
@ -1150,7 +1167,7 @@ gtk_real_window_move_resize (GtkWindow *window,
}
g_slist_free (resize_containers);
}
return FALSE;
}