/* Deal with the X Resource Manager.
Copyright (C) 1990, 1993, 1994 Free Software Foundation.
-This program is free software; you can redistribute it and/or modify
+This file is part of GNU Emacs.
+
+GNU Emacs is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-This program is distributed in the hope that it will be useful,
+GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
-along with this program; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+along with GNU Emacs; see the file COPYING. If not, write to
+the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA. */
/* Written by jla, 4/90 */
#include <config.h>
#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include <epaths.h>
+
#include <stdio.h>
#if 1 /* I'd really appreciate it if this code could go away... -JimB */
#endif /* 1 */
-/* This should be included before the X include files; otherwise, we get
- warnings about redefining NULL under BSD 4.3. */
-#include <sys/param.h>
-
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#if 0
#endif
#include <sys/stat.h>
-#ifndef MAXPATHLEN
-#define MAXPATHLEN 256
-#endif
-
#if !defined(S_ISDIR) && defined(S_IFDIR)
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#endif
+#include "lisp.h"
+
extern char *getenv ();
/* This does cause trouble on AIX. I'm going to take the comment at
#define malloc xmalloc
#define realloc xrealloc
#define free xfree
+extern long *xmalloc (), *xrealloc ();
#endif
char *x_get_string_resource ();
\f
/* Producing databases for individual sources. */
-#define X_DEFAULT_SEARCH_PATH "/usr/lib/X11/%L/%T/%N%C%S:/usr/lib/X11/%l/%T/%N%C%S:/usr/lib/X11/%T/%N%C%S:/usr/lib/X11/%L/%T/%N%S:/usr/lib/X11/%l/%T/%N%S:/usr/lib/X11/%T/%N%S"
-
static XrmDatabase
get_system_app (class)
char *class;
char *path;
path = getenv ("XFILESEARCHPATH");
- if (! path) path = X_DEFAULT_SEARCH_PATH;
+ if (! path) path = PATH_X_DEFAULTS;
path = search_magic_path (path, class, 0, 0);
if (path)
get_fallback (display)
Display *display;
{
- XrmDatabase db;
-
return NULL;
}
{
char *path;
char *file = 0;
+ char *free_it = 0;
/* Check for XUSERFILESEARCHPATH. It is a path of complete file
names, not directories. */
/* Check in the home directory. This is a bit of a hack; let's
hope one's home directory doesn't contain any %-escapes. */
- || (path = gethomedir (),
- ((file = search_magic_path (path, class, "%L/%N", 0))
- || (file = search_magic_path (path, class, "%N", 0)))))
+ || (free_it = gethomedir (),
+ ((file = search_magic_path (free_it, class, "%L/%N", 0))
+ || (file = search_magic_path (free_it, class, "%N", 0)))))
{
XrmDatabase db = XrmGetFileDatabase (file);
free (file);
+ if (free_it)
+ free (free_it);
return db;
}
- else
- return NULL;
+
+ if (free_it)
+ free (free_it);
+ return NULL;
}
Display *display;
char *xrm_string, *myname, *myclass;
{
- char *xdefs;
XrmDatabase user_database;
XrmDatabase rdb;
XrmDatabase db;
+ char line[256];
+ char *helv = "-*-helvetica-medium-r-*--*-120-*-*-*-*-iso8859-1";
+#ifdef USE_MOTIF
+ char *courier = "-*-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1";
+ extern Lisp_Object Vdouble_click_time;
+#endif
x_rm_string = XrmStringToQuark (XrmStringType);
#ifndef USE_X_TOOLKIT
#endif
rdb = XrmGetStringDatabase ("");
+ /* Add some font defaults. If the font `helv' doesn't exist, widgets
+ will use some other default font. */
+#ifdef USE_MOTIF
+
+ sprintf (line, "%s*fontList: %s", myname, helv);
+ XrmPutLineResource (&rdb, line);
+ sprintf (line, "%s*menu*background: grey75", myname);
+ XrmPutLineResource (&rdb, line);
+ sprintf (line, "%s*menubar*background: grey75", myname, helv);
+ XrmPutLineResource (&rdb, line);
+ sprintf (line, "%s*verticalScrollBar.background: grey75", myname);
+ XrmPutLineResource (&rdb, line);
+ sprintf (line, "%s.dialog*.background: grey75", myname);
+ XrmPutLineResource (&rdb, line);
+ sprintf (line, "%s*fsb.Text.background: white", myname);
+ XrmPutLineResource (&rdb, line);
+ sprintf (line, "%s*fsb.FilterText.background: white", myname);
+ XrmPutLineResource (&rdb, line);
+ sprintf (line, "%s*fsb*DirList.background: white", myname);
+ XrmPutLineResource (&rdb, line);
+ sprintf (line, "%s*fsb*ItemsList.background: white", myname);
+ XrmPutLineResource (&rdb, line);
+ sprintf (line, "%s*fsb*background: grey75", myname);
+ XrmPutLineResource (&rdb, line);
+ sprintf (line, "%s*fsb.Text.fontList: %s", myname, courier);
+ XrmPutLineResource (&rdb, line);
+ sprintf (line, "%s*fsb.FilterText.fontList: %s", myname, courier);
+ XrmPutLineResource (&rdb, line);
+ sprintf (line, "%s*fsb*ItemsList.fontList: %s", myname, courier);
+ XrmPutLineResource (&rdb, line);
+ sprintf (line, "%s*fsb*DirList.fontList: %s", myname, courier);
+ XrmPutLineResource (&rdb, line);
+
+ /* Set double click time of list boxes in the file selection
+ dialog from `double-click-time'. */
+ if (INTEGERP (Vdouble_click_time) && XINT (Vdouble_click_time) > 0)
+ {
+ sprintf (line, "%s*fsb*DirList.doubleClickInterval: %d",
+ myname, XFASTINT (Vdouble_click_time));
+ XrmPutLineResource (&rdb, line);
+ sprintf (line, "%s*fsb*ItemsList.doubleClickInterval: %d",
+ myname, XFASTINT (Vdouble_click_time));
+ XrmPutLineResource (&rdb, line);
+ }
+
+#else /* not USE_MOTIF */
+
+ sprintf (line, "%s.dialog*.font: %s", myname, helv);
+ XrmPutLineResource (&rdb, line);
+ sprintf (line, "%s.dialog*.background: grey75", myname);
+ XrmPutLineResource (&rdb, line);
+ sprintf (line, "%s.pane.menubar.font: %s", myname, helv);
+ XrmPutLineResource (&rdb, line);
+ sprintf (line, "%s.pane.menubar.background: grey75", myname);
+ XrmPutLineResource (&rdb, line);
+ sprintf (line, "%s.menu*.font: %s", myname, helv);
+ XrmPutLineResource (&rdb, line);
+ sprintf (line, "%s.menu*.background: grey75", myname);
+ XrmPutLineResource (&rdb, line);
+ sprintf (line, "%s*verticalScrollBar.background: grey75", myname);
+ XrmPutLineResource (&rdb, line);
+
+#endif /* not USE_MOTIF */
+
user_database = get_user_db (display);
/* Figure out what the "customization string" is, so we can use it