… | |
… | |
187 | RSTRG (Rs_color + Color_cursor2, "cursorColor2", "color"), |
187 | RSTRG (Rs_color + Color_cursor2, "cursorColor2", "color"), |
188 | #endif /* NO_CURSORCOLOR */ |
188 | #endif /* NO_CURSORCOLOR */ |
189 | STRG (Rs_color + Color_pointer_fg, "pointerColor", "pr", "color", "pointer color"), |
189 | STRG (Rs_color + Color_pointer_fg, "pointerColor", "pr", "color", "pointer color"), |
190 | 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"), |
191 | STRG (Rs_color + Color_border, "borderColor", "bd", "color", "border color"), |
191 | STRG (Rs_color + Color_border, "borderColor", "bd", "color", "border color"), |
192 | #if defined (XPM_BACKGROUND) || (MENUBAR_MAX) |
192 | #ifdef XPM_BACKGROUND |
193 | RSTRG (Rs_path, "path", "search path"), |
193 | RSTRG (Rs_path, "path", "search path"), |
194 | #endif /* defined (XPM_BACKGROUND) || (MENUBAR_MAX) */ |
|
|
195 | #ifdef XPM_BACKGROUND |
|
|
196 | STRG (Rs_backgroundPixmap, "backgroundPixmap", "pixmap", "file[;geom]", "background pixmap"), |
194 | STRG (Rs_backgroundPixmap, "backgroundPixmap", "pixmap", "file[;geom]", "background pixmap"), |
197 | #endif /* XPM_BACKGROUND */ |
|
|
198 | #if (MENUBAR_MAX) |
|
|
199 | RSTRG (Rs_menu, "menu", "name[;tag]"), |
|
|
200 | #endif |
195 | #endif |
201 | /* fonts: command-line option = resource name */ |
196 | /* fonts: command-line option = resource name */ |
202 | STRG (Rs_font, "font", "fn", "fontname", "normal text font"), |
197 | STRG (Rs_font, "font", "fn", "fontname", "normal text font"), |
203 | #if ENABLE_STYLES |
198 | #if ENABLE_STYLES |
204 | STRG (Rs_boldFont, "boldFont", "fb", "fontname", "bold font"), |
199 | STRG (Rs_boldFont, "boldFont", "fb", "fontname", "bold font"), |
… | |
… | |
325 | #if TINTING |
320 | #if TINTING |
326 | "tint," |
321 | "tint," |
327 | #endif |
322 | #endif |
328 | #if defined(UTMP_SUPPORT) |
323 | #if defined(UTMP_SUPPORT) |
329 | "utmp," |
324 | "utmp," |
330 | #endif |
|
|
331 | #if defined(MENUBAR) |
|
|
332 | "menubar," |
|
|
333 | #endif |
325 | #endif |
334 | #if defined(USE_XIM) |
326 | #if defined(USE_XIM) |
335 | "XIM," |
327 | "XIM," |
336 | #endif |
328 | #endif |
337 | "scrollbars=" |
329 | "scrollbars=" |
… | |
… | |
367 | #if defined(NO_DELETE_KEY) |
359 | #if defined(NO_DELETE_KEY) |
368 | "no_delete," |
360 | "no_delete," |
369 | #endif |
361 | #endif |
370 | #if EIGHT_BIT_CONTROLS |
362 | #if EIGHT_BIT_CONTROLS |
371 | "8bitctrls," |
363 | "8bitctrls," |
372 | #endif |
|
|
373 | #if !defined(NO_STRINGS) |
|
|
374 | "strings," |
|
|
375 | #endif |
364 | #endif |
376 | #if defined(ENABLE_FRILLS) |
365 | #if defined(ENABLE_FRILLS) |
377 | "frills," |
366 | "frills," |
378 | #endif |
367 | #endif |
379 | #if defined(PREFER_24BIT) |
368 | #if defined(PREFER_24BIT) |
… | |
… | |
771 | } |
760 | } |
772 | |
761 | |
773 | # endif /* KEYSYM_RESOURCE */ |
762 | # endif /* KEYSYM_RESOURCE */ |
774 | #endif /* NO_RESOURCES */ |
763 | #endif /* NO_RESOURCES */ |
775 | |
764 | |
|
|
765 | static char * |
776 | char *get_res (XrmDatabase database, const char *program, const char *option) |
766 | get_res (XrmDatabase database, const char *program, const char *option) |
777 | { |
767 | { |
778 | char resource[512]; |
768 | char resource[512]; |
779 | char *type; |
769 | char *type; |
780 | XrmValue result; |
770 | XrmValue result; |
781 | |
771 | |
… | |
… | |
783 | XrmGetResource (database, resource, resource, &type, &result); |
773 | XrmGetResource (database, resource, resource, &type, &result); |
784 | |
774 | |
785 | return result.addr; |
775 | return result.addr; |
786 | } |
776 | } |
787 | |
777 | |
788 | /*{{{ read the resources files */ |
778 | const char * |
789 | /* |
779 | rxvt_term::x_resource (const char *name) |
790 | * using XGetDefault () or the hand-rolled replacement |
780 | { |
791 | */ |
781 | XrmDatabase database = XrmGetDatabase (display->display); |
792 | /* ARGSUSED */ |
782 | |
|
|
783 | const char *p = get_res (database, rs[Rs_name], name); |
|
|
784 | const char *p0 = get_res (database, "!INVALIDPROGRAMMENAMEDONTMATCH!", name); |
|
|
785 | |
|
|
786 | if (p == NULL || (p0 && strcmp (p, p0) == 0)) |
|
|
787 | { |
|
|
788 | p = get_res (database, RESCLASS, name); |
|
|
789 | #ifdef RESFALLBACK |
|
|
790 | if (p == NULL || (p0 && strcmp (p, p0) == 0)) |
|
|
791 | p = get_res (database, RESFALLBACK, name); |
|
|
792 | #endif |
|
|
793 | } |
|
|
794 | |
|
|
795 | if (p == NULL && p0) |
|
|
796 | p = p0; |
|
|
797 | |
|
|
798 | return p; |
|
|
799 | } |
|
|
800 | |
793 | void |
801 | void |
794 | rxvt_term::extract_resources () |
802 | rxvt_term::extract_resources () |
795 | { |
803 | { |
796 | dDisp; |
|
|
797 | |
|
|
798 | #ifndef NO_RESOURCES |
804 | #ifndef NO_RESOURCES |
799 | XrmDatabase database = XrmGetDatabase (display->display); |
|
|
800 | |
|
|
801 | /* |
805 | /* |
802 | * Query resources for options that affect us |
806 | * Query resources for options that affect us |
803 | */ |
807 | */ |
804 | for (int entry = 0; entry < optList_size; entry++) |
808 | for (int entry = 0; entry < optList_size; entry++) |
805 | { |
809 | { |
806 | int s; |
810 | int s; |
807 | char *p, *p0; |
|
|
808 | const char *kw = optList[entry].kw; |
811 | const char *kw = optList[entry].kw; |
809 | |
812 | |
810 | if (kw == NULL || rs[optList[entry].doff] != NULL) |
813 | if (kw == NULL || rs[optList[entry].doff] != NULL) |
811 | continue; // previously set |
814 | continue; // previously set |
812 | |
815 | |
813 | p = get_res (database, rs[Rs_name], kw); |
816 | const char *p = x_resource (kw); |
814 | p0 = get_res (database, "!INVALIDPROGRAMMENAMEDONTMATCH!", kw); |
|
|
815 | if (p == NULL || (p0 && strcmp (p, p0) == 0)) |
|
|
816 | { |
|
|
817 | p = get_res (database, RESCLASS, kw); |
|
|
818 | #ifdef RESFALLBACK |
|
|
819 | if (p == NULL || (p0 && strcmp (p, p0) == 0)) |
|
|
820 | p = get_res (database, RESFALLBACK, kw); |
|
|
821 | #endif |
|
|
822 | } |
|
|
823 | |
|
|
824 | if (p == NULL && p0) |
|
|
825 | p = p0; |
|
|
826 | |
817 | |
827 | if (p) |
818 | if (p) |
828 | { |
819 | { |
829 | p = strdup (p); |
820 | p = strdup (p); |
830 | allocated.push_back (p); |
821 | allocated.push_back ((void *)p); |
831 | rs[optList[entry].doff] = p; |
822 | rs[optList[entry].doff] = p; |
832 | |
823 | |
833 | if (optList_isBool (entry)) |
824 | if (optList_isBool (entry)) |
834 | { |
825 | { |
835 | s = strcasecmp (p, "TRUE") == 0 |
826 | s = strcasecmp (p, "TRUE") == 0 |
… | |
… | |
847 | |
838 | |
848 | /* |
839 | /* |
849 | * [R5 or later]: enumerate the resource database |
840 | * [R5 or later]: enumerate the resource database |
850 | */ |
841 | */ |
851 | # ifdef KEYSYM_RESOURCE |
842 | # ifdef KEYSYM_RESOURCE |
|
|
843 | XrmDatabase database = XrmGetDatabase (display->display); |
852 | XrmName name_prefix[3]; |
844 | XrmName name_prefix[3]; |
853 | XrmClass class_prefix[3]; |
845 | XrmClass class_prefix[3]; |
854 | |
846 | |
855 | name_prefix[0] = XrmStringToName (rs[Rs_name]); |
847 | name_prefix[0] = XrmStringToName (rs[Rs_name]); |
856 | name_prefix[1] = XrmStringToName ("keysym"); |
848 | name_prefix[1] = XrmStringToName ("keysym"); |
… | |
… | |
873 | # endif |
865 | # endif |
874 | |
866 | |
875 | #endif /* NO_RESOURCES */ |
867 | #endif /* NO_RESOURCES */ |
876 | } |
868 | } |
877 | |
869 | |
878 | /*}}} */ |
|
|
879 | /*----------------------- end-of-file (C source) -----------------------*/ |
870 | /*----------------------- end-of-file (C source) -----------------------*/ |