-/*
-#if wxUSE_RESOURCES
- (void) wxGetResource("wxWindows", "OsVersion", &wxOsVersion);
-#endif
-*/
- wxSystemSettings::Init();
-
- wxTheFontNameDirectory = new wxFontNameDirectory;
- wxTheFontNameDirectory->Initialize();
-
- wxTheColourDatabase = new wxColourDatabase(wxKEY_STRING);
- wxTheColourDatabase->Initialize();
-
- wxInitializeStockLists();
- wxInitializeStockObjects();
-
-#ifdef wxUSE_WX_RESOURCES
- wxTheResourceCache = new wxResourceCache(wxKEY_STRING);
-
- wxInitializeResourceSystem();
+#ifndef __WXGTK3__
+ // if this is a wxGLApp (derived from wxApp), and we've already
+ // chosen a specific visual, then derive the GdkVisual from that
+ if ( GetXVisualInfo() )
+ {
+ GdkVisual* vis = gtk_widget_get_default_visual();
+
+ GdkColormap *colormap = gdk_colormap_new( vis, FALSE );
+ gtk_widget_set_default_colormap( colormap );
+ }
+ else
+ {
+ // On some machines, the default visual is just 256 colours, so
+ // we make sure we get the best. This can sometimes be wasteful.
+ if (m_useBestVisual)
+ {
+ if (m_forceTrueColour)
+ {
+ GdkVisual* visual = gdk_visual_get_best_with_both( 24, GDK_VISUAL_TRUE_COLOR );
+ if (!visual)
+ {
+ wxLogError(wxT("Unable to initialize TrueColor visual."));
+ return false;
+ }
+ GdkColormap *colormap = gdk_colormap_new( visual, FALSE );
+ gtk_widget_set_default_colormap( colormap );
+ }
+ else
+ {
+ if (gdk_visual_get_best() != gdk_visual_get_system())
+ {
+ GdkVisual* visual = gdk_visual_get_best();
+ GdkColormap *colormap = gdk_colormap_new( visual, FALSE );
+ gtk_widget_set_default_colormap( colormap );
+ }
+ }
+ }
+ }