- XrmDatabase homeDB, serverDB, applicationDB;
- wxChar filenamebuf[1024];
-
- wxChar *filename = &filenamebuf[0];
- wxChar *environment;
- char *classname = gdk_progclass; // Robert Roebling ??
- char name[256];
- (void)strcpy(name, "/usr/lib/X11/app-defaults/");
- (void)strcat(name, classname ? classname : "wxWindows");
-
- // Get application defaults file, if any
- if ((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(GDK_DISPLAY()) != NULL)
- {
- serverDB = XrmGetStringDatabase(XResourceManagerString(GDK_DISPLAY()));
- }
- else
- {
- (void)GetIniFile(filename, (wxChar *) NULL);
- serverDB = XrmGetFileDatabase(wxConvCurrent->cWX2MB(filename));
- }
- if (serverDB)
- XrmMergeDatabases(serverDB, &wxResourceDatabase);
-
- // Open XENVIRONMENT file, or if not defined, the .Xdefaults,
- // and merge into existing database
-
- if ((environment = wxGetenv(T("XENVIRONMENT"))) == NULL)
- {
- size_t len;
-#if wxUSE_UNICODE
- char hostbuf[1024];
-#endif
- environment = GetIniFile(filename, (const wxChar *) NULL);
- len = wxStrlen(environment);
-#if !defined(SVR4) || defined(__sgi)
-#if wxUSE_UNICODE
- (void)gethostname(hostbuf, 1024 - len);
-#else
- (void)gethostname(environment + len, 1024 - len);
-#endif
-#else
-#if wxUSE_UNICODE
- (void)sysinfo(SI_HOSTNAME, hostbuf, 1024 - len);
-#else
- (void)sysinfo(SI_HOSTNAME, environment + len, 1024 - len);
-#endif
-#endif
-#if wxUSE_UNICODE
- wxStrcat(environment, wxConvCurrent->cMB2WX(hostbuf));
-#endif
- }
- if ((homeDB = XrmGetFileDatabase(wxConvCurrent->cWX2MB(environment))))
- XrmMergeDatabases(homeDB, &wxResourceDatabase);