After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 56834 - Make GTK+ core enforce parent/child invariants
Make GTK+ core enforce parent/child invariants
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
1.3.x
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2001-06-28 22:04 UTC by Owen Taylor
Modified: 2011-02-04 16:09 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Owen Taylor 2001-06-28 22:04: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.
Comment 1 Owen Taylor 2001-07-07 03:45:47 UTC
Relevant mail discussing this is:
 http://mail.gnome.org/archives/gtk-devel-list/2000-October/msg00277.html
Comment 2 Owen Taylor 2001-07-19 14:57:23 UTC
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.