- // Hack alert! We manually set the child window
- // parent field so that GTK can query the
- // notebook's style and font.
- child->m_widget->parent = parent->m_widget;
+ // Hack Alert! (Part I): This sets the notebook as the parent of the child
+ // widget, and takes care of some details such as updating the state and
+ // style of the child to reflect its new location. We do this early
+ // because without it GetBestSize (which is used to set the initial size
+ // of controls if an explicit size is not given) will often report
+ // incorrect sizes since the widget's style context is not fully known.
+ // See bug #901694 for details
+ // (http://sourceforge.net/tracker/?func=detail&aid=901694&group_id=9863&atid=109863)
+ gtk_widget_set_parent(child->m_widget, parent->m_widget);
+
+ // NOTE: This should be considered a temporary workaround until we can
+ // work out the details and implement delaying the setting of the initial
+ // size of widgets until the size is really needed.