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.19 by pcg, Mon Mar 22 15:15:04 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.19 2004/03/22 15:15:04 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
244 RSTRG (Rs_scrollBar_align, "scrollBar_align", "mode"), 240 RSTRG (Rs_scrollBar_align, "scrollBar_align", "mode"),
245#endif 241#endif
246#ifdef PRINTPIPE 242#ifdef PRINTPIPE
247 RSTRG (Rs_print_pipe, "print-pipe", "string"), 243 RSTRG (Rs_print_pipe, "print-pipe", "string"),
248#endif 244#endif
249#if defined (HOTKEY_CTRL) || defined (HOTKEY_META)
250 RSTRG (Rs_bigfont_key, "bigfont_key", "keysym"),
251 RSTRG (Rs_smallfont_key, "smallfont_key", "keysym"),
252#endif
253 STRG (Rs_modifier, "modifier", "mod", "modifier", 245 STRG (Rs_modifier, "modifier", "mod", "modifier",
254 "meta modifier = alt|meta|hyper|super|mod1|...|mod5"), 246 "meta modifier = alt|meta|hyper|super|mod1|...|mod5"),
255 INFO ("xrm", "string", "X resource"), 247 INFO ("xrm", "string", "X resource"),
256#ifdef CUTCHAR_RESOURCE 248#ifdef CUTCHAR_RESOURCE
257 RSTRG (Rs_cutchars, "cutchars", "string"), 249 RSTRG (Rs_cutchars, "cutchars", "string"),
258#endif /* CUTCHAR_RESOURCE */ 250#endif /* CUTCHAR_RESOURCE */
259#ifdef ACS_ASCII
260 RSTRG (Rs_acs_chars, "acsChars", "string"),
261#endif /* ACS_ASCII */
262 RSTRG (Rs_answerbackstring, "answerbackString", "string"), 251 RSTRG (Rs_answerbackstring, "answerbackString", "string"),
263 INFO ("e", "command arg ...", "command to execute") 252 INFO ("e", "command arg ...", "command to execute")
264 }; 253 };
265 254
266#undef INFO 255#undef INFO
294 "24bit," 283 "24bit,"
295#endif 284#endif
296#if defined(USE_XIM) 285#if defined(USE_XIM)
297 "XIM," 286 "XIM,"
298#endif 287#endif
299#if defined(MULTICHAR_SET)
300 "multichar_languages,"
301#endif
302 "scrollbars=" 288 "scrollbars="
303#if !defined(HAVE_SCROLLBARS) 289#if !defined(HAVE_SCROLLBARS)
304 "NONE" 290 "NONE"
305#else 291#else
292# if defined(PLAIN_SCROLLBAR)
293 "plain"
294# if defined(RXVT_SCROLLBAR) || defined(NEXT_SCROLLBAR) || defined(XTERM_SCROLLBAR)
295 "+"
296# endif
297# endif
306# if defined(RXVT_SCROLLBAR) 298# if defined(RXVT_SCROLLBAR)
307 "rxvt" 299 "rxvt"
308# if defined(NEXT_SCROLLBAR) || defined(XTERM_SCROLLBAR) 300# if defined(NEXT_SCROLLBAR) || defined(XTERM_SCROLLBAR)
309 "+" 301 "+"
310# endif 302# endif
348/*{{{ usage: */ 340/*{{{ usage: */
349/*----------------------------------------------------------------------*/ 341/*----------------------------------------------------------------------*/
350static void 342static void
351rxvt_usage (int type) 343rxvt_usage (int type)
352{ 344{
353 unsigned int i, col; 345 unsigned int i, col;
354 346
355 write (STDERR_FILENO, releasestring, sizeof (releasestring) - 1); 347 rxvt_log ("%s%s%s", releasestring, optionsstring, RESNAME);
356 write (STDERR_FILENO, optionsstring, sizeof (optionsstring) - 1);
357 write (STDERR_FILENO, APL_NAME, sizeof (APL_NAME) - 1);
358 348
359 switch (type) 349 switch (type)
360 { 350 {
361 case 0: /* brief listing */ 351 case 0: /* brief listing */
362 fprintf (stderr, " [-help] [--help]\n"); 352 rxvt_log (" [-help] [--help]\n");
353
363 for (col = 1, i = 0; i < optList_size (); i++) 354 for (col = 1, i = 0; i < optList_size (); i++)
364 if (optList[i].desc != NULL) 355 if (optList[i].desc != NULL)
365 { 356 {
366 int len = 0; 357 int len = 0;
367 358
376#endif 367#endif
377 len += 4 + STRLEN (optList[i].opt) + (optList_isBool (i) ? 2: 0); 368 len += 4 + STRLEN (optList[i].opt) + (optList_isBool (i) ? 2: 0);
378 col += len; 369 col += len;
379 if (col > 79) 370 if (col > 79)
380 { /* assume regular width */ 371 { /* assume regular width */
381 putc ('\n', stderr); 372 rxvt_log ("\n");
382 col = 1 + len; 373 col = 1 + len;
383 } 374 }
375
384 fprintf (stderr, " [-%s%s", (optList_isBool (i) ? "/+" : ""), 376 rxvt_log (" [-%s%s", (optList_isBool (i) ? "/+" : ""), optList[i].opt);
385 optList[i].opt);
386 if (optList_strlen (i)) 377 if (optList_strlen (i))
387 fprintf (stderr, " %s]", optList[i].arg); 378 rxvt_log (" %s]", optList[i].arg);
388 else 379 else
389 fprintf (stderr, "]"); 380 rxvt_log ("]");
390 } 381 }
391 break; 382 break;
392 383
393 case 1: /* full command-line listing */ 384 case 1: /* full command-line listing */
394 fprintf (stderr, " [options] [-e command args]\n\n" 385 rxvt_log (" [options] [-e command args]\n\nwhere options include:\n");
395 "where options include:\n"); 386
396 for (i = 0; i < optList_size (); i++) 387 for (i = 0; i < optList_size (); i++)
397 if (optList[i].desc != NULL) 388 if (optList[i].desc != NULL)
398 { 389 {
399#ifdef DEBUG_STRICT 390#ifdef DEBUG_STRICT
400 assert (optList[i].opt != NULL); 391 assert (optList[i].opt != NULL);
401#endif 392#endif
402 fprintf (stderr, " %s%s %-*s%s%s\n", 393 rxvt_log (" %s%s %-*s%s%s\n",
403 (optList_isBool (i) ? "-/+" : "-"), optList[i].opt, 394 (optList_isBool (i) ? "-/+" : "-"), optList[i].opt,
404 (INDENT - STRLEN (optList[i].opt) 395 (INDENT - STRLEN (optList[i].opt)
405 + (optList_isBool (i) ? 0 : 2)), 396 + (optList_isBool (i) ? 0 : 2)),
406 (optList[i].arg ? optList[i].arg : ""), 397 (optList[i].arg ? optList[i].arg : ""),
407 (optList_isBool (i) ? "turn on/off " : ""), 398 (optList_isBool (i) ? "turn on/off " : ""),
408 optList[i].desc); 399 optList[i].desc);
409 } 400 }
410 fprintf (stderr, "\n --help to list long-options"); 401 rxvt_log ("\n --help to list long-options");
411 break; 402 break;
412 403
413 case 2: /* full resource listing */ 404 case 2: /* full resource listing */
414 fprintf (stderr,
415 " [options] [-e command args]\n\n" 405 rxvt_log (" [options] [-e command args]\n\n"
416 "where resources (long-options) include:\n"); 406 "where resources (long-options) include:\n");
417 407
418 for (i = 0; i < optList_size (); i++) 408 for (i = 0; i < optList_size (); i++)
419 if (optList[i].kw != NULL) 409 if (optList[i].kw != NULL)
420 fprintf (stderr, " %s: %*s%s\n", 410 rxvt_log (" %s: %*s%s\n",
421 optList[i].kw, 411 optList[i].kw,
422 (INDENT - STRLEN (optList[i].kw)), "", /* XXX */ 412 (INDENT - STRLEN (optList[i].kw)), "", /* XXX */
423 (optList_isBool (i) ? "boolean" : optList[i].arg)); 413 (optList_isBool (i) ? "boolean" : optList[i].arg));
424#ifdef KEYSYM_RESOURCE 414#ifdef KEYSYM_RESOURCE
425 fprintf (stderr, " " "keysym.sym" ": %*s%s\n", 415 rxvt_log (" " "keysym.sym" ": %*s%s\n",
426 (INDENT - sizeof ("keysym.sym") + 1), "", /* XXX */ 416 (INDENT - sizeof ("keysym.sym") + 1), "", /* XXX */
427 "keysym"); 417 "keysym");
428#endif 418#endif
429 fprintf (stderr, "\n -help to list options"); 419 rxvt_log ("\n -help to list options");
430 break; 420 break;
431 } 421 }
432 fprintf (stderr, "\n\n"); 422
433 exit (EXIT_FAILURE); 423 rxvt_log ("\n\n");
424 rxvt_exit_failure ();
434 /* NOTREACHED */ 425 /* NOTREACHED */
435} 426}
436 427
437/*}}} */ 428/*}}} */
438 429
465 longopt = *opt++; /* long option */ 456 longopt = *opt++; /* long option */
466 } 457 }
467 else 458 else
468 { 459 {
469 bad_option = 1; 460 bad_option = 1;
470 rxvt_print_error ("bad option \"%s\"", opt); 461 rxvt_warn ("\"%s\": malformed option.\n", opt);
471 continue; 462 continue;
472 } 463 }
473 464
474 if (!STRCMP (opt, "help")) 465 if (!STRCMP (opt, "help"))
475 rxvt_usage (longopt ? 2 : 1); 466 rxvt_usage (longopt ? 2 : 1);
532 else 523 else
533#ifdef KEYSYM_RESOURCE 524#ifdef KEYSYM_RESOURCE
534 /* if (!STRNCMP (opt, "keysym.", sizeof ("keysym.") - 1)) */ 525 /* if (!STRNCMP (opt, "keysym.", sizeof ("keysym.") - 1)) */
535 if (rxvt_Str_match (opt, "keysym.")) 526 if (rxvt_Str_match (opt, "keysym."))
536 { 527 {
537 const char *str = argv[++i]; 528 const char *str = argv[++i];
538 529
539 if (str != NULL) 530 if (str != NULL)
540 parse_keysym (opt + sizeof ("keysym.") - 1, str); 531 parse_keysym (opt + sizeof ("keysym.") - 1, str);
541 } 532 }
542 else 533 else
543#endif 534#endif
535 {
544 bad_option = 1; 536 bad_option = 1;
537 rxvt_warn ("\"%s\": unknown or malformed option.\n", opt);
538 }
545 } 539 }
546 540
547 if (bad_option) 541 if (bad_option)
548 rxvt_usage (0); 542 rxvt_usage (0);
549} 543}
671 * the matching algorithm used for memory-save fake resources 665 * the matching algorithm used for memory-save fake resources
672 */ 666 */
673void 667void
674rxvt_term::get_xdefaults (FILE *stream, const char *name) 668rxvt_term::get_xdefaults (FILE *stream, const char *name)
675{ 669{
676 unsigned int len; 670 unsigned int len;
677 char *str, buffer[256]; 671 char *str, buffer[256];
678 672
679 if (stream == NULL) 673 if (stream == NULL)
680 return; 674 return;
675
681 len = STRLEN (name); 676 len = STRLEN (name);
682 while ((str = fgets (buffer, sizeof (buffer), stream)) != NULL) 677 while ((str = fgets (buffer, sizeof (buffer), stream)) != NULL)
683 { 678 {
684 unsigned int entry, n; 679 unsigned int entry, n;
685 680
694# ifdef KEYSYM_RESOURCE 689# ifdef KEYSYM_RESOURCE
695 if (!parse_keysym (str, NULL)) 690 if (!parse_keysym (str, NULL))
696# endif /* KEYSYM_RESOURCE */ 691# endif /* KEYSYM_RESOURCE */
697 for (entry = 0; entry < optList_size (); entry++) 692 for (entry = 0; entry < optList_size (); entry++)
698 { 693 {
699 const char *kw = optList[entry].kw; 694 const char *kw = optList[entry].kw;
700 695
701 if (kw == NULL) 696 if (kw == NULL)
702 continue; 697 continue;
698
703 n = STRLEN (kw); 699 n = STRLEN (kw);
704 if (str[n] == ':' && rxvt_Str_match (str, kw)) 700 if (str[n] == ':' && rxvt_Str_match (str, kw))
705 { 701 {
706 /* skip `keyword:' */ 702 /* skip `keyword:' */
707 str += (n + 1); 703 str += n + 1;
708 rxvt_Str_trim (str); 704 rxvt_Str_trim (str);
709 n = STRLEN (str); 705 n = STRLEN (str);
710 if (n && rs[optList[entry].doff] == NULL) 706 if (n && rs[optList[entry].doff] == NULL)
711 { 707 {
712 /* not already set */ 708 /* not already set */
713 int s; 709 int s;
714 char *p = (char *)rxvt_malloc ((n + 1) * sizeof (char)); 710 char *p = 0;
715 711
712 for (int o = 0;;)
713 {
714 p = (char *)rxvt_realloc (p, o + n + 1);
716 STRCPY (p, str); 715 MEMCPY (p + o, str, n);
716 o += n;
717 p[o] = 0;
718
719 if (o == 0 || p[o - 1] != '\\') // continuation line
720 break;
721
722 o--; // eat "\"
723
724 if ((str = fgets (buffer, sizeof (buffer), stream)) == NULL)
725 break;
726
727 rxvt_Str_trim (str);
728 n = STRLEN (str);
729 }
730
717 rs[optList[entry].doff] = p; 731 rs[optList[entry].doff] = p;
732 allocated.push_back (p);
733
718 if (optList_isBool (entry)) 734 if (optList_isBool (entry))
719 { 735 {
720 s = STRCASECMP (str, "TRUE") == 0 736 s = STRCASECMP (str, "TRUE") == 0
721 || STRCASECMP (str, "YES") == 0 737 || STRCASECMP (str, "YES") == 0
722 || STRCASECMP (str, "ON") == 0 738 || STRCASECMP (str, "ON") == 0
723 || STRCASECMP (str, "1") == 0; 739 || STRCASECMP (str, "1") == 0;
740
724 if (optList_isReverse (entry)) 741 if (optList_isReverse (entry))
725 s = !s; 742 s = !s;
743
726 if (s) 744 if (s)
727 Options |= (optList[entry].flag); 745 Options |= optList[entry].flag;
728 else 746 else
729 Options &= ~ (optList[entry].flag); 747 Options &= ~optList[entry].flag;
730 } 748 }
731 } 749 }
750
732 break; 751 break;
733 } 752 }
734 } 753 }
735 } 754 }
755
736 rewind (stream); 756 rewind (stream);
737} 757}
738 758
739/*}}} */ 759/*}}} */
740# endif /* ! USE_XGETDEFAULT */ 760# endif /* ! USE_XGETDEFAULT */
751#ifndef NO_RESOURCES 771#ifndef NO_RESOURCES
752 772
753# if defined XAPPLOADDIR 773# if defined XAPPLOADDIR
754# if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) 774# if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE)
755 /* Compute the path of the possibly available localized Rxvt file */ 775 /* Compute the path of the possibly available localized Rxvt file */
756 char *localepath = NULL; 776 char *localepath = NULL;
757 777
758 if (locale != NULL) 778 if (locale != NULL)
759 { /* XXX: must limit length of string */ 779 { /* XXX: must limit length of string */
760 localepath = (char *)rxvt_malloc (256); 780 localepath = (char *)rxvt_malloc (256);
761 sprintf (localepath, XAPPLOADDIRLOCALE "/" APL_SUBCLASS, 781 sprintf (localepath, XAPPLOADDIRLOCALE "/" RESCLASS,
762 (int) (258 - sizeof (XAPPLOADDIRLOCALE) - sizeof (APL_SUBCLASS)), 782 (int) (258 - sizeof (XAPPLOADDIRLOCALE) - sizeof (RESCLASS)),
763 locale); /* 258 = 255 + 4 (-.*s) - 1 (/) */ 783 locale); /* 258 = 255 + 4 (-.*s) - 1 (/) */
764 } 784 }
765 785
766 { 786 {
767# endif 787# endif
769 789
770# ifdef USE_XGETDEFAULT 790# ifdef USE_XGETDEFAULT
771 /* 791 /*
772 * get resources using the X library function 792 * get resources using the X library function
773 */ 793 */
774 int entry; 794 int entry;
775 795
776# ifdef XrmEnumOneLevel 796# ifdef XrmEnumOneLevel
777 int i; 797 int i;
778 char *displayResource, *xe; 798 char *displayResource, *xe;
779 XrmName name_prefix[3]; 799 XrmName name_prefix[3];
780 XrmClass class_prefix[3]; 800 XrmClass class_prefix[3];
781 XrmDatabase database, rdb1; 801 XrmDatabase database, rdb1;
782 char fname[1024]; 802 char fname[1024];
783 803
784 XrmInitialize (); 804 XrmInitialize ();
785 database = NULL; 805 database = NULL;
786 806
787 /* Get any Xserver defaults */ 807 /* Get any Xserver defaults */
800 820
801 for (i = 0; i < (sizeof (xnames) / sizeof (xnames[0])); i++) 821 for (i = 0; i < (sizeof (xnames) / sizeof (xnames[0])); i++)
802 { 822 {
803 sprintf (fname, "%-.*s/%s", sizeof (fname) - STRLEN (xnames[i]) - 2, 823 sprintf (fname, "%-.*s/%s", sizeof (fname) - STRLEN (xnames[i]) - 2,
804 ptr, xnames[i]); 824 ptr, xnames[i]);
805 if ((rdb1 = XrmGetFileDatabase (fname)) != NULL) 825 if ((rdb1 = XrmGetFileDatabase (fname)))
806 { 826 {
807 XrmMergeDatabases (rdb1, &database); 827 XrmMergeDatabases (rdb1, &database);
808# ifndef HAVE_BOTH_XRESOURCE_FILES 828# ifndef HAVE_BOTH_XRESOURCE_FILES
809 break; 829 break;
810# endif 830# endif
822 842
823 /* Add in Rxvt file */ 843 /* Add in Rxvt file */
824# if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) 844# if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE)
825 if (localepath == NULL || (rdb1 = XrmGetFileDatabase (localepath)) == NULL) 845 if (localepath == NULL || (rdb1 = XrmGetFileDatabase (localepath)) == NULL)
826# endif 846# endif
827 rdb1 = XrmGetFileDatabase (XAPPLOADDIR "/" APL_SUBCLASS); 847 rdb1 = XrmGetFileDatabase (XAPPLOADDIR "/" RESCLASS);
848
828 if (rdb1 != NULL) 849 if (rdb1 != NULL)
829 XrmMergeDatabases (rdb1, &database); 850 XrmMergeDatabases (rdb1, &database);
830 851
831 /* Add in $XAPPLRESDIR/Rxvt only; not bothering with XUSERFILESEARCHPATH */ 852 /* Add in $XAPPLRESDIR/Rxvt only; not bothering with XUSERFILESEARCHPATH */
832 if ((xe = (char *)getenv ("XAPPLRESDIR")) != NULL) 853 if ((xe = (char *)getenv ("XAPPLRESDIR")) != NULL)
833 { 854 {
834 sprintf (fname, "%-.*s/" APL_SUBCLASS, sizeof (fname) 855 sprintf (fname, "%-.*s/" RESCLASS, sizeof (fname)
835 - sizeof (APL_SUBCLASS) - 2, xe); 856 - sizeof (RESCLASS) - 2, xe);
836 if ((rdb1 = XrmGetFileDatabase (fname)) != NULL) 857 if ((rdb1 = XrmGetFileDatabase (fname)) != NULL)
837 XrmMergeDatabases (rdb1, &database); 858 XrmMergeDatabases (rdb1, &database);
838 } 859 }
839 860
840 XrmSetDatabase (display, database); 861 XrmSetDatabase (display, database);
854 875
855 p = XGetDefault (display, name, kw); 876 p = XGetDefault (display, name, kw);
856 p0 = XGetDefault (display, "!INVALIDPROGRAMMENAMEDONTMATCH!", kw); 877 p0 = XGetDefault (display, "!INVALIDPROGRAMMENAMEDONTMATCH!", kw);
857 if (p == NULL || (p0 && STRCMP (p, p0) == 0)) 878 if (p == NULL || (p0 && STRCMP (p, p0) == 0))
858 { 879 {
859 p = XGetDefault (display, APL_SUBCLASS, kw); 880 p = XGetDefault (display, RESCLASS, kw);
881#ifdef RESFALLBACK
860 if (p == NULL || (p0 && STRCMP (p, p0) == 0)) 882 if (p == NULL || (p0 && STRCMP (p, p0) == 0))
861 p = XGetDefault (display, APL_CLASS, kw); 883 p = XGetDefault (display, RESFALLBACK, kw);
884#endif
862 } 885 }
886
863 if (p == NULL && p0) 887 if (p == NULL && p0)
864 p = p0; 888 p = p0;
889
865 if (p) 890 if (p)
866 { 891 {
867 rs[optList[entry].doff] = p; 892 rs[optList[entry].doff] = p;
868 893
869 if (optList_isBool (entry)) 894 if (optList_isBool (entry))
888# ifdef XrmEnumOneLevel 913# ifdef XrmEnumOneLevel
889# ifdef KEYSYM_RESOURCE 914# ifdef KEYSYM_RESOURCE
890 name_prefix[0] = XrmStringToName (name); 915 name_prefix[0] = XrmStringToName (name);
891 name_prefix[1] = XrmStringToName ("keysym"); 916 name_prefix[1] = XrmStringToName ("keysym");
892 name_prefix[2] = NULLQUARK; 917 name_prefix[2] = NULLQUARK;
893 class_prefix[0] = XrmStringToName (APL_SUBCLASS); 918 class_prefix[0] = XrmStringToName (RESCLASS);
894 class_prefix[1] = XrmStringToName ("Keysym"); 919 class_prefix[1] = XrmStringToName ("Keysym");
895 class_prefix[2] = NULLQUARK; 920 class_prefix[2] = NULLQUARK;
896 /* XXX: Need to check sizeof (rxvt_t) == sizeof (XPointer) */ 921 /* XXX: Need to check sizeof (rxvt_t) == sizeof (XPointer) */
897 XrmEnumerateDatabase (XrmGetDatabase (display), name_prefix, class_prefix, 922 XrmEnumerateDatabase (XrmGetDatabase (display), name_prefix, class_prefix,
898 XrmEnumOneLevel, rxvt_define_key, NULL); 923 XrmEnumOneLevel, rxvt_define_key, NULL);
924# ifdef RESFALLBACK
899 name_prefix[0] = XrmStringToName (APL_CLASS); 925 name_prefix[0] = XrmStringToName (RESFALLBACK);
900 name_prefix[1] = XrmStringToName ("keysym"); 926 name_prefix[1] = XrmStringToName ("keysym");
901 class_prefix[0] = XrmStringToName (APL_CLASS); 927 class_prefix[0] = XrmStringToName (RESFALLBACK);
902 class_prefix[1] = XrmStringToName ("Keysym"); 928 class_prefix[1] = XrmStringToName ("Keysym");
903 /* XXX: Need to check sizeof (rxvt_t) == sizeof (XPointer) */ 929 /* XXX: Need to check sizeof (rxvt_t) == sizeof (XPointer) */
904 XrmEnumerateDatabase (XrmGetDatabase (display), name_prefix, class_prefix, 930 XrmEnumerateDatabase (XrmGetDatabase (display), name_prefix, class_prefix,
905 XrmEnumOneLevel, rxvt_define_key, NULL); 931 XrmEnumOneLevel, rxvt_define_key, NULL);
932# endif
906# endif 933# endif
907# endif 934# endif
908 935
909# else /* USE_XGETDEFAULT */ 936# else /* USE_XGETDEFAULT */
910 /* get resources the hard way, but save lots of memory */ 937 /* 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 975 * Also, use a special sub-class so that we can use either or both of
949 * "XTerm" and "Rxvt" as class names. 976 * "XTerm" and "Rxvt" as class names.
950 */ 977 */
951 978
952 get_xdefaults (fd, name); 979 get_xdefaults (fd, name);
953 get_xdefaults (fd, APL_SUBCLASS); 980 get_xdefaults (fd, RESCLASS);
981# ifdef RESFALLBACK
982 get_xdefaults (fd, RESFALLBACK);
983# endif
954 984
955# if defined(XAPPLOADDIR) && defined(USE_XAPPLOADDIR) 985# if defined(XAPPLOADDIR) && defined(USE_XAPPLOADDIR)
956
957 { 986 {
958 FILE *ad = NULL; 987 FILE *ad = NULL;
959 988
960# if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) 989# if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE)
961 if (localepath == NULL || (ad = fopen (localepath, "r")) == NULL) 990 if (localepath == NULL || (ad = fopen (localepath, "r")) == NULL)
962# endif 991# endif
963 ad = fopen (XAPPLOADDIR "/" APL_SUBCLASS, "r"); 992 ad = fopen (XAPPLOADDIR "/" RESCLASS, "r");
964 if (ad != NULL) 993 if (ad != NULL)
965 { 994 {
966 get_xdefaults (ad, APL_SUBCLASS); 995 get_xdefaults (ad, RESCLASS);
967 get_xdefaults (ad, ""); 996 get_xdefaults (ad, "");
968 fclose (ad); 997 fclose (ad);
969 } 998 }
970 } 999 }
971# endif /* XAPPLOADDIR */ 1000# endif /* XAPPLOADDIR */
972 1001
973 get_xdefaults (fd, APL_CLASS);
974 get_xdefaults (fd, ""); /* partial match */ 1002 get_xdefaults (fd, ""); /* partial match */
975 if (fd != NULL) 1003 if (fd != NULL)
976 fclose (fd); 1004 fclose (fd);
977# endif /* USE_XGETDEFAULT */ 1005# endif /* USE_XGETDEFAULT */
978 1006
985 free (localepath); 1013 free (localepath);
986# endif 1014# endif
987# endif 1015# endif
988 1016
989#endif /* NO_RESOURCES */ 1017#endif /* NO_RESOURCES */
990
991 /*
992 * even without resources, at least do this setup for command-line
993 * options and command-line long options
994 */
995
996#if defined (HOTKEY_CTRL) || defined (HOTKEY_META)
997 KeySym sym;
998
999 if (rs[Rs_bigfont_key]
1000 && ((sym = XStringToKeysym (rs[Rs_bigfont_key])) != 0))
1001 ks_bigfont = sym;
1002 if (rs[Rs_smallfont_key]
1003 && ((sym = XStringToKeysym (rs[Rs_smallfont_key])) != 0))
1004 ks_smallfont = sym;
1005#endif
1006} 1018}
1007 1019
1008/*}}} */ 1020/*}}} */
1009/*----------------------- end-of-file (C source) -----------------------*/ 1021/*----------------------- end-of-file (C source) -----------------------*/

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines