… | |
… | |
134 | #endif |
134 | #endif |
135 | #ifdef MOUSE_WHEEL |
135 | #ifdef MOUSE_WHEEL |
136 | BOOL (Rs_mouseWheelScrollPage, "mouseWheelScrollPage", NULL, Opt_mouseWheelScrollPage, 0, NULL), |
136 | BOOL (Rs_mouseWheelScrollPage, "mouseWheelScrollPage", NULL, Opt_mouseWheelScrollPage, 0, NULL), |
137 | #endif |
137 | #endif |
138 | #if ENABLE_FRILLS |
138 | #if ENABLE_FRILLS |
|
|
139 | BOOL (Rs_disablePasteBrackets, "disablePasteBrackets", "dpb", Opt_disablePasteBrackets, 0, "paste bracket suppression"), |
139 | BOOL (Rs_tripleclickwords, "tripleclickwords", "tcw", Opt_tripleclickwords, 0, "triple click word selection"), |
140 | BOOL (Rs_tripleclickwords, "tripleclickwords", "tcw", Opt_tripleclickwords, 0, "triple click word selection"), |
140 | BOOL (Rs_insecure, "insecure", "insecure", Opt_insecure, 0, "enable possibly insecure escape sequences"), |
141 | BOOL (Rs_insecure, "insecure", "insecure", Opt_insecure, 0, "enable possibly insecure escape sequences"), |
141 | BOOL (Rs_cursorUnderline, "cursorUnderline", "uc", Opt_cursorUnderline, 0, "underline cursor"), |
142 | BOOL (Rs_cursorUnderline, "cursorUnderline", "uc", Opt_cursorUnderline, 0, "underline cursor"), |
142 | #endif |
143 | #endif |
143 | #if CURSOR_BLINK |
144 | #if CURSOR_BLINK |
… | |
… | |
219 | #endif |
220 | #endif |
220 | #if XFT |
221 | #if XFT |
221 | BOOL (Rs_buffered, "buffered", NULL, Opt_buffered, 0, NULL), |
222 | BOOL (Rs_buffered, "buffered", NULL, Opt_buffered, 0, NULL), |
222 | #endif |
223 | #endif |
223 | #if ENABLE_FRILLS |
224 | #if ENABLE_FRILLS |
|
|
225 | STRG (Rs_refreshRate, "refreshRate", "fps", "number", "refresh rate / frames per second"), |
224 | STRG (Rs_depth, "depth", "depth", "number", "depth of visual to request"), |
226 | STRG (Rs_depth, "depth", "depth", "number", "depth of visual to request"), |
225 | STRG (Rs_visual, "visual", "visual", "number", "visual id to request"), |
227 | STRG (Rs_visual, "visual", "visual", "number", "visual id to request"), |
226 | RSTRG (Rs_transient_for, "transient-for", "windowid"), |
228 | RSTRG (Rs_transient_for, "transient-for", "windowid"), |
227 | BOOL (Rs_override_redirect, "override-redirect", "override-redirect", Opt_override_redirect, 0, "set override-redirect on the terminal window"), |
229 | BOOL (Rs_override_redirect, "override-redirect", "override-redirect", Opt_override_redirect, 0, "override-redirect on the terminal window"), |
228 | 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"), |
229 | BOOL (Rs_hold, "hold", "hold", Opt_hold, 0, "retain window after shell exit"), |
231 | BOOL (Rs_hold, "hold", "hold", Opt_hold, 0, "retain window after shell exit"), |
230 | STRG (Rs_ext_bwidth, "externalBorder", "w", "number", "external border in pixels"), |
232 | STRG (Rs_ext_bwidth, "externalBorder", "w", "number", "external border in pixels"), |
231 | STRG (Rs_ext_bwidth, NULL, "bw", NULL, NULL), |
233 | STRG (Rs_ext_bwidth, NULL, "bw", NULL, NULL), |
232 | STRG (Rs_ext_bwidth, NULL, "borderwidth", NULL, NULL), |
234 | STRG (Rs_ext_bwidth, NULL, "borderwidth", NULL, NULL), |
… | |
… | |
234 | BOOL (Rs_borderLess, "borderLess", "bl", Opt_borderLess, 0, "borderless window"), |
236 | BOOL (Rs_borderLess, "borderLess", "bl", Opt_borderLess, 0, "borderless window"), |
235 | STRG (Rs_lineSpace, "lineSpace", "lsp", "number", "number of extra pixels between rows"), |
237 | STRG (Rs_lineSpace, "lineSpace", "lsp", "number", "number of extra pixels between rows"), |
236 | STRG (Rs_letterSpace, "letterSpace", "letsp", "number", "letter spacing adjustment"), |
238 | STRG (Rs_letterSpace, "letterSpace", "letsp", "number", "letter spacing adjustment"), |
237 | #endif |
239 | #endif |
238 | #ifdef BUILTIN_GLYPHS |
240 | #ifdef BUILTIN_GLYPHS |
239 | BOOL (Rs_skipBuiltinGlyphs, "skipBuiltinGlyphs", "sbg", Opt_skipBuiltinGlyphs, 0, "do not use internal glyphs"), |
241 | BOOL (Rs_skipBuiltinGlyphs, "skipBuiltinGlyphs", "sbg", Opt_skipBuiltinGlyphs, 0, "use of font glyphs instead of internal glyphs"), |
240 | #endif |
242 | #endif |
241 | #ifdef POINTER_BLANK |
243 | #ifdef POINTER_BLANK |
242 | RSTRG (Rs_pointerBlankDelay, "pointerBlankDelay", "number"), |
244 | RSTRG (Rs_pointerBlankDelay, "pointerBlankDelay", "number"), |
243 | #endif |
245 | #endif |
244 | #ifndef NO_BACKSPACE_KEY |
246 | #ifndef NO_BACKSPACE_KEY |
… | |
… | |
252 | #endif |
254 | #endif |
253 | STRG (Rs_modifier, "modifier", "mod", "modifier", "meta modifier = alt|meta|hyper|super|mod1|...|mod5"), |
255 | STRG (Rs_modifier, "modifier", "mod", "modifier", "meta modifier = alt|meta|hyper|super|mod1|...|mod5"), |
254 | RSTRG (Rs_cutchars, "cutchars", "string"), |
256 | RSTRG (Rs_cutchars, "cutchars", "string"), |
255 | RSTRG (Rs_answerbackstring, "answerbackString", "string"), |
257 | RSTRG (Rs_answerbackstring, "answerbackString", "string"), |
256 | #ifndef NO_SECONDARY_SCREEN |
258 | #ifndef NO_SECONDARY_SCREEN |
257 | BOOL (Rs_secondaryScreen, "secondaryScreen", "ssc", Opt_secondaryScreen, 0, "enable secondary screen"), |
259 | BOOL (Rs_secondaryScreen, "secondaryScreen", "ssc", Opt_secondaryScreen, 0, "secondary screen"), |
258 | BOOL (Rs_secondaryScroll, "secondaryScroll", "ssr", Opt_secondaryScroll, 0, "enable secondary screen scroll"), |
260 | BOOL (Rs_secondaryScroll, "secondaryScroll", "ssr", Opt_secondaryScroll, 0, "secondary screen scroll"), |
|
|
261 | #endif |
|
|
262 | #if ENABLE_FRILLS |
|
|
263 | STRG (Rs_rewrapMode, "rewrapMode", "rm", "string", "rewrap mode (auto, always, never)"), |
259 | #endif |
264 | #endif |
260 | #if ENABLE_PERL |
265 | #if ENABLE_PERL |
261 | RSTRG (Rs_perl_lib, "perl-lib", "string"), //, "colon-separated directories with extension scripts"),TODO |
266 | RSTRG (Rs_perl_lib, "perl-lib", "string"), //, "colon-separated directories with extension scripts"),TODO |
262 | RSTRG (Rs_perl_eval, "perl-eval", "perl-eval"), // "string", "code to be evaluated after all extensions have been loaded"),TODO |
267 | RSTRG (Rs_perl_eval, "perl-eval", "perl-eval"), // "string", "code to be evaluated after all extensions have been loaded"),TODO |
263 | RSTRG (Rs_perl_ext_1, "perl-ext-common", "string"), //, "colon-separated list of perl extensions to enable"),TODO |
268 | RSTRG (Rs_perl_ext_1, "perl-ext-common", "string"), //, "colon-separated list of perl extensions to enable"),TODO |
… | |
… | |
624 | #ifdef KEYSYM_RESOURCE |
629 | #ifdef KEYSYM_RESOURCE |
625 | static void |
630 | static void |
626 | rxvt_define_key (rxvt_term *term, const char *k, const char *v) |
631 | rxvt_define_key (rxvt_term *term, const char *k, const char *v) |
627 | { |
632 | { |
628 | term->bind_action (k, v); |
633 | term->bind_action (k, v); |
629 | } |
|
|
630 | |
|
|
631 | struct rxvt_enumerate_closure |
|
|
632 | { |
|
|
633 | rxvt_term *term; |
|
|
634 | void (*cb)(rxvt_term *, const char *, const char *); |
|
|
635 | int specific; // iterate over only a specific subhierarchy |
|
|
636 | }; |
|
|
637 | |
|
|
638 | /* |
|
|
639 | * Define key from XrmEnumerateDatabase. |
|
|
640 | * quarks will be something like |
|
|
641 | * "rxvt" "keysym" "0xFF01" |
|
|
642 | * value will be a string |
|
|
643 | */ |
|
|
644 | static int |
|
|
645 | rxvt_enumerate_helper ( |
|
|
646 | XrmDatabase *database ecb_unused, |
|
|
647 | XrmBindingList bindings ecb_unused, |
|
|
648 | XrmQuarkList quarks, |
|
|
649 | XrmRepresentation *type ecb_unused, |
|
|
650 | XrmValue *value, |
|
|
651 | XPointer closure |
|
|
652 | ) |
|
|
653 | { |
|
|
654 | const rxvt_enumerate_closure *data = (const rxvt_enumerate_closure *)closure; |
|
|
655 | |
|
|
656 | if (*quarks == NULLQUARK) return False; |
|
|
657 | |
|
|
658 | // if the quark list starts with a tighly bound quark, we skip it, |
|
|
659 | // as it is the exactly matched the prefix. Otherwise, it matched because |
|
|
660 | // it started with "*", in which case we assuime the prefix is part |
|
|
661 | // of the "*". |
|
|
662 | if (*bindings == XrmBindTightly) |
|
|
663 | { |
|
|
664 | ++quarks, ++bindings; // skip if this is a fixed prefix, rather than a *-match |
|
|
665 | if (*quarks == NULLQUARK) return False; |
|
|
666 | } |
|
|
667 | |
|
|
668 | // specific, a bit misleadingly named, is used when a specific "subclass" |
|
|
669 | // is iterated over, e.g. "keysym", and is used to skip one more |
|
|
670 | // component, as well as all generic prefixes |
|
|
671 | // this is a bit of a hack, ideally, keysym (the only user) should use its |
|
|
672 | // own iteration function, but this ought to be less bloated |
|
|
673 | if (data->specific) |
|
|
674 | { |
|
|
675 | if (*bindings != XrmBindTightly) |
|
|
676 | return False; |
|
|
677 | |
|
|
678 | ++quarks, ++bindings; // skip if this is a fixed prefix, rather than a *-match |
|
|
679 | if (*quarks == NULLQUARK) return False; |
|
|
680 | } |
|
|
681 | |
|
|
682 | char *pattern; |
|
|
683 | if (quarks[1] == NULLQUARK) |
|
|
684 | pattern = XrmQuarkToString (quarks[0]); // single component, fats path |
|
|
685 | else |
|
|
686 | { |
|
|
687 | // multiple components, slow path - should be rare, to don't optimize for speed |
|
|
688 | int size = 0; |
|
|
689 | |
|
|
690 | for (int i = 0; quarks[i] != NULLQUARK; ++i) |
|
|
691 | size += strlen (XrmQuarkToString (quarks[i])) + 1; |
|
|
692 | |
|
|
693 | pattern = rxvt_temp_buf<char> (size + 1); |
|
|
694 | |
|
|
695 | // now print all components |
|
|
696 | { |
|
|
697 | char *cur = pattern; |
|
|
698 | |
|
|
699 | for (int i = 0; quarks[i] != NULLQUARK; ++i) |
|
|
700 | cur += sprintf (cur, ".%s", XrmQuarkToString (quarks[i])); |
|
|
701 | } |
|
|
702 | |
|
|
703 | ++pattern; // skip initial dot |
|
|
704 | } |
|
|
705 | |
|
|
706 | data->cb (data->term, pattern, (char *)value->addr); |
|
|
707 | |
|
|
708 | return False; |
|
|
709 | } |
634 | } |
710 | |
635 | |
711 | /* |
636 | /* |
712 | * look for something like this (XK_Delete) |
637 | * look for something like this (XK_Delete) |
713 | * rxvt*keysym.0xFFFF: "\177" |
638 | * rxvt*keysym.0xFFFF: "\177" |
… | |
… | |
896 | } |
821 | } |
897 | } |
822 | } |
898 | #endif /* NO_RESOURCES */ |
823 | #endif /* NO_RESOURCES */ |
899 | } |
824 | } |
900 | |
825 | |
|
|
826 | struct rxvt_enumerate_closure |
|
|
827 | { |
|
|
828 | rxvt_term *term; |
|
|
829 | void (*cb)(rxvt_term *, const char *, const char *); |
|
|
830 | int specific; // iterate over only a specific subhierarchy |
|
|
831 | }; |
|
|
832 | |
|
|
833 | /* |
|
|
834 | * Define key from XrmEnumerateDatabase. |
|
|
835 | * quarks will be something like |
|
|
836 | * "rxvt" "keysym" "0xFF01" |
|
|
837 | * value will be a string |
|
|
838 | */ |
|
|
839 | static int |
|
|
840 | rxvt_enumerate_helper ( |
|
|
841 | XrmDatabase *database ecb_unused, |
|
|
842 | XrmBindingList bindings ecb_unused, |
|
|
843 | XrmQuarkList quarks, |
|
|
844 | XrmRepresentation *type ecb_unused, |
|
|
845 | XrmValue *value, |
|
|
846 | XPointer closure |
|
|
847 | ) |
|
|
848 | { |
|
|
849 | const rxvt_enumerate_closure *data = (const rxvt_enumerate_closure *)closure; |
|
|
850 | |
|
|
851 | if (*quarks == NULLQUARK) return False; |
|
|
852 | |
|
|
853 | // if the quark list starts with a tightly bound quark, we skip it, |
|
|
854 | // as it exactly matched the prefix. Otherwise, it matched because |
|
|
855 | // it started with "*", in which case we assume the prefix is part |
|
|
856 | // of the "*". |
|
|
857 | if (*bindings == XrmBindTightly) |
|
|
858 | { |
|
|
859 | ++quarks, ++bindings; // skip if this is a fixed prefix, rather than a *-match |
|
|
860 | if (*quarks == NULLQUARK) return False; |
|
|
861 | } |
|
|
862 | |
|
|
863 | // specific, a bit misleadingly named, is used when a specific "subclass" |
|
|
864 | // is iterated over, e.g. "keysym", and is used to skip one more |
|
|
865 | // component, as well as all generic prefixes |
|
|
866 | // this is a bit of a hack, ideally, keysym (the only user) should use its |
|
|
867 | // own iteration function, but this ought to be less bloated |
|
|
868 | if (data->specific) |
|
|
869 | { |
|
|
870 | ++quarks, ++bindings; |
|
|
871 | if (*quarks == NULLQUARK) return False; |
|
|
872 | } |
|
|
873 | |
|
|
874 | char *pattern; |
|
|
875 | if (quarks[1] == NULLQUARK) |
|
|
876 | pattern = XrmQuarkToString (quarks[0]); // single component, fast path |
|
|
877 | else |
|
|
878 | { |
|
|
879 | // multiple components, slow path - should be rare, don't optimize for speed |
|
|
880 | int size = 0; |
|
|
881 | |
|
|
882 | for (int i = 0; quarks[i] != NULLQUARK; ++i) |
|
|
883 | size += strlen (XrmQuarkToString (quarks[i])) + 1; |
|
|
884 | |
|
|
885 | pattern = rxvt_temp_buf<char> (size + 1); |
|
|
886 | |
|
|
887 | // now print all components |
|
|
888 | { |
|
|
889 | char *cur = pattern; |
|
|
890 | |
|
|
891 | for (int i = 0; quarks[i] != NULLQUARK; ++i) |
|
|
892 | cur += sprintf (cur, ".%s", XrmQuarkToString (quarks[i])); |
|
|
893 | } |
|
|
894 | |
|
|
895 | ++pattern; // skip initial dot |
|
|
896 | } |
|
|
897 | |
|
|
898 | data->cb (data->term, pattern, (char *)value->addr); |
|
|
899 | |
|
|
900 | return False; |
|
|
901 | } |
|
|
902 | |
901 | void |
903 | void |
902 | rxvt_term::enumerate_resources (void (*cb)(rxvt_term *, const char *, const char *), const char *name_p, const char *class_p) |
904 | rxvt_term::enumerate_resources (void (*cb)(rxvt_term *, const char *, const char *), const char *name_p, const char *class_p) |
903 | { |
905 | { |
904 | /* |
906 | /* |
905 | * [R5 or later]: enumerate the resource database |
907 | * [R5 or later]: enumerate the resource database |