- if( !wxAppBase::OnInitGui() )
- return FALSE;
-
- XtToolkitInitialize() ;
- wxTheApp->m_appContext = (WXAppContext) XtCreateApplicationContext();
- XtAppSetFallbackResources((XtAppContext) wxTheApp->m_appContext, fallbackResources);
-
- Display *dpy = XtOpenDisplay((XtAppContext) wxTheApp->m_appContext,(String)NULL,NULL,
- wxTheApp->GetClassName().c_str(), NULL, 0,
-# if XtSpecificationRelease < 5
- (Cardinal*) &argc,
-# else
- &argc,
-# endif
- argv);
-
- if (!dpy) {
- // if you don't log to stderr, nothing will be shown...
- delete wxLog::SetActiveTarget(new wxLogStderr);
- wxString className(wxTheApp->GetClassName());
- wxLogError(_("wxWindows could not open display for '%s': exiting."),
- className.c_str());
- exit(-1);
- }
- m_initialDisplay = (WXDisplay*) dpy;
-
-#ifdef __WXDEBUG__
- // install the X error handler
- gs_pfnXErrorHandler = XSetErrorHandler(wxXErrorHandler);
-#endif // __WXDEBUG__
+ Widget tlw = XtAppCreateShell( (String)NULL,
+ wxTheApp->GetClassName().c_str(),
+ applicationShellWidgetClass,
+ (Display*)display,
+ NULL, 0 );
+ XtVaSetValues( tlw,
+ XmNoverrideRedirect, True,
+ NULL );
+
+ XtAddCallback( tlw, XmNdestroyCallback,
+ (XtCallbackProc)wxTLWidgetDestroyCallback,
+ (XtPointer)NULL );
+
+ return (WXWidget)tlw;
+}