… | |
… | |
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 | { |
… | |
… | |
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 |
… | |
… | |
204 | STRG (Rs_font, "font", "fn", "fontname", "normal text font"), |
210 | STRG (Rs_font, "font", "fn", "fontname", "normal text font"), |
205 | #if ENABLE_STYLES |
211 | #if ENABLE_STYLES |
206 | STRG (Rs_boldFont, "boldFont", "fb", "fontname", "bold font"), |
212 | STRG (Rs_boldFont, "boldFont", "fb", "fontname", "bold font"), |
207 | STRG (Rs_italicFont, "italicFont", "fi", "fontname", "italic font"), |
213 | STRG (Rs_italicFont, "italicFont", "fi", "fontname", "italic font"), |
208 | STRG (Rs_boldItalicFont, "boldItalicFont", "fbi", "fontname", "bold italic font"), |
214 | STRG (Rs_boldItalicFont, "boldItalicFont", "fbi", "fontname", "bold italic font"), |
|
|
215 | BOOL (Rs_intensityStyles, "intensityStyles", "is", Opt_intensityStyles, "font styles imply intensity changes"), |
209 | #endif |
216 | #endif |
210 | #ifdef USE_XIM |
217 | #ifdef USE_XIM |
211 | STRG (Rs_inputMethod, "inputMethod", "im", "name", "name of input method"), |
218 | STRG (Rs_inputMethod, "inputMethod", "im", "name", "name of input method"), |
212 | STRG (Rs_preeditType, "preeditType", "pt", "style", "input style: style = OverTheSpot|OffTheSpot|Root"), |
219 | 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"), |
220 | STRG (Rs_imLocale, "imLocale", "imlocale", "string", "locale to use for input method"), |
… | |
… | |
221 | #if ENABLE_XEMBED |
228 | #if ENABLE_XEMBED |
222 | STRG (Rs_embed, NULL, "embed", "windowid", "window id to embed terminal in"), |
229 | STRG (Rs_embed, NULL, "embed", "windowid", "window id to embed terminal in"), |
223 | #endif |
230 | #endif |
224 | #if ENABLE_FRILLS |
231 | #if ENABLE_FRILLS |
225 | STRG (Rs_pty_fd, NULL, "pty-fd", "fileno", "file descriptor of pty to use"), |
232 | STRG (Rs_pty_fd, NULL, "pty-fd", "fileno", "file descriptor of pty to use"), |
|
|
233 | BOOL (Rs_hold, "hold", "hold", Opt_hold, "retain window after shell exit"), |
226 | STRG (Rs_ext_bwidth, "externalBorder", "w", "number", "external border in pixels"), |
234 | STRG (Rs_ext_bwidth, "externalBorder", "w", "number", "external border in pixels"), |
227 | STRG (Rs_ext_bwidth, NULL, "bw", NULL, NULL), |
235 | STRG (Rs_ext_bwidth, NULL, "bw", NULL, NULL), |
228 | STRG (Rs_ext_bwidth, NULL, "borderwidth", NULL, NULL), |
236 | STRG (Rs_ext_bwidth, NULL, "borderwidth", NULL, NULL), |
229 | STRG (Rs_int_bwidth, "internalBorder", "b", "number", "internal border in pixels"), |
237 | STRG (Rs_int_bwidth, "internalBorder", "b", "number", "internal border in pixels"), |
230 | BOOL (Rs_borderLess, "borderLess", "bl", Opt_borderLess, "borderless window"), |
238 | BOOL (Rs_borderLess, "borderLess", "bl", Opt_borderLess, "borderless window"), |
… | |
… | |
249 | #endif /* CUTCHAR_RESOURCE */ |
257 | #endif /* CUTCHAR_RESOURCE */ |
250 | RSTRG (Rs_answerbackstring, "answerbackString", "string"), |
258 | RSTRG (Rs_answerbackstring, "answerbackString", "string"), |
251 | #ifndef NO_SECONDARY_SCREEN |
259 | #ifndef NO_SECONDARY_SCREEN |
252 | BOOL (Rs_secondaryScreen, "secondaryScreen", "ssc", Opt_secondaryScreen, "enable secondary screen"), |
260 | BOOL (Rs_secondaryScreen, "secondaryScreen", "ssc", Opt_secondaryScreen, "enable secondary screen"), |
253 | 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"), |
|
|
265 | RSTRG (Rs_perl_eval, "perl-eval", "perl-eval"), // "string", "code to be evaluated after all extensions have been loaded"), |
|
|
266 | STRG (Rs_perl_ext, "perl-ext", "pe", "string", "colon-separated list of perl extensions to enable"), |
254 | #endif |
267 | #endif |
255 | #if 0 && TODO |
268 | #if 0 && TODO |
256 | #if !defined(NO_RESOURCES) && defined(USE_XGETDEFAULT) |
269 | #if !defined(NO_RESOURCES) && defined(USE_XGETDEFAULT) |
257 | INFO ("xrm", "string", "X resource"), |
270 | INFO ("xrm", "string", "X resource"), |
258 | #endif |
271 | #endif |
… | |
… | |
560 | #ifdef DEBUG_RESOURCES |
573 | #ifdef DEBUG_RESOURCES |
561 | fprintf (stderr, "boolean (%s,%s) = %s\n", |
574 | fprintf (stderr, "boolean (%s,%s) = %s\n", |
562 | optList[entry].opt, optList[entry].kw, flag); |
575 | optList[entry].opt, optList[entry].kw, flag); |
563 | #endif |
576 | #endif |
564 | if (flag == On) |
577 | if (flag == On) |
565 | options |= optList[entry].flag; |
578 | SET_OPTION (optList[entry].flag & Optflag_mask); |
566 | else |
579 | else |
567 | options &= ~optList[entry].flag; |
580 | CLR_OPTION (optList[entry].flag & Optflag_mask); |
568 | |
581 | |
569 | if (optList[entry].doff != -1) |
582 | if (optList[entry].doff != -1) |
570 | rs[optList[entry].doff] = flag; |
583 | rs[optList[entry].doff] = flag; |
571 | } |
584 | } |
572 | } |
585 | } |
… | |
… | |
854 | |
867 | |
855 | if (optList_isReverse (entry)) |
868 | if (optList_isReverse (entry)) |
856 | s = !s; |
869 | s = !s; |
857 | |
870 | |
858 | if (s) |
871 | if (s) |
859 | options |= optList[entry].flag; |
872 | SET_OPTION (optList[entry].flag & Optflag_mask); |
860 | else |
873 | else |
861 | options &= ~optList[entry].flag; |
874 | CLR_OPTION (optList[entry].flag & Optflag_mask); |
862 | } |
875 | } |
863 | } |
876 | } |
864 | |
877 | |
865 | break; |
878 | break; |
866 | } |
879 | } |
… | |
… | |
906 | * get resources using the X library function |
919 | * get resources using the X library function |
907 | */ |
920 | */ |
908 | int entry; |
921 | int entry; |
909 | |
922 | |
910 | # ifdef XrmEnumOneLevel |
923 | # ifdef XrmEnumOneLevel |
911 | int i; |
|
|
912 | char *displayResource, *xe; |
924 | char *displayResource, *xe; |
913 | XrmName name_prefix[3]; |
925 | XrmName name_prefix[3]; |
914 | XrmClass class_prefix[3]; |
926 | XrmClass class_prefix[3]; |
915 | XrmDatabase database, rdb1; |
927 | XrmDatabase database, rdb1; |
916 | |
928 | |
… | |
… | |
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 | /* |