]> code.delx.au - gnu-emacs/blob - lwlib/xrdb.c
#
[gnu-emacs] / lwlib / xrdb.c
1 /* This file overrides the R4 or R5 mit/lib/Xt/Initialize.c, except that
2 the functions lwlib_GetFileDatabase(), lwlib_CombineFileDatabase(), and
3 lwlib_xrdb_initialize() are called. By doing this silly cpp hack, we
4 avoid version skew problems.
5 */
6
7 #include <X11/Xlib.h>
8 #include <X11/cursorfont.h>
9 #include <X11/Xutil.h>
10
11 #ifdef XlibSpecificationRelease
12 #if XlibSpecificationRelease >= 5
13 #define HAVE_X11R5
14 #endif
15 #endif
16
17 extern struct _XrmHashBucketRec *lwlib_GetFileDatabase ();
18 extern void lwlib_xrdb_initialize ();
19
20 /* Replace all calls to XrmGetFileDatabase() with lwlib_GetFileDatabase(),
21 calls to XrmCombineFileDatabase() with lwlib_CombineFileDatabase(), and
22 rename the defined _XtDisplayInitialize() function.
23 */
24 #define XrmGetFileDatabase lwlib_GetFileDatabase
25 #define XrmCombineFileDatabase lwlib_CombineFileDatabase
26 #define _XtDisplayInitialize _orig_XtDisplayInitialize
27
28 /* Suck in the original code. Don't change this: see comments in Imakefile. */
29 #include "Initialize.c"
30
31 #undef XrmGetFileDatabase
32 #undef XrmCombineFileDatabase
33 #undef _XtDisplayInitialize
34
35 /* Now provide a definition of _XtDisplayInitialize() which invokes the
36 original code after calling our initialization hook. Note that the R4
37 and R5 versions of _XtDisplayInitialize() take different arguments.
38 */
39
40 #ifndef HAVE_X11R5
41
42 void _XtDisplayInitialize(dpy, pd, name, class, urlist, num_urs, argc, argv)
43 Display *dpy;
44 XtPerDisplay pd;
45 String name, class;
46 XrmOptionDescRec *urlist;
47 Cardinal num_urs;
48 Cardinal *argc;
49 char *argv[];
50 {
51 lwlib_xrdb_initialize(dpy);
52 _orig_XtDisplayInitialize(dpy, pd, name, class, urlist, num_urs, argc, argv);
53 }
54
55 #else /* HAVE_X11R5 */
56
57 void _XtDisplayInitialize(dpy, pd, name, urlist, num_urs, argc, argv)
58 Display *dpy;
59 XtPerDisplay pd;
60 String name;
61 XrmOptionDescRec *urlist;
62 Cardinal num_urs;
63 int *argc;
64 char **argv;
65 {
66 lwlib_xrdb_initialize(dpy);
67 _orig_XtDisplayInitialize(dpy, pd, name, urlist, num_urs, argc, argv);
68 }
69
70 #endif /* HAVE_X11R5 */