33#include <X11/Intrinsic.h>
40#define NewString(str) \
41 ((str) != NULL ? (strcpy((char*)malloc((unsigned)strlen(str) + 1), str)) : NULL)
47G4Xt* G4Xt::instance = NULL;
51static char** args = NULL;
52static XtAppContext appContext = NULL;
53static Widget topWidget = NULL;
72 instance =
new G4Xt(a_argn,a_args,a_class);
87 args = (
char**)malloc(a_argn *
sizeof(
char*));
90 for(
int argi=0;argi<a_argn;argi++) {
91 args[argi] = (
char*)
NewString (a_args[argi]);
95#if XtSpecificationRelease == 4
97 narg = (Cardinal)a_argn;
103 XtSetArg (xargs[0],XtNgeometry,
"100x100");
104 topWidget = XtAppInitialize (&appContext,a_class,
108 if(topWidget==NULL) {
112 if( (a_argn!=0) && (args!=NULL)) {
113 for(
int argi=0;argi<a_argn;argi++) {
115 strcpy(a_args[argi],args[argi]);
121 XtSetMappedWhenManaged (topWidget,False);
122 XtRealizeWidget (topWidget);
156 if(appContext==NULL)
return NULL;
157 if(topWidget==NULL)
return NULL;
158 XtAppNextEvent (appContext, &event);
168 if(topWidget==NULL)
return;
169 if(a_string==NULL)
return;
170 Display* dpy = XtDisplay(topWidget);
171 XrmDatabase dbres = XrmGetStringDatabase (a_string);
172 if(dbres==NULL)
return;
173 XrmDatabase database = XrmGetDatabase (dpy);
175 XrmMergeDatabases (dbres,&database);
177 XrmSetDatabase (dpy,dbres);
186 if(topWidget==NULL)
return;
187 XSync(XtDisplay(topWidget),False);
G4GLOB_DLL std::ostream G4cout
void AddDispatcher(G4DispatchFunction)
void SetMainInteractor(G4Interactor)
void SetArguments(int, char **)
static G4Xt * getInstance()
void FlushAndWaitExecution()
void PutStringInResourceDatabase(char *)
static bool xt_dispatch_event(void *a_event)