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.13 by pcg, Tue Feb 24 21:41:16 2004 UTC vs.
Revision 1.15 by pcg, Wed Mar 3 04:07:52 2004 UTC

1/*--------------------------------*-C-*---------------------------------* 1/*--------------------------------*-C-*---------------------------------*
2 * File: xdefaults.c 2 * File: xdefaults.c
3 *----------------------------------------------------------------------* 3 *----------------------------------------------------------------------*
4 * $Id: xdefaults.C,v 1.13 2004/02/24 21:41:16 pcg Exp $ 4 * $Id: xdefaults.C,v 1.15 2004/03/03 04:07:52 pcg Exp $
5 * 5 *
6 * All portions of code are copyright by their respective author/s. 6 * All portions of code are copyright by their respective author/s.
7 * Copyright (c) 1994 Robert Nation <nation@rocket.sanders.lockheed.com> 7 * Copyright (c) 1994 Robert Nation <nation@rocket.sanders.lockheed.com>
8 * - original version 8 * - original version
9 * Copyright (c) 1997,1998 mj olesen <olesen@me.queensu.ca> 9 * Copyright (c) 1997,1998 mj olesen <olesen@me.queensu.ca>
130 BOOL (Rs_meta8, "meta8", NULL, Opt_meta8, NULL), 130 BOOL (Rs_meta8, "meta8", NULL, Opt_meta8, NULL),
131#endif 131#endif
132#ifdef MOUSE_WHEEL 132#ifdef MOUSE_WHEEL
133 BOOL (Rs_mouseWheelScrollPage, "mouseWheelScrollPage", NULL, Opt_mouseWheelScrollPage, 133 BOOL (Rs_mouseWheelScrollPage, "mouseWheelScrollPage", NULL, Opt_mouseWheelScrollPage,
134 NULL), 134 NULL),
135#endif
136#ifdef MULTICHAR_SET
137 BOOL (Rs_mc_hack, "multibyte_cursor", "mcc", Opt_mc_hack,
138 "Multibyte character cursor movement"),
139#endif 135#endif
140#ifndef NO_FRILLS 136#ifndef NO_FRILLS
141 BOOL (Rs_tripleclickwords, "tripleclickwords", "tcw", Opt_tripleclickwords, 137 BOOL (Rs_tripleclickwords, "tripleclickwords", "tcw", Opt_tripleclickwords,
142 "triple click word selection"), 138 "triple click word selection"),
143#endif 139#endif
294 "24bit," 290 "24bit,"
295#endif 291#endif
296#if defined(USE_XIM) 292#if defined(USE_XIM)
297 "XIM," 293 "XIM,"
298#endif 294#endif
299#if defined(MULTICHAR_SET)
300 "multichar_languages,"
301#endif
302 "scrollbars=" 295 "scrollbars="
303#if !defined(HAVE_SCROLLBARS) 296#if !defined(HAVE_SCROLLBARS)
304 "NONE" 297 "NONE"
305#else 298#else
299# if defined(PLAIN_SCROLLBAR)
300 "plain"
301# if defined(RXVT_SCROLLBAR) || defined(NEXT_SCROLLBAR) || defined(XTERM_SCROLLBAR)
302 "+"
303# endif
304# endif
306# if defined(RXVT_SCROLLBAR) 305# if defined(RXVT_SCROLLBAR)
307 "rxvt" 306 "rxvt"
308# if defined(NEXT_SCROLLBAR) || defined(XTERM_SCROLLBAR) 307# if defined(NEXT_SCROLLBAR) || defined(XTERM_SCROLLBAR)
309 "+" 308 "+"
310# endif 309# endif
352{ 351{
353 unsigned int i, col; 352 unsigned int i, col;
354 353
355 write (STDERR_FILENO, releasestring, sizeof (releasestring) - 1); 354 write (STDERR_FILENO, releasestring, sizeof (releasestring) - 1);
356 write (STDERR_FILENO, optionsstring, sizeof (optionsstring) - 1); 355 write (STDERR_FILENO, optionsstring, sizeof (optionsstring) - 1);
357 write (STDERR_FILENO, APL_NAME, sizeof (APL_NAME) - 1); 356 write (STDERR_FILENO, RESNAME, sizeof (RESNAME) - 1);
358 357
359 switch (type) 358 switch (type)
360 { 359 {
361 case 0: /* brief listing */ 360 case 0: /* brief listing */
362 fprintf (stderr, " [-help] [--help]\n"); 361 fprintf (stderr, " [-help] [--help]\n");
756 char *localepath = NULL; 755 char *localepath = NULL;
757 756
758 if (locale != NULL) 757 if (locale != NULL)
759 { /* XXX: must limit length of string */ 758 { /* XXX: must limit length of string */
760 localepath = (char *)rxvt_malloc (256); 759 localepath = (char *)rxvt_malloc (256);
761 sprintf (localepath, XAPPLOADDIRLOCALE "/" APL_SUBCLASS, 760 sprintf (localepath, XAPPLOADDIRLOCALE "/" RESCLASS,
762 (int) (258 - sizeof (XAPPLOADDIRLOCALE) - sizeof (APL_SUBCLASS)), 761 (int) (258 - sizeof (XAPPLOADDIRLOCALE) - sizeof (RESCLASS)),
763 locale); /* 258 = 255 + 4 (-.*s) - 1 (/) */ 762 locale); /* 258 = 255 + 4 (-.*s) - 1 (/) */
764 } 763 }
765 764
766 { 765 {
767# endif 766# endif
822 821
823 /* Add in Rxvt file */ 822 /* Add in Rxvt file */
824# if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) 823# if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE)
825 if (localepath == NULL || (rdb1 = XrmGetFileDatabase (localepath)) == NULL) 824 if (localepath == NULL || (rdb1 = XrmGetFileDatabase (localepath)) == NULL)
826# endif 825# endif
827 rdb1 = XrmGetFileDatabase (XAPPLOADDIR "/" APL_SUBCLASS); 826 rdb1 = XrmGetFileDatabase (XAPPLOADDIR "/" RESCLASS);
827
828 if (rdb1 != NULL) 828 if (rdb1 != NULL)
829 XrmMergeDatabases (rdb1, &database); 829 XrmMergeDatabases (rdb1, &database);
830 830
831 /* Add in $XAPPLRESDIR/Rxvt only; not bothering with XUSERFILESEARCHPATH */ 831 /* Add in $XAPPLRESDIR/Rxvt only; not bothering with XUSERFILESEARCHPATH */
832 if ((xe = (char *)getenv ("XAPPLRESDIR")) != NULL) 832 if ((xe = (char *)getenv ("XAPPLRESDIR")) != NULL)
833 { 833 {
834 sprintf (fname, "%-.*s/" APL_SUBCLASS, sizeof (fname) 834 sprintf (fname, "%-.*s/" RESCLASS, sizeof (fname)
835 - sizeof (APL_SUBCLASS) - 2, xe); 835 - sizeof (RESCLASS) - 2, xe);
836 if ((rdb1 = XrmGetFileDatabase (fname)) != NULL) 836 if ((rdb1 = XrmGetFileDatabase (fname)) != NULL)
837 XrmMergeDatabases (rdb1, &database); 837 XrmMergeDatabases (rdb1, &database);
838 } 838 }
839 839
840 XrmSetDatabase (display, database); 840 XrmSetDatabase (display, database);
854 854
855 p = XGetDefault (display, name, kw); 855 p = XGetDefault (display, name, kw);
856 p0 = XGetDefault (display, "!INVALIDPROGRAMMENAMEDONTMATCH!", kw); 856 p0 = XGetDefault (display, "!INVALIDPROGRAMMENAMEDONTMATCH!", kw);
857 if (p == NULL || (p0 && STRCMP (p, p0) == 0)) 857 if (p == NULL || (p0 && STRCMP (p, p0) == 0))
858 { 858 {
859 p = XGetDefault (display, APL_SUBCLASS, kw); 859 p = XGetDefault (display, RESCLASS, kw);
860#ifdef RESFALLBACK
860 if (p == NULL || (p0 && STRCMP (p, p0) == 0)) 861 if (p == NULL || (p0 && STRCMP (p, p0) == 0))
861 p = XGetDefault (display, APL_CLASS, kw); 862 p = XGetDefault (display, RESFALLBACK, kw);
863#endif
862 } 864 }
865
863 if (p == NULL && p0) 866 if (p == NULL && p0)
864 p = p0; 867 p = p0;
868
865 if (p) 869 if (p)
866 { 870 {
867 rs[optList[entry].doff] = p; 871 rs[optList[entry].doff] = p;
868 872
869 if (optList_isBool (entry)) 873 if (optList_isBool (entry))
888# ifdef XrmEnumOneLevel 892# ifdef XrmEnumOneLevel
889# ifdef KEYSYM_RESOURCE 893# ifdef KEYSYM_RESOURCE
890 name_prefix[0] = XrmStringToName (name); 894 name_prefix[0] = XrmStringToName (name);
891 name_prefix[1] = XrmStringToName ("keysym"); 895 name_prefix[1] = XrmStringToName ("keysym");
892 name_prefix[2] = NULLQUARK; 896 name_prefix[2] = NULLQUARK;
893 class_prefix[0] = XrmStringToName (APL_SUBCLASS); 897 class_prefix[0] = XrmStringToName (RESCLASS);
894 class_prefix[1] = XrmStringToName ("Keysym"); 898 class_prefix[1] = XrmStringToName ("Keysym");
895 class_prefix[2] = NULLQUARK; 899 class_prefix[2] = NULLQUARK;
896 /* XXX: Need to check sizeof (rxvt_t) == sizeof (XPointer) */ 900 /* XXX: Need to check sizeof (rxvt_t) == sizeof (XPointer) */
897 XrmEnumerateDatabase (XrmGetDatabase (display), name_prefix, class_prefix, 901 XrmEnumerateDatabase (XrmGetDatabase (display), name_prefix, class_prefix,
898 XrmEnumOneLevel, rxvt_define_key, NULL); 902 XrmEnumOneLevel, rxvt_define_key, NULL);
903# ifdef RESFALLBACK
899 name_prefix[0] = XrmStringToName (APL_CLASS); 904 name_prefix[0] = XrmStringToName (RESFALLBACK);
900 name_prefix[1] = XrmStringToName ("keysym"); 905 name_prefix[1] = XrmStringToName ("keysym");
901 class_prefix[0] = XrmStringToName (APL_CLASS); 906 class_prefix[0] = XrmStringToName (RESFALLBACK);
902 class_prefix[1] = XrmStringToName ("Keysym"); 907 class_prefix[1] = XrmStringToName ("Keysym");
903 /* XXX: Need to check sizeof (rxvt_t) == sizeof (XPointer) */ 908 /* XXX: Need to check sizeof (rxvt_t) == sizeof (XPointer) */
904 XrmEnumerateDatabase (XrmGetDatabase (display), name_prefix, class_prefix, 909 XrmEnumerateDatabase (XrmGetDatabase (display), name_prefix, class_prefix,
905 XrmEnumOneLevel, rxvt_define_key, NULL); 910 XrmEnumOneLevel, rxvt_define_key, NULL);
911# endif
906# endif 912# endif
907# endif 913# endif
908 914
909# else /* USE_XGETDEFAULT */ 915# else /* USE_XGETDEFAULT */
910 /* get resources the hard way, but save lots of memory */ 916 /* get resources the hard way, but save lots of memory */
948 * Also, use a special sub-class so that we can use either or both of 954 * Also, use a special sub-class so that we can use either or both of
949 * "XTerm" and "Rxvt" as class names. 955 * "XTerm" and "Rxvt" as class names.
950 */ 956 */
951 957
952 get_xdefaults (fd, name); 958 get_xdefaults (fd, name);
953 get_xdefaults (fd, APL_SUBCLASS); 959 get_xdefaults (fd, RESCLASS);
960# ifdef RESFALLBACK
961 get_xdefaults (fd, RESFALLBACK);
962# endif
954 963
955# if defined(XAPPLOADDIR) && defined(USE_XAPPLOADDIR) 964# if defined(XAPPLOADDIR) && defined(USE_XAPPLOADDIR)
956 965
957 { 966 {
958 FILE *ad = NULL; 967 FILE *ad = NULL;
959 968
960# if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) 969# if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE)
961 if (localepath == NULL || (ad = fopen (localepath, "r")) == NULL) 970 if (localepath == NULL || (ad = fopen (localepath, "r")) == NULL)
962# endif 971# endif
963 ad = fopen (XAPPLOADDIR "/" APL_SUBCLASS, "r"); 972 ad = fopen (XAPPLOADDIR "/" RESCLASS, "r");
964 if (ad != NULL) 973 if (ad != NULL)
965 { 974 {
966 get_xdefaults (ad, APL_SUBCLASS); 975 get_xdefaults (ad, RESCLASS);
967 get_xdefaults (ad, ""); 976 get_xdefaults (ad, "");
968 fclose (ad); 977 fclose (ad);
969 } 978 }
970 } 979 }
971# endif /* XAPPLOADDIR */ 980# endif /* XAPPLOADDIR */
972 981
973 get_xdefaults (fd, APL_CLASS);
974 get_xdefaults (fd, ""); /* partial match */ 982 get_xdefaults (fd, ""); /* partial match */
975 if (fd != NULL) 983 if (fd != NULL)
976 fclose (fd); 984 fclose (fd);
977# endif /* USE_XGETDEFAULT */ 985# endif /* USE_XGETDEFAULT */
978 986

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines