… | |
… | |
113 | STRG (Rs_scrollBar_thickness, "thickness", "sbt", "number", "scrollbar thickness/width in pixels"), |
113 | STRG (Rs_scrollBar_thickness, "thickness", "sbt", "number", "scrollbar thickness/width in pixels"), |
114 | BOOL (Rs_scrollTtyOutput, "scrollTtyOutput", NULL, Opt_scrollTtyOutput, 0, NULL), |
114 | BOOL (Rs_scrollTtyOutput, "scrollTtyOutput", NULL, Opt_scrollTtyOutput, 0, NULL), |
115 | BOOL (Rs_scrollTtyOutput, NULL, "si", Opt_scrollTtyOutput, Optflag_Reverse, "scroll-on-tty-output inhibit"), |
115 | BOOL (Rs_scrollTtyOutput, NULL, "si", Opt_scrollTtyOutput, Optflag_Reverse, "scroll-on-tty-output inhibit"), |
116 | BOOL (Rs_scrollTtyKeypress, "scrollTtyKeypress", "sk", Opt_scrollTtyKeypress, 0, "scroll-on-keypress"), |
116 | BOOL (Rs_scrollTtyKeypress, "scrollTtyKeypress", "sk", Opt_scrollTtyKeypress, 0, "scroll-on-keypress"), |
117 | BOOL (Rs_scrollWithBuffer, "scrollWithBuffer", "sw", Opt_scrollWithBuffer, 0, "scroll-with-buffer"), |
117 | BOOL (Rs_scrollWithBuffer, "scrollWithBuffer", "sw", Opt_scrollWithBuffer, 0, "scroll-with-buffer"), |
118 | #if BG_IMAGE_FROM_ROOT |
|
|
119 | BOOL (Rs_transparent, "inheritPixmap", "ip", Opt_transparent, 0, "inherit parent pixmap"), |
|
|
120 | BOOL (Rs_transparent, "transparent", "tr", Opt_transparent, 0, "inherit parent pixmap"), |
|
|
121 | STRG (Rs_color + Color_tint, "tintColor", "tint", "color", "tint color"), |
|
|
122 | STRG (Rs_shade, "shading", "sh", "number", "shade background by number %."), |
|
|
123 | STRG (Rs_blurradius, "blurRadius", "blr", "HxV", "gaussian blur radii to apply to the root background"), |
|
|
124 | #endif |
|
|
125 | #if OFF_FOCUS_FADING |
118 | #if OFF_FOCUS_FADING |
126 | STRG (Rs_fade, "fading", "fade", "number", "fade colors by number % when losing focus"), |
119 | STRG (Rs_fade, "fading", "fade", "number", "fade colors by number % when losing focus"), |
127 | STRG (Rs_color + Color_fade, "fadeColor", "fadecolor", "color", "target color for off-focus fading"), |
120 | STRG (Rs_color + Color_fade, "fadeColor", "fadecolor", "color", "target color for off-focus fading"), |
128 | #endif |
121 | #endif |
129 | BOOL (Rs_utmpInhibit, "utmpInhibit", "ut", Opt_utmpInhibit, 0, "utmp inhibit"), |
122 | BOOL (Rs_utmpInhibit, "utmpInhibit", "ut", Opt_utmpInhibit, 0, "utmp inhibit"), |
… | |
… | |
194 | RSTRG (Rs_color + Color_cursor2, "cursorColor2", "color"), |
187 | RSTRG (Rs_color + Color_cursor2, "cursorColor2", "color"), |
195 | #endif /* NO_CURSORCOLOR */ |
188 | #endif /* NO_CURSORCOLOR */ |
196 | STRG (Rs_color + Color_pointer_fg, "pointerColor", "pr", "color", "pointer color"), |
189 | STRG (Rs_color + Color_pointer_fg, "pointerColor", "pr", "color", "pointer color"), |
197 | STRG (Rs_color + Color_pointer_bg, "pointerColor2", "pr2", "color", "pointer bg color"), |
190 | STRG (Rs_color + Color_pointer_bg, "pointerColor2", "pr2", "color", "pointer bg color"), |
198 | STRG (Rs_color + Color_border, "borderColor", "bd", "color", "border color"), |
191 | STRG (Rs_color + Color_border, "borderColor", "bd", "color", "border color"), |
199 | #if BG_IMAGE_FROM_FILE |
|
|
200 | RSTRG (Rs_path, "path", "search path"), |
|
|
201 | STRG (Rs_backgroundPixmap, "backgroundPixmap", "pixmap", "file[;geom]", "background pixmap"), |
|
|
202 | #endif |
|
|
203 | #if ENABLE_EWMH |
192 | #if ENABLE_EWMH |
204 | STRG (Rs_iconfile, "iconFile", "icon", "file", "path to application icon image"), |
193 | STRG (Rs_iconfile, "iconFile", "icon", "file", "path to application icon image"), |
205 | #endif |
194 | #endif |
206 | #ifdef HAVE_XMU |
195 | #ifdef HAVE_XMU |
207 | RSTRG (Rs_pointerShape, "pointerShape", "string"), |
196 | RSTRG (Rs_pointerShape, "pointerShape", "string"), |
… | |
… | |
635 | #ifdef KEYSYM_RESOURCE |
624 | #ifdef KEYSYM_RESOURCE |
636 | static void |
625 | static void |
637 | rxvt_define_key (rxvt_term *term, const char *k, const char *v) |
626 | rxvt_define_key (rxvt_term *term, const char *k, const char *v) |
638 | { |
627 | { |
639 | term->bind_action (k, v); |
628 | term->bind_action (k, v); |
640 | } |
|
|
641 | |
|
|
642 | /* |
|
|
643 | * Define key from XrmEnumerateDatabase. |
|
|
644 | * quarks will be something like |
|
|
645 | * "rxvt" "keysym" "0xFF01" |
|
|
646 | * value will be a string |
|
|
647 | */ |
|
|
648 | static int |
|
|
649 | rxvt_enumerate_helper ( |
|
|
650 | XrmDatabase *database ecb_unused, |
|
|
651 | XrmBindingList bindings ecb_unused, |
|
|
652 | XrmQuarkList quarks, |
|
|
653 | XrmRepresentation *type ecb_unused, |
|
|
654 | XrmValue *value, |
|
|
655 | XPointer closure |
|
|
656 | ) |
|
|
657 | { |
|
|
658 | int last; |
|
|
659 | |
|
|
660 | for (last = 0; quarks[last] != NULLQUARK; last++) /* look for last quark in list */ |
|
|
661 | ; |
|
|
662 | |
|
|
663 | rxvt_term *term = (rxvt_term *)(((void **)closure)[0]); |
|
|
664 | void (*cb)(rxvt_term *, const char *, const char *) |
|
|
665 | = (void (*)(rxvt_term *, const char *, const char *)) |
|
|
666 | (((void **)closure)[1]); |
|
|
667 | |
|
|
668 | cb (term, XrmQuarkToString (quarks[last - 1]), (char *)value->addr); |
|
|
669 | |
|
|
670 | return False; |
|
|
671 | } |
629 | } |
672 | |
630 | |
673 | /* |
631 | /* |
674 | * look for something like this (XK_Delete) |
632 | * look for something like this (XK_Delete) |
675 | * rxvt*keysym.0xFFFF: "\177" |
633 | * rxvt*keysym.0xFFFF: "\177" |
… | |
… | |
858 | } |
816 | } |
859 | } |
817 | } |
860 | #endif /* NO_RESOURCES */ |
818 | #endif /* NO_RESOURCES */ |
861 | } |
819 | } |
862 | |
820 | |
|
|
821 | struct rxvt_enumerate_closure |
|
|
822 | { |
|
|
823 | rxvt_term *term; |
|
|
824 | void (*cb)(rxvt_term *, const char *, const char *); |
|
|
825 | int specific; // iterate over only a specific subhierarchy |
|
|
826 | }; |
|
|
827 | |
|
|
828 | /* |
|
|
829 | * Define key from XrmEnumerateDatabase. |
|
|
830 | * quarks will be something like |
|
|
831 | * "rxvt" "keysym" "0xFF01" |
|
|
832 | * value will be a string |
|
|
833 | */ |
|
|
834 | static int |
|
|
835 | rxvt_enumerate_helper ( |
|
|
836 | XrmDatabase *database ecb_unused, |
|
|
837 | XrmBindingList bindings ecb_unused, |
|
|
838 | XrmQuarkList quarks, |
|
|
839 | XrmRepresentation *type ecb_unused, |
|
|
840 | XrmValue *value, |
|
|
841 | XPointer closure |
|
|
842 | ) |
|
|
843 | { |
|
|
844 | const rxvt_enumerate_closure *data = (const rxvt_enumerate_closure *)closure; |
|
|
845 | |
|
|
846 | if (*quarks == NULLQUARK) return False; |
|
|
847 | |
|
|
848 | // if the quark list starts with a tightly bound quark, we skip it, |
|
|
849 | // as it exactly matched the prefix. Otherwise, it matched because |
|
|
850 | // it started with "*", in which case we assume the prefix is part |
|
|
851 | // of the "*". |
|
|
852 | if (*bindings == XrmBindTightly) |
|
|
853 | { |
|
|
854 | ++quarks, ++bindings; // skip if this is a fixed prefix, rather than a *-match |
|
|
855 | if (*quarks == NULLQUARK) return False; |
|
|
856 | } |
|
|
857 | |
|
|
858 | // specific, a bit misleadingly named, is used when a specific "subclass" |
|
|
859 | // is iterated over, e.g. "keysym", and is used to skip one more |
|
|
860 | // component, as well as all generic prefixes |
|
|
861 | // this is a bit of a hack, ideally, keysym (the only user) should use its |
|
|
862 | // own iteration function, but this ought to be less bloated |
|
|
863 | if (data->specific) |
|
|
864 | { |
|
|
865 | if (*bindings != XrmBindTightly) |
|
|
866 | return False; |
|
|
867 | |
|
|
868 | ++quarks, ++bindings; // skip if this is a fixed prefix, rather than a *-match |
|
|
869 | if (*quarks == NULLQUARK) return False; |
|
|
870 | } |
|
|
871 | |
|
|
872 | char *pattern; |
|
|
873 | if (quarks[1] == NULLQUARK) |
|
|
874 | pattern = XrmQuarkToString (quarks[0]); // single component, fast path |
|
|
875 | else |
|
|
876 | { |
|
|
877 | // multiple components, slow path - should be rare, don't optimize for speed |
|
|
878 | int size = 0; |
|
|
879 | |
|
|
880 | for (int i = 0; quarks[i] != NULLQUARK; ++i) |
|
|
881 | size += strlen (XrmQuarkToString (quarks[i])) + 1; |
|
|
882 | |
|
|
883 | pattern = rxvt_temp_buf<char> (size + 1); |
|
|
884 | |
|
|
885 | // now print all components |
|
|
886 | { |
|
|
887 | char *cur = pattern; |
|
|
888 | |
|
|
889 | for (int i = 0; quarks[i] != NULLQUARK; ++i) |
|
|
890 | cur += sprintf (cur, ".%s", XrmQuarkToString (quarks[i])); |
|
|
891 | } |
|
|
892 | |
|
|
893 | ++pattern; // skip initial dot |
|
|
894 | } |
|
|
895 | |
|
|
896 | data->cb (data->term, pattern, (char *)value->addr); |
|
|
897 | |
|
|
898 | return False; |
|
|
899 | } |
|
|
900 | |
863 | void |
901 | void |
864 | rxvt_term::enumerate_resources (void (*cb)(rxvt_term *, const char *, const char *), const char *name_p, const char *class_p) |
902 | rxvt_term::enumerate_resources (void (*cb)(rxvt_term *, const char *, const char *), const char *name_p, const char *class_p) |
865 | { |
903 | { |
866 | /* |
904 | /* |
867 | * [R5 or later]: enumerate the resource database |
905 | * [R5 or later]: enumerate the resource database |
868 | */ |
906 | */ |
|
|
907 | assert (!name_p == !class_p); // both must be specified, or missing |
|
|
908 | |
869 | #ifdef KEYSYM_RESOURCE |
909 | #ifdef KEYSYM_RESOURCE |
870 | void *closure[2] = { |
910 | rxvt_enumerate_closure closure = { this, cb, name_p ? 1 : 0 }; |
871 | (void *)this, |
|
|
872 | (void *)cb, |
|
|
873 | }; |
|
|
874 | |
911 | |
875 | XrmDatabase database = XrmGetDatabase (dpy); |
912 | XrmDatabase database = XrmGetDatabase (dpy); |
876 | XrmName name_prefix[3]; |
913 | XrmName name_prefix[3]; |
877 | XrmClass class_prefix[3]; |
914 | XrmClass class_prefix[3]; |
878 | |
915 | |
… | |
… | |
881 | class_prefix[1] = class_p ? XrmStringToName (class_p) : NULLQUARK; |
918 | class_prefix[1] = class_p ? XrmStringToName (class_p) : NULLQUARK; |
882 | class_prefix[2] = NULLQUARK; |
919 | class_prefix[2] = NULLQUARK; |
883 | |
920 | |
884 | # ifdef RESFALLBACK |
921 | # ifdef RESFALLBACK |
885 | name_prefix[0] = class_prefix[0] = XrmStringToName (RESFALLBACK); |
922 | name_prefix[0] = class_prefix[0] = XrmStringToName (RESFALLBACK); |
886 | /* XXX: Need to check sizeof (rxvt_t) == sizeof (XPointer) */ |
|
|
887 | XrmEnumerateDatabase (database, name_prefix, class_prefix, |
923 | XrmEnumerateDatabase (database, name_prefix, class_prefix, |
888 | XrmEnumOneLevel, rxvt_enumerate_helper, (XPointer)closure); |
924 | XrmEnumAllLevels, rxvt_enumerate_helper, (XPointer)&closure); |
889 | # endif |
925 | # endif |
890 | |
926 | |
891 | name_prefix[0] = class_prefix[0] = XrmStringToName (RESCLASS); |
927 | name_prefix[0] = class_prefix[0] = XrmStringToName (RESCLASS); |
892 | XrmEnumerateDatabase (database, name_prefix, class_prefix, |
928 | XrmEnumerateDatabase (database, name_prefix, class_prefix, |
893 | XrmEnumOneLevel, rxvt_enumerate_helper, (XPointer)closure); |
929 | XrmEnumAllLevels, rxvt_enumerate_helper, (XPointer)&closure); |
894 | |
930 | |
895 | name_prefix[0] = class_prefix[0] = XrmStringToName (rs[Rs_name]); |
931 | name_prefix[0] = class_prefix[0] = XrmStringToName (rs[Rs_name]); |
896 | XrmEnumerateDatabase (database, name_prefix, class_prefix, |
932 | XrmEnumerateDatabase (database, name_prefix, class_prefix, |
897 | XrmEnumOneLevel, rxvt_enumerate_helper, (XPointer)closure); |
933 | XrmEnumAllLevels, rxvt_enumerate_helper, (XPointer)&closure); |
898 | #endif |
934 | #endif |
899 | } |
935 | } |
900 | |
936 | |
901 | void |
937 | void |
902 | rxvt_term::extract_keysym_resources () |
938 | rxvt_term::extract_keysym_resources () |