Make sure widgets get removed from the resize queue before the connection

Wed Apr  8 17:27:40 1998  Owen Taylor  <owt1@cornell.edu>

	* gtk/gtkwidget.c (gtk_widget_unparent): Make sure
	widgets get removed from the resize queue before the
	connection between them and the resize queue is broken
	by unparenting their parent.
This commit is contained in:
Owen Taylor 1998-04-08 21:40:45 +00:00 committed by Owen Taylor
parent 09d32399ab
commit 520fd17eca
8 changed files with 85 additions and 4 deletions

View File

@ -1,3 +1,10 @@
Wed Apr 8 17:27:40 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkwidget.c (gtk_widget_unparent): Make sure
widgets get removed from the resize queue before the
connection between them and the resize queue is broken
by unparenting their parent.
1998-04-08 Miguel de Icaza <miguel@nuclecu.unam.mx>
* gdk/gdk.c (gdk_event_translate): During drag and drop, set the

View File

@ -1,3 +1,10 @@
Wed Apr 8 17:27:40 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkwidget.c (gtk_widget_unparent): Make sure
widgets get removed from the resize queue before the
connection between them and the resize queue is broken
by unparenting their parent.
1998-04-08 Miguel de Icaza <miguel@nuclecu.unam.mx>
* gdk/gdk.c (gdk_event_translate): During drag and drop, set the

View File

@ -1,3 +1,10 @@
Wed Apr 8 17:27:40 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkwidget.c (gtk_widget_unparent): Make sure
widgets get removed from the resize queue before the
connection between them and the resize queue is broken
by unparenting their parent.
1998-04-08 Miguel de Icaza <miguel@nuclecu.unam.mx>
* gdk/gdk.c (gdk_event_translate): During drag and drop, set the

View File

@ -1,3 +1,10 @@
Wed Apr 8 17:27:40 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkwidget.c (gtk_widget_unparent): Make sure
widgets get removed from the resize queue before the
connection between them and the resize queue is broken
by unparenting their parent.
1998-04-08 Miguel de Icaza <miguel@nuclecu.unam.mx>
* gdk/gdk.c (gdk_event_translate): During drag and drop, set the

View File

@ -1,3 +1,10 @@
Wed Apr 8 17:27:40 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkwidget.c (gtk_widget_unparent): Make sure
widgets get removed from the resize queue before the
connection between them and the resize queue is broken
by unparenting their parent.
1998-04-08 Miguel de Icaza <miguel@nuclecu.unam.mx>
* gdk/gdk.c (gdk_event_translate): During drag and drop, set the

View File

@ -1,3 +1,10 @@
Wed Apr 8 17:27:40 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkwidget.c (gtk_widget_unparent): Make sure
widgets get removed from the resize queue before the
connection between them and the resize queue is broken
by unparenting their parent.
1998-04-08 Miguel de Icaza <miguel@nuclecu.unam.mx>
* gdk/gdk.c (gdk_event_translate): During drag and drop, set the

View File

@ -1,3 +1,10 @@
Wed Apr 8 17:27:40 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkwidget.c (gtk_widget_unparent): Make sure
widgets get removed from the resize queue before the
connection between them and the resize queue is broken
by unparenting their parent.
1998-04-08 Miguel de Icaza <miguel@nuclecu.unam.mx>
* gdk/gdk.c (gdk_event_translate): During drag and drop, set the

View File

@ -1129,6 +1129,7 @@ gtk_widget_unparent (GtkWidget *widget)
GtkWidget *toplevel;
GtkWidget *child;
GtkWidget *old_parent;
GSList *tmp_list, *prev_list;
g_return_if_fail (widget != NULL);
if (widget->parent == NULL)
@ -1149,11 +1150,42 @@ gtk_widget_unparent (GtkWidget *widget)
gtk_window_set_focus (GTK_WINDOW (toplevel), NULL);
}
if (GTK_WIDGET_RESIZE_NEEDED (widget))
/* Remove the widget and all its children from toplevel->resize_widgets
*/
/* Three ways to make this prettier:
* Write a g_slist_conditional_remove (GSList, gboolean (*)(gpointer))
* Change resize_widgets to a GList
* Just bite the bullet and use g_slist_remove
*/
tmp_list = GTK_CONTAINER (toplevel)->resize_widgets;
prev_list = NULL;
while (tmp_list)
{
GTK_CONTAINER (toplevel)->resize_widgets =
g_slist_remove (GTK_CONTAINER (toplevel)->resize_widgets, widget);
GTK_PRIVATE_UNSET_FLAG (widget, GTK_RESIZE_NEEDED);
GSList *tmp = tmp_list;
GtkWidget *child = (GtkWidget *)tmp->data;
GtkWidget *parent = child;
tmp_list = tmp_list->next;
while (parent && (parent != widget))
parent = parent->parent;
if (parent == widget)
{
GTK_PRIVATE_UNSET_FLAG (child, GTK_RESIZE_NEEDED);
if (prev_list)
prev_list->next = tmp_list;
else
GTK_CONTAINER (toplevel)->resize_widgets = tmp_list;
tmp->next = NULL;
g_slist_free_1 (tmp);
}
else
prev_list = tmp;
}
if (widget->window &&