- XrmDatabase homeDB, serverDB, applicationDB;
- char filenamebuf[1024];
-
- char *filename = &filenamebuf[0];
- char *environment;
- wxString classname = theApp->GetClassName();
- char name[256];
- (void) strcpy (name, "/usr/lib/X11/app-defaults/");
- (void) strcat (name, classname.c_str());
-
- /* Get application defaults file, if any */
- applicationDB = XrmGetFileDatabase (name);
- (void) XrmMergeDatabases (applicationDB, &wxResourceDatabase);
-
- /* Merge server defaults, created by xrdb, loaded as a property of the root
- * window when the server initializes and loaded into the display
- * structure on XOpenDisplay;
- * if not defined, use .Xdefaults
- */
-
- if (XResourceManagerString (display) != NULL)
- {
- serverDB = XrmGetStringDatabase (XResourceManagerString (display));
- }
- else
- {
- (void) GetIniFile (filename, NULL);
- serverDB = XrmGetFileDatabase (filename);
- }
- XrmMergeDatabases (serverDB, &wxResourceDatabase);
-
- /* Open XENVIRONMENT file, or if not defined, the .Xdefaults,
- * and merge into existing database
- */
-
- if ((environment = getenv ("XENVIRONMENT")) == NULL)
- {
- size_t len;
- environment = GetIniFile (filename, NULL);
- len = strlen (environment);
- wxString hostname = wxGetHostName();
- if ( !hostname.empty() )
- strncat(environment, hostname, 1024 - len);
- }
- homeDB = XrmGetFileDatabase (environment);
- XrmMergeDatabases (homeDB, &wxResourceDatabase);