ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/xdefaults.C
(Generate patch)

Comparing rxvt-unicode/src/xdefaults.C (file contents):
Revision 1.54 by root, Fri Feb 11 17:19:30 2005 UTC vs.
Revision 1.75 by root, Sun Jan 8 07:55:36 2006 UTC

4 * 4 *
5 * All portions of code are copyright by their respective author/s. 5 * All portions of code are copyright by their respective author/s.
6 * Copyright (c) 1994 Robert Nation <nation@rocket.sanders.lockheed.com> 6 * Copyright (c) 1994 Robert Nation <nation@rocket.sanders.lockheed.com>
7 * - original version 7 * - original version
8 * Copyright (c) 1997,1998 mj olesen <olesen@me.queensu.ca> 8 * Copyright (c) 1997,1998 mj olesen <olesen@me.queensu.ca>
9 * Copyright (c) 2003-2004 Marc Lehmann <pcg@goof.com> 9 * Copyright (c) 2003-2006 Marc Lehmann <pcg@goof.com>
10 * 10 *
11 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by 12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or 13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version. 14 * (at your option) any later version.
35 35
36#ifdef KEYSYM_RESOURCE 36#ifdef KEYSYM_RESOURCE
37#include "keyboard.h" 37#include "keyboard.h"
38#endif 38#endif
39 39
40/* place holders used for parsing command-line options */
41#define Optflag_Reverse 0x40000000UL
42#define Optflag_Boolean 0x80000000UL
43#define Optflag_mask 0x3fffffffUL
44
40/* #define DEBUG_RESOURCES */ 45/* #define DEBUG_RESOURCES */
41 46
42/*{{{ monolithic option/resource structure: */ 47/*{{{ monolithic option/resource structure: */
43/* 48/*
44 * `string' options MUST have a usage argument 49 * `string' options MUST have a usage argument
58#define RSTRG(rsp, kw, arg) \ 63#define RSTRG(rsp, kw, arg) \
59 {0, (rsp), (kw), NULL, (arg), NULL} 64 {0, (rsp), (kw), NULL, (arg), NULL}
60 65
61/* BOOL () - regular boolean `-/+' flag */ 66/* BOOL () - regular boolean `-/+' flag */
62#define BOOL(rsp, kw, opt, flag, desc) \ 67#define BOOL(rsp, kw, opt, flag, desc) \
63 { (Opt_Boolean| (flag)), (rsp), (kw), (opt), NULL, (desc)} 68 { (Optflag_Boolean | (flag)), (rsp), (kw), (opt), NULL, (desc)}
64 69
65/* SWCH () - `-' flag */ 70/* SWCH () - `-' flag */
66#define SWCH(opt, flag, desc) \ 71#define SWCH(opt, flag, desc) \
67 { (flag), -1, NULL, (opt), NULL, (desc)} 72 { (flag), -1, NULL, (opt), NULL, (desc)}
68 73
69/* convenient macros */ 74/* convenient macros */
70#define optList_strlen(i) \ 75#define optList_strlen(i) \
71 (optList[i].flag ? 0 : (optList[i].arg ? strlen (optList[i].arg) : 1)) 76 (optList[i].flag ? 0 : (optList[i].arg ? strlen (optList[i].arg) : 1))
72#define optList_isBool(i) \ 77#define optList_isBool(i) \
73 (optList[i].flag & Opt_Boolean) 78 (optList[i].flag & Optflag_Boolean)
74#define optList_isReverse(i) \ 79#define optList_isReverse(i) \
75 (optList[i].flag & Opt_Reverse) 80 (optList[i].flag & Optflag_Reverse)
76#define optList_size \ 81#define optList_size \
77 (sizeof (optList) / sizeof (optList[0])) 82 (sizeof (optList) / sizeof (optList[0]))
78 83
79static const struct 84static const struct
80 { 85 {
96 SWCH ("ic", Opt_iconic, NULL), /* short form */ 101 SWCH ("ic", Opt_iconic, NULL), /* short form */
97 BOOL (Rs_reverseVideo, "reverseVideo", "rv", Opt_reverseVideo, "reverse video"), 102 BOOL (Rs_reverseVideo, "reverseVideo", "rv", Opt_reverseVideo, "reverse video"),
98 BOOL (Rs_loginShell, "loginShell", "ls", Opt_loginShell, "login shell"), 103 BOOL (Rs_loginShell, "loginShell", "ls", Opt_loginShell, "login shell"),
99 BOOL (Rs_jumpScroll, "jumpScroll", "j", Opt_jumpScroll, "jump scrolling"), 104 BOOL (Rs_jumpScroll, "jumpScroll", "j", Opt_jumpScroll, "jump scrolling"),
100 BOOL (Rs_pastableTabs, "pastableTabs", "ptab", Opt_pastableTabs, "tab characters are pastable"), 105 BOOL (Rs_pastableTabs, "pastableTabs", "ptab", Opt_pastableTabs, "tab characters are pastable"),
101#ifdef HAVE_SCROLLBARS 106#if HAVE_SCROLLBARS
102 RSTRG (Rs_scrollstyle, "scrollstyle", "mode"), 107 RSTRG (Rs_scrollstyle, "scrollstyle", "mode"),
103 BOOL (Rs_scrollBar, "scrollBar", "sb", Opt_scrollBar, "scrollbar"), 108 BOOL (Rs_scrollBar, "scrollBar", "sb", Opt_scrollBar, "scrollbar"),
104 BOOL (Rs_scrollBar_right, "scrollBar_right", "sr", Opt_scrollBar_right, "scrollbar right"), 109 BOOL (Rs_scrollBar_right, "scrollBar_right", "sr", Opt_scrollBar_right, "scrollbar right"),
105 BOOL (Rs_scrollBar_floating, "scrollBar_floating", "st", Opt_scrollBar_floating, "scrollbar without a trough"), 110 BOOL (Rs_scrollBar_floating, "scrollBar_floating", "st", Opt_scrollBar_floating, "scrollbar without a trough"),
106 RSTRG (Rs_scrollBar_align, "scrollBar_align", "mode"), 111 RSTRG (Rs_scrollBar_align, "scrollBar_align", "mode"),
107 STRG (Rs_scrollBar_thickness, "thickness", "sbt", "number", "scrollbar thickness/width in pixels"), 112 STRG (Rs_scrollBar_thickness, "thickness", "sbt", "number", "scrollbar thickness/width in pixels"),
108#endif 113#endif
109 BOOL (Rs_scrollTtyOutput, "scrollTtyOutput", NULL, Opt_scrollTtyOutput, NULL), 114 BOOL (Rs_scrollTtyOutput, "scrollTtyOutput", NULL, Opt_scrollTtyOutput, NULL),
110 BOOL (Rs_scrollTtyOutput, NULL, "si", Opt_Reverse | Opt_scrollTtyOutput, "scroll-on-tty-output inhibit"), 115 BOOL (Rs_scrollTtyOutput, NULL, "si", Optflag_Reverse | Opt_scrollTtyOutput, "scroll-on-tty-output inhibit"),
111 BOOL (Rs_scrollTtyKeypress, "scrollTtyKeypress", "sk", Opt_scrollTtyKeypress, "scroll-on-keypress"), 116 BOOL (Rs_scrollTtyKeypress, "scrollTtyKeypress", "sk", Opt_scrollTtyKeypress, "scroll-on-keypress"),
112 BOOL (Rs_scrollWithBuffer, "scrollWithBuffer", "sw", Opt_scrollWithBuffer, "scroll-with-buffer"), 117 BOOL (Rs_scrollWithBuffer, "scrollWithBuffer", "sw", Opt_scrollWithBuffer, "scroll-with-buffer"),
113#ifdef TRANSPARENT 118#if TRANSPARENT
114 BOOL (Rs_transparent, "inheritPixmap", "ip", Opt_transparent, "inherit parent pixmap"), 119 BOOL (Rs_transparent, "inheritPixmap", "ip", Opt_transparent, "inherit parent pixmap"),
115 BOOL (Rs_transparent_all, "inheritPixmapforce", "ipf", Opt_transparent_all, "forcefully inherit root pixmap"),
116 SWCH ("tr", Opt_transparent, NULL), 120 SWCH ("tr", Opt_transparent, NULL),
121# if TINTING
122 STRG (Rs_color + Color_tint, "tintColor", "tint", "color", "tint color"),
123# endif
124#endif
125#if OFF_FOCUS_FADING
126 STRG (Rs_fade, "fading", "fade", "%", "fade colors x% percent when rxvt-unicode is losing focus"),
127 STRG (Rs_color + Color_fade, "fadeColor", "fadecolor", "color", "target color for off-focus fading"),
128#endif
117#if TINTING 129#if TINTING
118 STRG (Rs_color + Color_tint, "tintColor", "tint", "color", "tint color"),
119#endif
120#endif
121#ifdef OFF_FOCUS_FADING
122 STRG (Rs_fade, "fading", "fade", "%", "make colors x% darker when rxvt-unicode is losing focus."),
123#endif
124#ifdef TINTING
125 STRG (Rs_shade, "shading", "sh", "%", "shade background by x% when tinting."), 130 STRG (Rs_shade, "shading", "sh", "%", "shade background by x% when tinting."),
126#endif 131#endif
127 BOOL (Rs_utmpInhibit, "utmpInhibit", "ut", Opt_utmpInhibit, "utmp inhibit"), 132 BOOL (Rs_utmpInhibit, "utmpInhibit", "ut", Opt_utmpInhibit, "utmp inhibit"),
128#ifndef NO_BELL 133#ifndef NO_BELL
129 BOOL (Rs_visualBell, "visualBell", "vb", Opt_visualBell, "visual bell"), 134 BOOL (Rs_visualBell, "visualBell", "vb", Opt_visualBell, "visual bell"),
138 BOOL (Rs_mouseWheelScrollPage, "mouseWheelScrollPage", NULL, Opt_mouseWheelScrollPage, NULL), 143 BOOL (Rs_mouseWheelScrollPage, "mouseWheelScrollPage", NULL, Opt_mouseWheelScrollPage, NULL),
139#endif 144#endif
140#if ENABLE_FRILLS 145#if ENABLE_FRILLS
141 BOOL (Rs_tripleclickwords, "tripleclickwords", "tcw", Opt_tripleclickwords, "triple click word selection"), 146 BOOL (Rs_tripleclickwords, "tripleclickwords", "tcw", Opt_tripleclickwords, "triple click word selection"),
142 BOOL (Rs_insecure, "insecure", "insecure", Opt_insecure, "enable possibly insecure escape sequences"), 147 BOOL (Rs_insecure, "insecure", "insecure", Opt_insecure, "enable possibly insecure escape sequences"),
148 BOOL (Rs_cursorUnderline, "cursorUnderline", "uc", Opt_cursorUnderline, "underline cursor"),
143#endif 149#endif
144#ifdef CURSOR_BLINK 150#if CURSOR_BLINK
145 BOOL (Rs_cursorBlink, "cursorBlink", "bc", Opt_cursorBlink, "blinking cursor"), 151 BOOL (Rs_cursorBlink, "cursorBlink", "bc", Opt_cursorBlink, "blinking cursor"),
146#endif 152#endif
147#ifdef POINTER_BLANK 153#ifdef POINTER_BLANK
148 BOOL (Rs_pointerBlank, "pointerBlank", "pb", Opt_pointerBlank, "switch off pointer after delay"), 154 BOOL (Rs_pointerBlank, "pointerBlank", "pb", Opt_pointerBlank, "switch off pointer after delay"),
149#endif 155#endif
155 RSTRG (Rs_color + minCOLOR + 3, "color3", "color"), 161 RSTRG (Rs_color + minCOLOR + 3, "color3", "color"),
156 RSTRG (Rs_color + minCOLOR + 4, "color4", "color"), 162 RSTRG (Rs_color + minCOLOR + 4, "color4", "color"),
157 RSTRG (Rs_color + minCOLOR + 5, "color5", "color"), 163 RSTRG (Rs_color + minCOLOR + 5, "color5", "color"),
158 RSTRG (Rs_color + minCOLOR + 6, "color6", "color"), 164 RSTRG (Rs_color + minCOLOR + 6, "color6", "color"),
159 RSTRG (Rs_color + minCOLOR + 7, "color7", "color"), 165 RSTRG (Rs_color + minCOLOR + 7, "color7", "color"),
160#ifndef NO_BRIGHTCOLOR
161 RSTRG (Rs_color + minBrightCOLOR + 0, "color8", "color"), 166 RSTRG (Rs_color + minBrightCOLOR + 0, "color8", "color"),
162 RSTRG (Rs_color + minBrightCOLOR + 1, "color9", "color"), 167 RSTRG (Rs_color + minBrightCOLOR + 1, "color9", "color"),
163 RSTRG (Rs_color + minBrightCOLOR + 2, "color10", "color"), 168 RSTRG (Rs_color + minBrightCOLOR + 2, "color10", "color"),
164 RSTRG (Rs_color + minBrightCOLOR + 3, "color11", "color"), 169 RSTRG (Rs_color + minBrightCOLOR + 3, "color11", "color"),
165 RSTRG (Rs_color + minBrightCOLOR + 4, "color12", "color"), 170 RSTRG (Rs_color + minBrightCOLOR + 4, "color12", "color"),
166 RSTRG (Rs_color + minBrightCOLOR + 5, "color13", "color"), 171 RSTRG (Rs_color + minBrightCOLOR + 5, "color13", "color"),
167 RSTRG (Rs_color + minBrightCOLOR + 6, "color14", "color"), 172 RSTRG (Rs_color + minBrightCOLOR + 6, "color14", "color"),
168 RSTRG (Rs_color + minBrightCOLOR + 7, "color15", "color"), 173 RSTRG (Rs_color + minBrightCOLOR + 7, "color15", "color"),
169#endif /* NO_BRIGHTCOLOR */
170#ifndef NO_BOLD_UNDERLINE_REVERSE 174#ifndef NO_BOLD_UNDERLINE_REVERSE
171 RSTRG (Rs_color + Color_BD, "colorBD", "color"), 175 RSTRG (Rs_color + Color_BD, "colorBD", "color"),
172 RSTRG (Rs_color + Color_IT, "colorIT", "color"), 176 RSTRG (Rs_color + Color_IT, "colorIT", "color"),
173 RSTRG (Rs_color + Color_UL, "colorUL", "color"), 177 RSTRG (Rs_color + Color_UL, "colorUL", "color"),
174 RSTRG (Rs_color + Color_RV, "colorRV", "color"), 178 RSTRG (Rs_color + Color_RV, "colorRV", "color"),
204 STRG (Rs_font, "font", "fn", "fontname", "normal text font"), 208 STRG (Rs_font, "font", "fn", "fontname", "normal text font"),
205#if ENABLE_STYLES 209#if ENABLE_STYLES
206 STRG (Rs_boldFont, "boldFont", "fb", "fontname", "bold font"), 210 STRG (Rs_boldFont, "boldFont", "fb", "fontname", "bold font"),
207 STRG (Rs_italicFont, "italicFont", "fi", "fontname", "italic font"), 211 STRG (Rs_italicFont, "italicFont", "fi", "fontname", "italic font"),
208 STRG (Rs_boldItalicFont, "boldItalicFont", "fbi", "fontname", "bold italic font"), 212 STRG (Rs_boldItalicFont, "boldItalicFont", "fbi", "fontname", "bold italic font"),
213 BOOL (Rs_intensityStyles, "intensityStyles", "is", Opt_intensityStyles, "font styles imply intensity changes"),
209#endif 214#endif
210#ifdef USE_XIM 215#ifdef USE_XIM
211 STRG (Rs_inputMethod, "inputMethod", "im", "name", "name of input method"), 216 STRG (Rs_inputMethod, "inputMethod", "im", "name", "name of input method"),
212 STRG (Rs_preeditType, "preeditType", "pt", "style", "input style: style = OverTheSpot|OffTheSpot|Root"), 217 STRG (Rs_preeditType, "preeditType", "pt", "style", "input style: style = OverTheSpot|OffTheSpot|Root"),
213 STRG (Rs_imLocale, "imLocale", "imlocale", "string", "locale to use for input method"), 218 STRG (Rs_imLocale, "imLocale", "imlocale", "string", "locale to use for input method"),
216 STRG (Rs_name, NULL, "name", "string", "client instance, icon, and title strings"), 221 STRG (Rs_name, NULL, "name", "string", "client instance, icon, and title strings"),
217 STRG (Rs_title, "title", "title", "string", "title name for window"), 222 STRG (Rs_title, "title", "title", "string", "title name for window"),
218 STRG (Rs_title, NULL, "T", NULL, NULL), /* short form */ 223 STRG (Rs_title, NULL, "T", NULL, NULL), /* short form */
219 STRG (Rs_iconName, "iconName", "n", "string", "icon name for window"), 224 STRG (Rs_iconName, "iconName", "n", "string", "icon name for window"),
220 STRG (Rs_saveLines, "saveLines", "sl", "number", "number of scrolled lines to save"), 225 STRG (Rs_saveLines, "saveLines", "sl", "number", "number of scrolled lines to save"),
226#if ENABLE_XEMBED
227 STRG (Rs_embed, NULL, "embed", "windowid", "window id to embed terminal in"),
228#endif
221#if ENABLE_FRILLS 229#if ENABLE_FRILLS
230 RSTRG (Rs_transient_for, "transient-for", "windowid"),
231 STRG (Rs_pty_fd, NULL, "pty-fd", "fileno", "file descriptor of pty to use"),
232 BOOL (Rs_hold, "hold", "hold", Opt_hold, "retain window after shell exit"),
222 STRG (Rs_ext_bwidth, "externalBorder", "w", "number", "external border in pixels"), 233 STRG (Rs_ext_bwidth, "externalBorder", "w", "number", "external border in pixels"),
223 STRG (Rs_ext_bwidth, NULL, "bw", NULL, NULL), 234 STRG (Rs_ext_bwidth, NULL, "bw", NULL, NULL),
224 STRG (Rs_ext_bwidth, NULL, "borderwidth", NULL, NULL), 235 STRG (Rs_ext_bwidth, NULL, "borderwidth", NULL, NULL),
225 STRG (Rs_int_bwidth, "internalBorder", "b", "number", "internal border in pixels"), 236 STRG (Rs_int_bwidth, "internalBorder", "b", "number", "internal border in pixels"),
226 BOOL (Rs_borderLess, "borderLess", "bl", Opt_borderLess, "borderless window"), 237 BOOL (Rs_borderLess, "borderLess", "bl", Opt_borderLess, "borderless window"),
238 BOOL (Rs_skipBuiltinGlyphs, "skipBuiltinGlyphs", "sbg", Opt_skipBuiltinGlyphs, "do not use internal glyphs"),
227 STRG (Rs_lineSpace, "lineSpace", "lsp", "number", "number of extra pixels between rows"), 239 STRG (Rs_lineSpace, "lineSpace", "lsp", "number", "number of extra pixels between rows"),
228#endif 240#endif
229#ifdef POINTER_BLANK 241#ifdef POINTER_BLANK
230 RSTRG (Rs_pointerBlankDelay, "pointerBlankDelay", "number"), 242 RSTRG (Rs_pointerBlankDelay, "pointerBlankDelay", "number"),
231#endif 243#endif
245#endif /* CUTCHAR_RESOURCE */ 257#endif /* CUTCHAR_RESOURCE */
246 RSTRG (Rs_answerbackstring, "answerbackString", "string"), 258 RSTRG (Rs_answerbackstring, "answerbackString", "string"),
247#ifndef NO_SECONDARY_SCREEN 259#ifndef NO_SECONDARY_SCREEN
248 BOOL (Rs_secondaryScreen, "secondaryScreen", "ssc", Opt_secondaryScreen, "enable secondary screen"), 260 BOOL (Rs_secondaryScreen, "secondaryScreen", "ssc", Opt_secondaryScreen, "enable secondary screen"),
249 BOOL (Rs_secondaryScroll, "secondaryScroll", "ssr", Opt_secondaryScroll, "enable secondary screen scroll"), 261 BOOL (Rs_secondaryScroll, "secondaryScroll", "ssr", Opt_secondaryScroll, "enable secondary screen scroll"),
262#endif
263#if ENABLE_PERL
264 RSTRG (Rs_perl_lib, "perl-lib", "string"), //, "colon-separated directories with extension scripts"),TODO
265 RSTRG (Rs_perl_eval, "perl-eval", "perl-eval"), // "string", "code to be evaluated after all extensions have been loaded"),TODO
266 RSTRG (Rs_perl_ext_1, "perl-ext-common", "string"), //, "colon-separated list of perl extensions to enable"),TODO
267 STRG (Rs_perl_ext_2, "perl-ext", "pe", "string", "colon-separated list of perl extensions to enable for this instance"),
250#endif 268#endif
251#if 0 && TODO 269#if 0 && TODO
252#if !defined(NO_RESOURCES) && defined(USE_XGETDEFAULT) 270#if !defined(NO_RESOURCES) && defined(USE_XGETDEFAULT)
253 INFO ("xrm", "string", "X resource"), 271 INFO ("xrm", "string", "X resource"),
254#endif 272#endif
386#endif 404#endif
387#if defined(NO_RESOURCES) 405#if defined(NO_RESOURCES)
388 "NoResources" 406 "NoResources"
389#else 407#else
390# if defined(USE_XGETDEFAULT) 408# if defined(USE_XGETDEFAULT)
391 "XGetDefaults" 409 "XGetDefault"
392# else 410# else
393 ".Xdefaults" 411 ".Xdefaults"
394# endif 412# endif
395#endif 413#endif
396 "\nUsage: "; /* Usage */ 414 "\nUsage: "; /* Usage */
555 { /* boolean value */ 573 { /* boolean value */
556#ifdef DEBUG_RESOURCES 574#ifdef DEBUG_RESOURCES
557 fprintf (stderr, "boolean (%s,%s) = %s\n", 575 fprintf (stderr, "boolean (%s,%s) = %s\n",
558 optList[entry].opt, optList[entry].kw, flag); 576 optList[entry].opt, optList[entry].kw, flag);
559#endif 577#endif
560 if (flag == On) 578 set_option (optList[entry].flag & Optflag_mask, flag == On);
561 options |= optList[entry].flag;
562 else
563 options &= ~optList[entry].flag;
564 579
565 if (optList[entry].doff != -1) 580 if (optList[entry].doff != -1)
566 rs[optList[entry].doff] = flag; 581 rs[optList[entry].doff] = flag;
567 } 582 }
568 } 583 }
849 || strcmp (str, "1") == 0; 864 || strcmp (str, "1") == 0;
850 865
851 if (optList_isReverse (entry)) 866 if (optList_isReverse (entry))
852 s = !s; 867 s = !s;
853 868
854 if (s)
855 options |= optList[entry].flag; 869 set_option (optList[entry].flag & Optflag_mask, s);
856 else
857 options &= ~optList[entry].flag;
858 } 870 }
859 } 871 }
860 872
861 break; 873 break;
862 } 874 }
867} 879}
868 880
869/*}}} */ 881/*}}} */
870# endif /* ! USE_XGETDEFAULT */ 882# endif /* ! USE_XGETDEFAULT */
871#endif /* NO_RESOURCES */ 883#endif /* NO_RESOURCES */
884
885#ifdef USE_XGETDEFAULT
886char *get_res (XrmDatabase database, const char *program, const char *option)
887{
888 char resource[512];
889 char *type;
890 XrmValue result;
891
892 snprintf (resource, sizeof (resource), "%s.%s", program, option);
893 XrmGetResource (database, resource, resource, &type, &result);
894
895 return result.addr;
896}
897#endif
872 898
873/*{{{ read the resources files */ 899/*{{{ read the resources files */
874/* 900/*
875 * using XGetDefault () or the hand-rolled replacement 901 * using XGetDefault () or the hand-rolled replacement
876 */ 902 */
901 /* 927 /*
902 * get resources using the X library function 928 * get resources using the X library function
903 */ 929 */
904 int entry; 930 int entry;
905 931
906# ifdef XrmEnumOneLevel
907 int i;
908 char *displayResource, *xe; 932 char *displayResource, *xe;
909 XrmName name_prefix[3]; 933 XrmName name_prefix[3];
910 XrmClass class_prefix[3]; 934 XrmClass class_prefix[3];
911 XrmDatabase database, rdb1; 935 XrmDatabase database, rdb1;
912 936
913 XrmInitialize ();
914 database = NULL; 937 database = NULL;
915 938
916 // for ordering, see for example http://www.faqs.org/faqs/Xt-FAQ/ Subject: 20 939 // for ordering, see for example http://www.faqs.org/faqs/Xt-FAQ/ Subject: 20
917 940
918 // 6. System wide per application default file. 941 // 6. System wide per application default file.
979 if ((rdb1 = XrmGetFileDatabase (fname))) 1002 if ((rdb1 = XrmGetFileDatabase (fname)))
980 XrmMergeDatabases (rdb1, &database); 1003 XrmMergeDatabases (rdb1, &database);
981 } 1004 }
982 } 1005 }
983 1006
984 XrmSetDatabase (disp, database); 1007 xrmdatabase = database;
985# endif
986 1008
987 /* 1009 /*
988 * Query resources for options that affect us 1010 * Query resources for options that affect us
989 */ 1011 */
990 for (entry = 0; entry < optList_size; entry++) 1012 for (entry = 0; entry < optList_size; entry++)
994 const char *kw = optList[entry].kw; 1016 const char *kw = optList[entry].kw;
995 1017
996 if (kw == NULL || rs[optList[entry].doff] != NULL) 1018 if (kw == NULL || rs[optList[entry].doff] != NULL)
997 continue; /* previously set */ 1019 continue; /* previously set */
998 1020
999 p = XGetDefault (disp, rs[Rs_name], kw); 1021 p = get_res (database, rs[Rs_name], kw);
1000 p0 = XGetDefault (disp, "!INVALIDPROGRAMMENAMEDONTMATCH!", kw); 1022 p0 = get_res (database, "!INVALIDPROGRAMMENAMEDONTMATCH!", kw);
1001 if (p == NULL || (p0 && strcmp (p, p0) == 0)) 1023 if (p == NULL || (p0 && strcmp (p, p0) == 0))
1002 { 1024 {
1003 p = XGetDefault (disp, RESCLASS, kw); 1025 p = get_res (database, RESCLASS, kw);
1004#ifdef RESFALLBACK 1026#ifdef RESFALLBACK
1005 if (p == NULL || (p0 && strcmp (p, p0) == 0)) 1027 if (p == NULL || (p0 && strcmp (p, p0) == 0))
1006 p = XGetDefault (disp, RESFALLBACK, kw); 1028 p = get_res (database, RESFALLBACK, kw);
1007#endif 1029#endif
1008 } 1030 }
1009 1031
1010 if (p == NULL && p0) 1032 if (p == NULL && p0)
1011 p = p0; 1033 p = p0;
1022 || strcasecmp (p, "1") == 0; 1044 || strcasecmp (p, "1") == 0;
1023 1045
1024 if (optList_isReverse (entry)) 1046 if (optList_isReverse (entry))
1025 s = !s; 1047 s = !s;
1026 1048
1027 if (s) 1049 set_option (optList[entry].flag & Optflag_mask, s);
1028 options |= optList[entry].flag;
1029 else
1030 options &= ~optList[entry].flag;
1031 } 1050 }
1032 } 1051 }
1033 } 1052 }
1034 1053
1035 /* 1054 /*
1041 name_prefix[2] = NULLQUARK; 1060 name_prefix[2] = NULLQUARK;
1042 class_prefix[0] = XrmStringToName (RESCLASS); 1061 class_prefix[0] = XrmStringToName (RESCLASS);
1043 class_prefix[1] = XrmStringToName ("Keysym"); 1062 class_prefix[1] = XrmStringToName ("Keysym");
1044 class_prefix[2] = NULLQUARK; 1063 class_prefix[2] = NULLQUARK;
1045 /* XXX: Need to check sizeof (rxvt_t) == sizeof (XPointer) */ 1064 /* XXX: Need to check sizeof (rxvt_t) == sizeof (XPointer) */
1046 XrmEnumerateDatabase (XrmGetDatabase (disp), name_prefix, class_prefix, 1065 XrmEnumerateDatabase (database, name_prefix, class_prefix,
1047 XrmEnumOneLevel, rxvt_define_key, NULL); 1066 XrmEnumOneLevel, rxvt_define_key, NULL);
1048# ifdef RESFALLBACK 1067# ifdef RESFALLBACK
1049 name_prefix[0] = XrmStringToName (RESFALLBACK); 1068 name_prefix[0] = XrmStringToName (RESFALLBACK);
1050 name_prefix[1] = XrmStringToName ("keysym"); 1069 name_prefix[1] = XrmStringToName ("keysym");
1051 class_prefix[0] = XrmStringToName (RESFALLBACK); 1070 class_prefix[0] = XrmStringToName (RESFALLBACK);
1052 class_prefix[1] = XrmStringToName ("Keysym"); 1071 class_prefix[1] = XrmStringToName ("Keysym");
1053 /* XXX: Need to check sizeof (rxvt_t) == sizeof (XPointer) */ 1072 /* XXX: Need to check sizeof (rxvt_t) == sizeof (XPointer) */
1054 XrmEnumerateDatabase (XrmGetDatabase (disp), name_prefix, class_prefix, 1073 XrmEnumerateDatabase (database, name_prefix, class_prefix,
1055 XrmEnumOneLevel, rxvt_define_key, NULL); 1074 XrmEnumOneLevel, rxvt_define_key, NULL);
1056# endif 1075# endif
1057# endif 1076# endif
1058 1077
1059# else /* USE_XGETDEFAULT */ 1078# else /* USE_XGETDEFAULT */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines