+// This is set within wxEntryStart -- too early on
+// to put these in wxTheApp
+static int g_newArgc = 0;
+static wxChar** g_newArgv = NULL;
+
+// NB: argc and argv may be changed here, pass by reference!
+int wxEntryStart( int& argc, char *argv[] )
+{
+#ifdef __WXDEBUG__
+ // install the X error handler
+ gs_pfnXErrorHandler = XSetErrorHandler( wxXErrorHandler );
+#endif // __WXDEBUG__
+
+ /// TODO
+#if 0
+ // Parse the arguments.
+#endif
+
+ Display* xdisplay = XOpenDisplay(NULL);
+
+ if (!xdisplay)
+ {
+ wxLogError( _("wxWindows could not open display. Exiting.") );
+ return -1;
+ }
+
+ wxApp::ms_display = (WXDisplay*) xdisplay;
+
+ XSelectInput( xdisplay, XDefaultRootWindow(xdisplay), PropertyChangeMask);
+
+// wxSetDetectableAutoRepeat( TRUE );
+
+ if (!wxApp::Initialize())
+ return -1;
+
+ return 0;
+}
+
+
+int wxEntryInitGui()
+{
+ int retValue = 0;
+
+ if ( !wxTheApp->OnInitGui() )
+ retValue = -1;
+
+ return retValue;
+}
+
+