ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/xdefaults.C
(Generate patch)

Comparing rxvt-unicode/src/xdefaults.C (file contents):
Revision 1.77 by root, Wed Jan 11 00:59:58 2006 UTC vs.
Revision 1.79 by root, Mon Jan 16 09:28:17 2006 UTC

367#if defined(NO_DELETE_KEY) 367#if defined(NO_DELETE_KEY)
368 "no_delete," 368 "no_delete,"
369#endif 369#endif
370#if EIGHT_BIT_CONTROLS 370#if EIGHT_BIT_CONTROLS
371 "8bitctrls," 371 "8bitctrls,"
372#endif
373#if !defined(NO_STRINGS)
374 "strings,"
375#endif 372#endif
376#if defined(ENABLE_FRILLS) 373#if defined(ENABLE_FRILLS)
377 "frills," 374 "frills,"
378#endif 375#endif
379#if defined(PREFER_24BIT) 376#if defined(PREFER_24BIT)
771} 768}
772 769
773# endif /* KEYSYM_RESOURCE */ 770# endif /* KEYSYM_RESOURCE */
774#endif /* NO_RESOURCES */ 771#endif /* NO_RESOURCES */
775 772
773static char *
776char *get_res (XrmDatabase database, const char *program, const char *option) 774get_res (XrmDatabase database, const char *program, const char *option)
777{ 775{
778 char resource[512]; 776 char resource[512];
779 char *type; 777 char *type;
780 XrmValue result; 778 XrmValue result;
781 779
783 XrmGetResource (database, resource, resource, &type, &result); 781 XrmGetResource (database, resource, resource, &type, &result);
784 782
785 return result.addr; 783 return result.addr;
786} 784}
787 785
788/*{{{ read the resources files */ 786const char *
789/* 787rxvt_term::x_resource (const char *name)
790 * using XGetDefault () or the hand-rolled replacement 788{
791 */ 789 XrmDatabase database = XrmGetDatabase (display->display);
792/* ARGSUSED */ 790
791 const char *p = get_res (database, rs[Rs_name], name);
792 const char *p0 = get_res (database, "!INVALIDPROGRAMMENAMEDONTMATCH!", name);
793
794 if (p == NULL || (p0 && strcmp (p, p0) == 0))
795 {
796 p = get_res (database, RESCLASS, name);
797#ifdef RESFALLBACK
798 if (p == NULL || (p0 && strcmp (p, p0) == 0))
799 p = get_res (database, RESFALLBACK, name);
800#endif
801 }
802
803 if (p == NULL && p0)
804 p = p0;
805
806 return p;
807}
808
793void 809void
794rxvt_term::extract_resources () 810rxvt_term::extract_resources ()
795{ 811{
796 dDisp;
797
798#ifndef NO_RESOURCES 812#ifndef NO_RESOURCES
799 XrmDatabase database = XrmGetDatabase (display->display);
800
801 /* 813 /*
802 * Query resources for options that affect us 814 * Query resources for options that affect us
803 */ 815 */
804 for (int entry = 0; entry < optList_size; entry++) 816 for (int entry = 0; entry < optList_size; entry++)
805 { 817 {
806 int s; 818 int s;
807 char *p, *p0;
808 const char *kw = optList[entry].kw; 819 const char *kw = optList[entry].kw;
809 820
810 if (kw == NULL || rs[optList[entry].doff] != NULL) 821 if (kw == NULL || rs[optList[entry].doff] != NULL)
811 continue; // previously set 822 continue; // previously set
812 823
813 p = get_res (database, rs[Rs_name], kw); 824 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 825
827 if (p) 826 if (p)
828 { 827 {
829 p = strdup (p); 828 p = strdup (p);
830 allocated.push_back (p); 829 allocated.push_back ((void *)p);
831 rs[optList[entry].doff] = p; 830 rs[optList[entry].doff] = p;
832 831
833 if (optList_isBool (entry)) 832 if (optList_isBool (entry))
834 { 833 {
835 s = strcasecmp (p, "TRUE") == 0 834 s = strcasecmp (p, "TRUE") == 0
847 846
848 /* 847 /*
849 * [R5 or later]: enumerate the resource database 848 * [R5 or later]: enumerate the resource database
850 */ 849 */
851# ifdef KEYSYM_RESOURCE 850# ifdef KEYSYM_RESOURCE
851 XrmDatabase database = XrmGetDatabase (display->display);
852 XrmName name_prefix[3]; 852 XrmName name_prefix[3];
853 XrmClass class_prefix[3]; 853 XrmClass class_prefix[3];
854 854
855 name_prefix[0] = XrmStringToName (rs[Rs_name]); 855 name_prefix[0] = XrmStringToName (rs[Rs_name]);
856 name_prefix[1] = XrmStringToName ("keysym"); 856 name_prefix[1] = XrmStringToName ("keysym");
873# endif 873# endif
874 874
875#endif /* NO_RESOURCES */ 875#endif /* NO_RESOURCES */
876} 876}
877 877
878/*}}} */
879/*----------------------- end-of-file (C source) -----------------------*/ 878/*----------------------- end-of-file (C source) -----------------------*/

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines