- XVisualInfo * const xvi = GetXVisualInfo();
-
- GdkVisual *visual;
- GdkColormap *colormap;
-
- // MR: This needs a fix for lower gtk+ versions too. Might need to rethink logic (FIXME)
-#if defined(__WXGTK20__) && GTK_CHECK_VERSION(2,2,0)
- if (!gtk_check_version(2,2,0))
- {
- wxWindow::Create( parent, id, pos, size, style, name );
-
- m_glWidget = m_wxwindow;
-
- GdkScreen *screen = gtk_widget_get_screen( m_glWidget );
- colormap = gdk_screen_get_default_colormap(screen);
- visual = gdk_colormap_get_visual(colormap);
-
- if (GDK_VISUAL_XVISUAL(visual)->visualid != xvi->visualid)
- {
- visual = gdk_x11_screen_lookup_visual( screen, xvi->visualid );
- colormap = gdk_colormap_new(visual, FALSE);
- }
-
- gtk_widget_set_colormap( m_glWidget, colormap );
- }
- else
-#endif // GTK+ >= 2.2
- {
- visual = gdkx_visual_get( xvi->visualid );
- colormap = gdk_colormap_new( visual, TRUE );
-
- gtk_widget_push_colormap( colormap );
+ // watch for the "parent-set" signal on m_wxwindow so we can set colormap
+ // before m_wxwindow is realized (which will occur before
+ // wxWindow::Create() returns if parent is already visible)
+ unsigned sig_id = g_signal_lookup("parent-set", GTK_TYPE_WIDGET);
+ g_signal_add_emission_hook(sig_id, 0, parent_set_hook, this, NULL);