… | |
… | |
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 | |
79 | static const struct |
84 | static const struct |
80 | { |
85 | { |
… | |
… | |
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 | #if 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 | SWCH ("tr", Opt_transparent, NULL), |
120 | SWCH ("tr", Opt_transparent, NULL), |
… | |
… | |
156 | RSTRG (Rs_color + minCOLOR + 3, "color3", "color"), |
161 | RSTRG (Rs_color + minCOLOR + 3, "color3", "color"), |
157 | RSTRG (Rs_color + minCOLOR + 4, "color4", "color"), |
162 | RSTRG (Rs_color + minCOLOR + 4, "color4", "color"), |
158 | RSTRG (Rs_color + minCOLOR + 5, "color5", "color"), |
163 | RSTRG (Rs_color + minCOLOR + 5, "color5", "color"), |
159 | RSTRG (Rs_color + minCOLOR + 6, "color6", "color"), |
164 | RSTRG (Rs_color + minCOLOR + 6, "color6", "color"), |
160 | RSTRG (Rs_color + minCOLOR + 7, "color7", "color"), |
165 | RSTRG (Rs_color + minCOLOR + 7, "color7", "color"), |
161 | #ifndef NO_BRIGHTCOLOR |
|
|
162 | RSTRG (Rs_color + minBrightCOLOR + 0, "color8", "color"), |
166 | RSTRG (Rs_color + minBrightCOLOR + 0, "color8", "color"), |
163 | RSTRG (Rs_color + minBrightCOLOR + 1, "color9", "color"), |
167 | RSTRG (Rs_color + minBrightCOLOR + 1, "color9", "color"), |
164 | RSTRG (Rs_color + minBrightCOLOR + 2, "color10", "color"), |
168 | RSTRG (Rs_color + minBrightCOLOR + 2, "color10", "color"), |
165 | RSTRG (Rs_color + minBrightCOLOR + 3, "color11", "color"), |
169 | RSTRG (Rs_color + minBrightCOLOR + 3, "color11", "color"), |
166 | RSTRG (Rs_color + minBrightCOLOR + 4, "color12", "color"), |
170 | RSTRG (Rs_color + minBrightCOLOR + 4, "color12", "color"), |
167 | RSTRG (Rs_color + minBrightCOLOR + 5, "color13", "color"), |
171 | RSTRG (Rs_color + minBrightCOLOR + 5, "color13", "color"), |
168 | RSTRG (Rs_color + minBrightCOLOR + 6, "color14", "color"), |
172 | RSTRG (Rs_color + minBrightCOLOR + 6, "color14", "color"), |
169 | RSTRG (Rs_color + minBrightCOLOR + 7, "color15", "color"), |
173 | RSTRG (Rs_color + minBrightCOLOR + 7, "color15", "color"), |
170 | #endif /* NO_BRIGHTCOLOR */ |
|
|
171 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
174 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
172 | RSTRG (Rs_color + Color_BD, "colorBD", "color"), |
175 | RSTRG (Rs_color + Color_BD, "colorBD", "color"), |
173 | RSTRG (Rs_color + Color_IT, "colorIT", "color"), |
176 | RSTRG (Rs_color + Color_IT, "colorIT", "color"), |
174 | RSTRG (Rs_color + Color_UL, "colorUL", "color"), |
177 | RSTRG (Rs_color + Color_UL, "colorUL", "color"), |
175 | RSTRG (Rs_color + Color_RV, "colorRV", "color"), |
178 | RSTRG (Rs_color + Color_RV, "colorRV", "color"), |
… | |
… | |
205 | STRG (Rs_font, "font", "fn", "fontname", "normal text font"), |
208 | STRG (Rs_font, "font", "fn", "fontname", "normal text font"), |
206 | #if ENABLE_STYLES |
209 | #if ENABLE_STYLES |
207 | STRG (Rs_boldFont, "boldFont", "fb", "fontname", "bold font"), |
210 | STRG (Rs_boldFont, "boldFont", "fb", "fontname", "bold font"), |
208 | STRG (Rs_italicFont, "italicFont", "fi", "fontname", "italic font"), |
211 | STRG (Rs_italicFont, "italicFont", "fi", "fontname", "italic font"), |
209 | 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"), |
210 | #endif |
214 | #endif |
211 | #ifdef USE_XIM |
215 | #ifdef USE_XIM |
212 | STRG (Rs_inputMethod, "inputMethod", "im", "name", "name of input method"), |
216 | STRG (Rs_inputMethod, "inputMethod", "im", "name", "name of input method"), |
213 | 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"), |
214 | 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"), |
… | |
… | |
222 | #if ENABLE_XEMBED |
226 | #if ENABLE_XEMBED |
223 | STRG (Rs_embed, NULL, "embed", "windowid", "window id to embed terminal in"), |
227 | STRG (Rs_embed, NULL, "embed", "windowid", "window id to embed terminal in"), |
224 | #endif |
228 | #endif |
225 | #if ENABLE_FRILLS |
229 | #if ENABLE_FRILLS |
226 | STRG (Rs_pty_fd, NULL, "pty-fd", "fileno", "file descriptor of pty to use"), |
230 | STRG (Rs_pty_fd, NULL, "pty-fd", "fileno", "file descriptor of pty to use"), |
|
|
231 | BOOL (Rs_hold, "hold", "hold", Opt_hold, "retain window after shell exit"), |
227 | STRG (Rs_ext_bwidth, "externalBorder", "w", "number", "external border in pixels"), |
232 | STRG (Rs_ext_bwidth, "externalBorder", "w", "number", "external border in pixels"), |
228 | STRG (Rs_ext_bwidth, NULL, "bw", NULL, NULL), |
233 | STRG (Rs_ext_bwidth, NULL, "bw", NULL, NULL), |
229 | STRG (Rs_ext_bwidth, NULL, "borderwidth", NULL, NULL), |
234 | STRG (Rs_ext_bwidth, NULL, "borderwidth", NULL, NULL), |
230 | STRG (Rs_int_bwidth, "internalBorder", "b", "number", "internal border in pixels"), |
235 | STRG (Rs_int_bwidth, "internalBorder", "b", "number", "internal border in pixels"), |
231 | BOOL (Rs_borderLess, "borderLess", "bl", Opt_borderLess, "borderless window"), |
236 | BOOL (Rs_borderLess, "borderLess", "bl", Opt_borderLess, "borderless window"), |
|
|
237 | BOOL (Rs_skipBuiltinGlyphs, "skipBuiltinGlyphs", "sbg", Opt_skipBuiltinGlyphs, "do not use internal glyphs"), |
232 | STRG (Rs_lineSpace, "lineSpace", "lsp", "number", "number of extra pixels between rows"), |
238 | STRG (Rs_lineSpace, "lineSpace", "lsp", "number", "number of extra pixels between rows"), |
233 | #endif |
239 | #endif |
234 | #ifdef POINTER_BLANK |
240 | #ifdef POINTER_BLANK |
235 | RSTRG (Rs_pointerBlankDelay, "pointerBlankDelay", "number"), |
241 | RSTRG (Rs_pointerBlankDelay, "pointerBlankDelay", "number"), |
236 | #endif |
242 | #endif |
… | |
… | |
250 | #endif /* CUTCHAR_RESOURCE */ |
256 | #endif /* CUTCHAR_RESOURCE */ |
251 | RSTRG (Rs_answerbackstring, "answerbackString", "string"), |
257 | RSTRG (Rs_answerbackstring, "answerbackString", "string"), |
252 | #ifndef NO_SECONDARY_SCREEN |
258 | #ifndef NO_SECONDARY_SCREEN |
253 | BOOL (Rs_secondaryScreen, "secondaryScreen", "ssc", Opt_secondaryScreen, "enable secondary screen"), |
259 | BOOL (Rs_secondaryScreen, "secondaryScreen", "ssc", Opt_secondaryScreen, "enable secondary screen"), |
254 | BOOL (Rs_secondaryScroll, "secondaryScroll", "ssr", Opt_secondaryScroll, "enable secondary screen scroll"), |
260 | BOOL (Rs_secondaryScroll, "secondaryScroll", "ssr", Opt_secondaryScroll, "enable secondary screen scroll"), |
|
|
261 | #endif |
|
|
262 | #if ENABLE_PERL |
|
|
263 | RSTRG (Rs_perl_lib, "perl-lib", "string"), //, "colon-separated directories with extension scripts"),TODO |
|
|
264 | RSTRG (Rs_perl_eval, "perl-eval", "perl-eval"), // "string", "code to be evaluated after all extensions have been loaded"),TODO |
|
|
265 | RSTRG (Rs_perl_ext_1, "perl-ext-common", "string"), //, "colon-separated list of perl extensions to enable"),TODO |
|
|
266 | STRG (Rs_perl_ext_2, "perl-ext", "pe", "string", "colon-separated list of perl extensions to enable for this instance"), |
255 | #endif |
267 | #endif |
256 | #if 0 && TODO |
268 | #if 0 && TODO |
257 | #if !defined(NO_RESOURCES) && defined(USE_XGETDEFAULT) |
269 | #if !defined(NO_RESOURCES) && defined(USE_XGETDEFAULT) |
258 | INFO ("xrm", "string", "X resource"), |
270 | INFO ("xrm", "string", "X resource"), |
259 | #endif |
271 | #endif |
… | |
… | |
561 | #ifdef DEBUG_RESOURCES |
573 | #ifdef DEBUG_RESOURCES |
562 | fprintf (stderr, "boolean (%s,%s) = %s\n", |
574 | fprintf (stderr, "boolean (%s,%s) = %s\n", |
563 | optList[entry].opt, optList[entry].kw, flag); |
575 | optList[entry].opt, optList[entry].kw, flag); |
564 | #endif |
576 | #endif |
565 | if (flag == On) |
577 | if (flag == On) |
566 | options |= optList[entry].flag; |
578 | SET_OPTION (optList[entry].flag & Optflag_mask); |
567 | else |
579 | else |
568 | options &= ~optList[entry].flag; |
580 | CLR_OPTION (optList[entry].flag & Optflag_mask); |
569 | |
581 | |
570 | if (optList[entry].doff != -1) |
582 | if (optList[entry].doff != -1) |
571 | rs[optList[entry].doff] = flag; |
583 | rs[optList[entry].doff] = flag; |
572 | } |
584 | } |
573 | } |
585 | } |
… | |
… | |
855 | |
867 | |
856 | if (optList_isReverse (entry)) |
868 | if (optList_isReverse (entry)) |
857 | s = !s; |
869 | s = !s; |
858 | |
870 | |
859 | if (s) |
871 | if (s) |
860 | options |= optList[entry].flag; |
872 | SET_OPTION (optList[entry].flag & Optflag_mask); |
861 | else |
873 | else |
862 | options &= ~optList[entry].flag; |
874 | CLR_OPTION (optList[entry].flag & Optflag_mask); |
863 | } |
875 | } |
864 | } |
876 | } |
865 | |
877 | |
866 | break; |
878 | break; |
867 | } |
879 | } |
… | |
… | |
1027 | |
1039 | |
1028 | if (optList_isReverse (entry)) |
1040 | if (optList_isReverse (entry)) |
1029 | s = !s; |
1041 | s = !s; |
1030 | |
1042 | |
1031 | if (s) |
1043 | if (s) |
1032 | options |= optList[entry].flag; |
1044 | SET_OPTION (optList[entry].flag & Optflag_mask); |
1033 | else |
1045 | else |
1034 | options &= ~optList[entry].flag; |
1046 | CLR_OPTION (optList[entry].flag & Optflag_mask); |
1035 | } |
1047 | } |
1036 | } |
1048 | } |
1037 | } |
1049 | } |
1038 | |
1050 | |
1039 | /* |
1051 | /* |