GNOME Bugzilla – Bug 56834
Make GTK+ core enforce parent/child invariants
Last modified: 2011-02-04 16:09:25 UTC
Currently, every GTK+ widget has code in its add functions like: gtk_widget_set_parent (child, GTK_WIDGET (box)); if (GTK_WIDGET_REALIZED (box)) gtk_widget_realize (child); if (GTK_WIDGET_VISIBLE (box) && GTK_WIDGET_VISIBLE (child)) { if (GTK_WIDGET_MAPPED (box)) gtk_widget_map (child); gtk_widget_queue_resize (child); } It would be good if gtk_widget_set_parent() could do this automatically, though there are some issues for widgets like gtknotebook which don't always want to map all there children - in these cases, this could cause some extraneous flashing.
Relevant mail discussing this is: http://mail.gnome.org/archives/gtk-devel-list/2000-October/msg00277.html
Sat Jul 7 02:50:14 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkwidget.c (gtk_widget_set_parent): Enforce the widget/child realization/mapping invariants. * gtk/gtkwidget.[ch] gtk/gtkprivate.h: Add functions gtk_widget_[get/set]_child_visible() to control whether visible children of a mapped window are mapped. * docs/widget_system.txt: Updated for changes in container contract, and addition of GTK_CHILD_VISIBLE. * gtk/gtkcontainer.c: Add generic map()/unmap() functions that work for almost all containers. * gtk/gtknotebook.c gtk/gtkpacker.c: Use gtk_widget_set_child_visible() where necessary. * gtk/*.c: Remove excess map(), unmap(), and realization/mapping invariant enforcing code from many containers.