1 | /*--------------------------------*-C-*---------------------------------* |
1 | /*--------------------------------*-C-*---------------------------------* |
2 | * File: xdefaults.c |
2 | * File: xdefaults.c |
3 | *----------------------------------------------------------------------* |
3 | *----------------------------------------------------------------------* |
4 | * $Id: xdefaults.C,v 1.3 2003/11/25 11:52:42 pcg Exp $ |
4 | * $Id: xdefaults.C,v 1.8 2004/01/31 00:20:21 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> |
… | |
… | |
141 | #endif |
141 | #endif |
142 | #ifdef CURSOR_BLINK |
142 | #ifdef CURSOR_BLINK |
143 | BOOL(Rs_cursorBlink, "cursorBlink", "bc", Opt_cursorBlink, "blinking cursor"), |
143 | BOOL(Rs_cursorBlink, "cursorBlink", "bc", Opt_cursorBlink, "blinking cursor"), |
144 | #endif |
144 | #endif |
145 | #ifdef POINTER_BLANK |
145 | #ifdef POINTER_BLANK |
146 | BOOL(Rs_pointerBlank, "pointerBlank", NULL, Opt_pointerBlank, NULL), |
146 | BOOL(Rs_pointerBlank, "pointerBlank", "pb", Opt_pointerBlank, "switch off pointer after delay"), |
147 | #endif |
147 | #endif |
148 | STRG(Rs_color + Color_bg, "background", "bg", "color", "background color"), |
148 | STRG(Rs_color + Color_bg, "background", "bg", "color", "background color"), |
149 | STRG(Rs_color + Color_fg, "foreground", "fg", "color", "foreground color"), |
149 | STRG(Rs_color + Color_fg, "foreground", "fg", "color", "foreground color"), |
150 | RSTRG(Rs_color + minCOLOR + 0, "color0", "color"), |
150 | RSTRG(Rs_color + minCOLOR + 0, "color0", "color"), |
151 | RSTRG(Rs_color + minCOLOR + 1, "color1", "color"), |
151 | RSTRG(Rs_color + minCOLOR + 1, "color1", "color"), |
… | |
… | |
185 | "background pixmap"), |
185 | "background pixmap"), |
186 | #endif /* XPM_BACKGROUND */ |
186 | #endif /* XPM_BACKGROUND */ |
187 | #if (MENUBAR_MAX) |
187 | #if (MENUBAR_MAX) |
188 | RSTRG(Rs_menu, "menu", "name[;tag]"), |
188 | RSTRG(Rs_menu, "menu", "name[;tag]"), |
189 | #endif |
189 | #endif |
190 | #ifndef NO_BOLDFONT |
|
|
191 | STRG(Rs_boldFont, "boldFont", "fb", "fontname", "bold text font"), |
|
|
192 | #endif |
|
|
193 | STRG(Rs_font + 0, "font", "fn", "fontname", "normal text font"), |
190 | STRG(Rs_font, "font", "fn", "fontname", "normal text font"), |
194 | /* fonts: command-line option = resource name */ |
191 | /* fonts: command-line option = resource name */ |
195 | #ifdef MULTICHAR_SET |
|
|
196 | STRG(Rs_multichar_encoding, "multichar_encoding", "km", "mode", |
|
|
197 | "multichar encoding; mode = eucj|sjis|big5|gb|kr|noenc"), |
|
|
198 | #endif /* MULTICHAR_SET */ |
|
|
199 | #ifdef USE_XIM |
192 | #ifdef USE_XIM |
200 | STRG(Rs_inputMethod, "inputMethod", "im", "name", "name of input method"), |
193 | STRG(Rs_inputMethod, "inputMethod", "im", "name", "name of input method"), |
201 | STRG(Rs_preeditType, "preeditType", "pt", "style", |
194 | STRG(Rs_preeditType, "preeditType", "pt", "style", |
202 | "input style: style = OverTheSpot|OffTheSpot|Root"), |
195 | "input style: style = OverTheSpot|OffTheSpot|Root"), |
|
|
196 | #if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) |
|
|
197 | STRG(Rs_imLocale, "imLocale", "imlocale", "string", "locale to use for input method"), |
|
|
198 | #endif |
203 | #endif /* USE_XIM */ |
199 | #endif /* USE_XIM */ |
204 | #ifdef GREEK_SUPPORT |
200 | #ifdef GREEK_SUPPORT |
205 | STRG(Rs_greek_keyboard, "greek_keyboard", "grk", "mode", |
201 | STRG(Rs_greek_keyboard, "greek_keyboard", "grk", "mode", |
206 | "greek keyboard mapping; mode = iso | ibm"), |
202 | "greek keyboard mapping; mode = iso | ibm"), |
207 | RSTRG(Rs_greektoggle_key, "greektoggle_key", "keysym"), |
203 | RSTRG(Rs_greektoggle_key, "greektoggle_key", "keysym"), |
… | |
… | |
358 | |
354 | |
359 | #define INDENT 18 |
355 | #define INDENT 18 |
360 | |
356 | |
361 | /*{{{ usage: */ |
357 | /*{{{ usage: */ |
362 | /*----------------------------------------------------------------------*/ |
358 | /*----------------------------------------------------------------------*/ |
363 | /* EXTPROTO */ |
359 | static void |
364 | void |
|
|
365 | rxvt_usage(int type) |
360 | rxvt_usage(int type) |
366 | { |
361 | { |
367 | unsigned int i, col; |
362 | unsigned int i, col; |
368 | |
363 | |
369 | write(STDERR_FILENO, releasestring, sizeof(releasestring) - 1); |
364 | write(STDERR_FILENO, releasestring, sizeof(releasestring) - 1); |
… | |
… | |
444 | } |
439 | } |
445 | |
440 | |
446 | /*}}} */ |
441 | /*}}} */ |
447 | |
442 | |
448 | /*{{{ get command-line options before getting resources */ |
443 | /*{{{ get command-line options before getting resources */ |
449 | /* EXTPROTO */ |
|
|
450 | void |
444 | void |
451 | rxvt_get_options(pR_ int argc, const char *const *argv) |
445 | rxvt_term::get_options (int argc, const char *const *argv) |
452 | { |
446 | { |
453 | int i, bad_option = 0; |
447 | int i, bad_option = 0; |
454 | static const char On[3] = "ON", Off[4] = "OFF"; |
448 | static const char On[3] = "ON", Off[4] = "OFF"; |
455 | |
449 | |
456 | for (i = 1; i < argc; i++) { |
450 | for (i = 1; i < argc; i++) { |
… | |
… | |
500 | #endif |
494 | #endif |
501 | if (flag == On && str && (optList[entry].doff != -1)) { |
495 | if (flag == On && str && (optList[entry].doff != -1)) { |
502 | #ifdef DEBUG_RESOURCES |
496 | #ifdef DEBUG_RESOURCES |
503 | fprintf(stderr, "\"%s\"\n", str); |
497 | fprintf(stderr, "\"%s\"\n", str); |
504 | #endif |
498 | #endif |
505 | R->rs[optList[entry].doff] = str; |
499 | rs[optList[entry].doff] = str; |
506 | /* |
500 | /* |
507 | * special cases are handled in main.c:main() to allow |
501 | * special cases are handled in main.c:main() to allow |
508 | * X resources to set these values before we settle for |
502 | * X resources to set these values before we settle for |
509 | * default values |
503 | * default values |
510 | */ |
504 | */ |
… | |
… | |
517 | #ifdef DEBUG_RESOURCES |
511 | #ifdef DEBUG_RESOURCES |
518 | fprintf(stderr, "boolean (%s,%s) = %s\n", |
512 | fprintf(stderr, "boolean (%s,%s) = %s\n", |
519 | optList[entry].opt, optList[entry].kw, flag); |
513 | optList[entry].opt, optList[entry].kw, flag); |
520 | #endif |
514 | #endif |
521 | if (flag == On) |
515 | if (flag == On) |
522 | R->Options |= (optList[entry].flag); |
516 | Options |= (optList[entry].flag); |
523 | else |
517 | else |
524 | R->Options &= ~(optList[entry].flag); |
518 | Options &= ~(optList[entry].flag); |
525 | |
519 | |
526 | if (optList[entry].doff != -1) |
520 | if (optList[entry].doff != -1) |
527 | R->rs[optList[entry].doff] = flag; |
521 | rs[optList[entry].doff] = flag; |
528 | } |
522 | } |
529 | } else |
523 | } else |
530 | #ifdef KEYSYM_RESOURCE |
524 | #ifdef KEYSYM_RESOURCE |
531 | /* if (!STRNCMP(opt, "keysym.", sizeof("keysym.") - 1)) */ |
525 | /* if (!STRNCMP(opt, "keysym.", sizeof("keysym.") - 1)) */ |
532 | if (rxvt_Str_match(opt, "keysym.")) { |
526 | if (rxvt_Str_match(opt, "keysym.")) { |
533 | const char *str = argv[++i]; |
527 | const char *str = argv[++i]; |
534 | |
528 | |
535 | if (str != NULL) |
529 | if (str != NULL) |
536 | rxvt_parse_keysym(aR_ opt + sizeof("keysym.") - 1, str); |
530 | parse_keysym (opt + sizeof("keysym.") - 1, str); |
537 | } else |
531 | } else |
538 | #endif |
532 | #endif |
539 | ; |
533 | bad_option = 1; |
540 | } |
534 | } |
541 | |
535 | |
542 | if (bad_option) |
536 | if (bad_option) |
543 | rxvt_usage(0); |
537 | rxvt_usage(0); |
544 | } |
538 | } |
… | |
… | |
554 | * quarks will be something like |
548 | * quarks will be something like |
555 | * "rxvt" "keysym" "0xFF01" |
549 | * "rxvt" "keysym" "0xFF01" |
556 | * value will be a string |
550 | * value will be a string |
557 | */ |
551 | */ |
558 | /* ARGSUSED */ |
552 | /* ARGSUSED */ |
559 | /* INTPROTO */ |
|
|
560 | Bool |
553 | bool |
561 | rxvt_define_key(XrmDatabase *database __attribute__((unused)), XrmBindingList bindings __attribute__((unused)), XrmQuarkList quarks, XrmRepresentation *type __attribute__((unused)), XrmValue *value, XPointer closure __attribute__((unused))) |
554 | rxvt_define_key(XrmDatabase *database __attribute__((unused)), XrmBindingList bindings __attribute__((unused)), XrmQuarkList quarks, XrmRepresentation *type __attribute__((unused)), XrmValue *value, XPointer closure __attribute__((unused))) |
562 | { |
555 | { |
563 | dR; |
|
|
564 | int last; |
556 | int last; |
565 | |
557 | |
566 | for (last = 0; quarks[last] != NULLQUARK; last++) /* look for last quark in list */ |
558 | for (last = 0; quarks[last] != NULLQUARK; last++) /* look for last quark in list */ |
567 | ; |
559 | ; |
568 | last--; |
560 | last--; |
569 | rxvt_parse_keysym(aR_ XrmQuarkToString(quarks[last]), (char *)value->addr); |
561 | GET_R->parse_keysym (XrmQuarkToString(quarks[last]), (char *)value->addr);//D//TODO |
570 | return False; |
562 | return False; |
571 | } |
563 | } |
572 | |
564 | |
573 | /* |
565 | /* |
574 | * look for something like this (XK_Delete) |
566 | * look for something like this (XK_Delete) |
… | |
… | |
577 | * arg will be |
569 | * arg will be |
578 | * NULL for ~/.Xdefaults and |
570 | * NULL for ~/.Xdefaults and |
579 | * non-NULL for command-line options (need to allocate) |
571 | * non-NULL for command-line options (need to allocate) |
580 | */ |
572 | */ |
581 | #define NEWARGLIM 500 /* `reasonable' size */ |
573 | #define NEWARGLIM 500 /* `reasonable' size */ |
582 | /* INTPROTO */ |
|
|
583 | int |
574 | int |
584 | rxvt_parse_keysym(pR_ const char *str, const char *arg) |
575 | rxvt_term::parse_keysym (const char *str, const char *arg) |
585 | { |
576 | { |
586 | int n, sym; |
577 | int n, sym; |
587 | char *key_string, *newarg = NULL; |
578 | char *key_string, *newarg = NULL; |
588 | char newargstr[NEWARGLIM]; |
579 | char newargstr[NEWARGLIM]; |
589 | |
580 | |
… | |
… | |
624 | } |
615 | } |
625 | |
616 | |
626 | if (sym < 0xFF00 || sym > 0xFFFF) /* we only do extended keys */ |
617 | if (sym < 0xFF00 || sym > 0xFFFF) /* we only do extended keys */ |
627 | return -1; |
618 | return -1; |
628 | sym &= 0xFF; |
619 | sym &= 0xFF; |
629 | if (R->Keysym_map[sym] != NULL) /* already set ? */ |
620 | if (Keysym_map[sym] != NULL) /* already set ? */ |
630 | return -1; |
621 | return -1; |
631 | |
622 | |
632 | if (newarg == NULL) { |
623 | if (newarg == NULL) { |
633 | STRNCPY(newargstr, arg, NEWARGLIM - 1); |
624 | STRNCPY(newargstr, arg, NEWARGLIM - 1); |
634 | newargstr[NEWARGLIM - 1] = '\0'; |
625 | newargstr[NEWARGLIM - 1] = '\0'; |
… | |
… | |
640 | MIN_IT(n, 255); |
631 | MIN_IT(n, 255); |
641 | key_string = (char *)rxvt_malloc((n + 1) * sizeof(char)); |
632 | key_string = (char *)rxvt_malloc((n + 1) * sizeof(char)); |
642 | |
633 | |
643 | key_string[0] = n; |
634 | key_string[0] = n; |
644 | STRNCPY(key_string + 1, newarg, n); |
635 | STRNCPY(key_string + 1, newarg, n); |
645 | R->Keysym_map[sym] = (unsigned char *)key_string; |
636 | Keysym_map[sym] = (unsigned char *)key_string; |
646 | |
637 | |
647 | return 1; |
638 | return 1; |
648 | } |
639 | } |
649 | |
640 | |
650 | # endif /* KEYSYM_RESOURCE */ |
641 | # endif /* KEYSYM_RESOURCE */ |
… | |
… | |
652 | # ifndef USE_XGETDEFAULT |
643 | # ifndef USE_XGETDEFAULT |
653 | /*{{{ rxvt_get_xdefaults() */ |
644 | /*{{{ rxvt_get_xdefaults() */ |
654 | /* |
645 | /* |
655 | * the matching algorithm used for memory-save fake resources |
646 | * the matching algorithm used for memory-save fake resources |
656 | */ |
647 | */ |
657 | /* INTPROTO */ |
|
|
658 | void |
648 | void |
659 | rxvt_get_xdefaults(pR_ FILE *stream, const char *name) |
649 | rxvt_term::get_xdefaults (FILE *stream, const char *name) |
660 | { |
650 | { |
661 | unsigned int len; |
651 | unsigned int len; |
662 | char *str, buffer[256]; |
652 | char *str, buffer[256]; |
663 | |
653 | |
664 | if (stream == NULL) |
654 | if (stream == NULL) |
… | |
… | |
674 | || (len && STRNCMP(str, name, len))) |
664 | || (len && STRNCMP(str, name, len))) |
675 | continue; |
665 | continue; |
676 | str += (len + 1); /* skip `name*' or `name.' */ |
666 | str += (len + 1); /* skip `name*' or `name.' */ |
677 | |
667 | |
678 | # ifdef KEYSYM_RESOURCE |
668 | # ifdef KEYSYM_RESOURCE |
679 | if (!rxvt_parse_keysym(aR_ str, NULL)) |
669 | if (!parse_keysym (str, NULL)) |
680 | # endif /* KEYSYM_RESOURCE */ |
670 | # endif /* KEYSYM_RESOURCE */ |
681 | for (entry = 0; entry < optList_size(); entry++) { |
671 | for (entry = 0; entry < optList_size(); entry++) { |
682 | const char *kw = optList[entry].kw; |
672 | const char *kw = optList[entry].kw; |
683 | |
673 | |
684 | if (kw == NULL) |
674 | if (kw == NULL) |
685 | continue; |
675 | continue; |
686 | n = STRLEN(kw); |
676 | n = STRLEN (kw); |
687 | if (str[n] == ':' && rxvt_Str_match(str, kw)) { |
677 | if (str[n] == ':' && rxvt_Str_match(str, kw)) { |
688 | /* skip `keyword:' */ |
678 | /* skip `keyword:' */ |
689 | str += (n + 1); |
679 | str += (n + 1); |
690 | rxvt_Str_trim(str); |
680 | rxvt_Str_trim(str); |
691 | n = STRLEN(str); |
681 | n = STRLEN(str); |
692 | if (n && R->rs[optList[entry].doff] == NULL) { |
682 | if (n && rs[optList[entry].doff] == NULL) { |
693 | /* not already set */ |
683 | /* not already set */ |
694 | int s; |
684 | int s; |
695 | char *p = (char *)rxvt_malloc((n + 1) * sizeof(char)); |
685 | char *p = (char *)rxvt_malloc((n + 1) * sizeof(char)); |
696 | |
686 | |
697 | STRCPY(p, str); |
687 | STRCPY(p, str); |
698 | R->rs[optList[entry].doff] = p; |
688 | rs[optList[entry].doff] = p; |
699 | if (optList_isBool(entry)) { |
689 | if (optList_isBool(entry)) { |
700 | s = STRCASECMP(str, "TRUE") == 0 |
690 | s = STRCASECMP(str, "TRUE") == 0 |
701 | || STRCASECMP(str, "YES") == 0 |
691 | || STRCASECMP(str, "YES") == 0 |
702 | || STRCASECMP(str, "ON") == 0 |
692 | || STRCASECMP(str, "ON") == 0 |
703 | || STRCASECMP(str, "1") == 0; |
693 | || STRCASECMP(str, "1") == 0; |
704 | if (optList_isReverse(entry)) |
694 | if (optList_isReverse(entry)) |
705 | s = !s; |
695 | s = !s; |
706 | if (s) |
696 | if (s) |
707 | R->Options |= (optList[entry].flag); |
697 | Options |= (optList[entry].flag); |
708 | else |
698 | else |
709 | R->Options &= ~(optList[entry].flag); |
699 | Options &= ~(optList[entry].flag); |
710 | } |
700 | } |
711 | } |
701 | } |
712 | break; |
702 | break; |
713 | } |
703 | } |
714 | } |
704 | } |
… | |
… | |
723 | /*{{{ read the resources files */ |
713 | /*{{{ read the resources files */ |
724 | /* |
714 | /* |
725 | * using XGetDefault() or the hand-rolled replacement |
715 | * using XGetDefault() or the hand-rolled replacement |
726 | */ |
716 | */ |
727 | /* ARGSUSED */ |
717 | /* ARGSUSED */ |
728 | /* EXTPROTO */ |
|
|
729 | void |
718 | void |
730 | rxvt_extract_resources(pR_ Display *display __attribute__((unused)), const char *name) |
719 | rxvt_term::extract_resources (Display *display __attribute__((unused)), const char *name) |
731 | { |
720 | { |
732 | #ifndef NO_RESOURCES |
721 | #ifndef NO_RESOURCES |
733 | |
722 | |
734 | # if defined XAPPLOADDIR |
723 | # if defined XAPPLOADDIR |
735 | # if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) |
724 | # if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) |
736 | /* Compute the path of the possibly available localized Rxvt file */ |
725 | /* Compute the path of the possibly available localized Rxvt file */ |
737 | char *localepath = NULL; |
726 | char *localepath = NULL; |
738 | |
727 | |
739 | if (R->locale != NULL) { /* XXX: must limit length of string */ |
728 | if (locale != NULL) { /* XXX: must limit length of string */ |
740 | localepath = (char *)rxvt_malloc(256); |
729 | localepath = (char *)rxvt_malloc(256); |
741 | sprintf(localepath, XAPPLOADDIRLOCALE "/" APL_SUBCLASS, |
730 | sprintf(localepath, XAPPLOADDIRLOCALE "/" APL_SUBCLASS, |
742 | (int)(258 - sizeof(XAPPLOADDIRLOCALE) - sizeof(APL_SUBCLASS)), |
731 | (int)(258 - sizeof(XAPPLOADDIRLOCALE) - sizeof(APL_SUBCLASS)), |
743 | R->locale); /* 258 = 255 + 4 (-.*s) - 1 (/) */ |
732 | locale); /* 258 = 255 + 4 (-.*s) - 1 (/) */ |
744 | } |
733 | } |
745 | |
734 | |
746 | { |
735 | { |
747 | # endif |
736 | # endif |
748 | # endif |
737 | # endif |
… | |
… | |
822 | for (entry = 0; entry < optList_size(); entry++) { |
811 | for (entry = 0; entry < optList_size(); entry++) { |
823 | int s; |
812 | int s; |
824 | char *p, *p0; |
813 | char *p, *p0; |
825 | const char *kw = optList[entry].kw; |
814 | const char *kw = optList[entry].kw; |
826 | |
815 | |
827 | if (kw == NULL || R->rs[optList[entry].doff] != NULL) |
816 | if (kw == NULL || rs[optList[entry].doff] != NULL) |
828 | continue; /* previously set */ |
817 | continue; /* previously set */ |
829 | |
818 | |
830 | p = XGetDefault(display, name, kw); |
819 | p = XGetDefault(display, name, kw); |
831 | p0 = XGetDefault(display, "!INVALIDPROGRAMMENAMEDONTMATCH!", kw); |
820 | p0 = XGetDefault(display, "!INVALIDPROGRAMMENAMEDONTMATCH!", kw); |
832 | if (p == NULL || (p0 && STRCMP(p, p0) == 0)) { |
821 | if (p == NULL || (p0 && STRCMP(p, p0) == 0)) { |
… | |
… | |
835 | p = XGetDefault(display, APL_CLASS, kw); |
824 | p = XGetDefault(display, APL_CLASS, kw); |
836 | } |
825 | } |
837 | if (p == NULL && p0) |
826 | if (p == NULL && p0) |
838 | p = p0; |
827 | p = p0; |
839 | if (p) { |
828 | if (p) { |
840 | R->rs[optList[entry].doff] = p; |
829 | rs[optList[entry].doff] = p; |
841 | |
830 | |
842 | if (optList_isBool(entry)) { |
831 | if (optList_isBool(entry)) { |
843 | s = STRCASECMP(p, "TRUE") == 0 |
832 | s = STRCASECMP(p, "TRUE") == 0 |
844 | || STRCASECMP(p, "YES") == 0 |
833 | || STRCASECMP(p, "YES") == 0 |
845 | || STRCASECMP(p, "ON") == 0 |
834 | || STRCASECMP(p, "ON") == 0 |
846 | || STRCASECMP(p, "1") == 0; |
835 | || STRCASECMP(p, "1") == 0; |
847 | if (optList_isReverse(entry)) |
836 | if (optList_isReverse(entry)) |
848 | s = !s; |
837 | s = !s; |
849 | if (s) |
838 | if (s) |
850 | R->Options |= (optList[entry].flag); |
839 | Options |= (optList[entry].flag); |
851 | else |
840 | else |
852 | R->Options &= ~(optList[entry].flag); |
841 | Options &= ~(optList[entry].flag); |
853 | } |
842 | } |
854 | } |
843 | } |
855 | } |
844 | } |
856 | |
845 | |
857 | /* |
846 | /* |
… | |
… | |
917 | * |
906 | * |
918 | * Also, use a special sub-class so that we can use either or both of |
907 | * Also, use a special sub-class so that we can use either or both of |
919 | * "XTerm" and "Rxvt" as class names. |
908 | * "XTerm" and "Rxvt" as class names. |
920 | */ |
909 | */ |
921 | |
910 | |
922 | rxvt_get_xdefaults(aR_ fd, name); |
911 | get_xdefaults (fd, name); |
923 | rxvt_get_xdefaults(aR_ fd, APL_SUBCLASS); |
912 | get_xdefaults (fd, APL_SUBCLASS); |
924 | |
913 | |
925 | # if defined(XAPPLOADDIR) && defined(USE_XAPPLOADDIR) |
914 | # if defined(XAPPLOADDIR) && defined(USE_XAPPLOADDIR) |
926 | { |
915 | { |
927 | FILE *ad = NULL; |
916 | FILE *ad = NULL; |
928 | |
917 | |
929 | # if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) |
918 | # if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) |
930 | if (localepath == NULL || (ad = fopen(localepath, "r")) == NULL) |
919 | if (localepath == NULL || (ad = fopen(localepath, "r")) == NULL) |
931 | # endif |
920 | # endif |
932 | ad = fopen(XAPPLOADDIR "/" APL_SUBCLASS, "r"); |
921 | ad = fopen(XAPPLOADDIR "/" APL_SUBCLASS, "r"); |
933 | if (ad != NULL) { |
922 | if (ad != NULL) { |
934 | rxvt_get_xdefaults(aR_ ad, APL_SUBCLASS); |
923 | get_xdefaults (ad, APL_SUBCLASS); |
935 | rxvt_get_xdefaults(aR_ ad, ""); |
924 | get_xdefaults (ad, ""); |
936 | fclose(ad); |
925 | fclose(ad); |
937 | } |
926 | } |
938 | } |
927 | } |
939 | # endif /* XAPPLOADDIR */ |
928 | # endif /* XAPPLOADDIR */ |
940 | |
929 | |
941 | rxvt_get_xdefaults(aR_ fd, APL_CLASS); |
930 | get_xdefaults (fd, APL_CLASS); |
942 | rxvt_get_xdefaults(aR_ fd, ""); /* partial match */ |
931 | get_xdefaults (fd, ""); /* partial match */ |
943 | if (fd != NULL) |
932 | if (fd != NULL) |
944 | fclose(fd); |
933 | fclose(fd); |
945 | # endif /* USE_XGETDEFAULT */ |
934 | # endif /* USE_XGETDEFAULT */ |
946 | |
935 | |
947 | # if defined XAPPLOADDIR |
936 | # if defined XAPPLOADDIR |
… | |
… | |
958 | /* |
947 | /* |
959 | * even without resources, at least do this setup for command-line |
948 | * even without resources, at least do this setup for command-line |
960 | * options and command-line long options |
949 | * options and command-line long options |
961 | */ |
950 | */ |
962 | #ifdef MULTICHAR_SET |
951 | #ifdef MULTICHAR_SET |
963 | rxvt_set_multichar_encoding(aR_ R->rs[Rs_multichar_encoding]); |
952 | set_multichar_encoding (rs[Rs_multichar_encoding]); |
964 | #endif |
953 | #endif |
965 | #ifdef GREEK_SUPPORT |
954 | #ifdef GREEK_SUPPORT |
966 | /* this could be a function in grkelot.c */ |
955 | /* this could be a function in grkelot.c */ |
967 | /* void set_greek_keyboard (const char * str); */ |
956 | /* void set_greek_keyboard (const char * str); */ |
968 | if (R->rs[Rs_greek_keyboard]) { |
957 | if (rs[Rs_greek_keyboard]) { |
969 | if (!STRCMP(R->rs[Rs_greek_keyboard], "iso")) |
958 | if (!STRCMP(rs[Rs_greek_keyboard], "iso")) |
970 | greek_setmode(GREEK_ELOT928); /* former -grk9 */ |
959 | greek_setmode(GREEK_ELOT928); /* former -grk9 */ |
971 | else if (!STRCMP(R->rs[Rs_greek_keyboard], "ibm")) |
960 | else if (!STRCMP(rs[Rs_greek_keyboard], "ibm")) |
972 | greek_setmode(GREEK_IBM437); /* former -grk4 */ |
961 | greek_setmode(GREEK_IBM437); /* former -grk4 */ |
973 | } |
962 | } |
974 | { |
963 | { |
975 | KeySym sym; |
964 | KeySym sym; |
976 | |
965 | |
977 | if (R->rs[Rs_greektoggle_key] |
966 | if (rs[Rs_greektoggle_key] |
978 | && ((sym = XStringToKeysym(R->rs[Rs_greektoggle_key])) != 0)) |
967 | && ((sym = XStringToKeysym(rs[Rs_greektoggle_key])) != 0)) |
979 | R->ks_greekmodeswith = sym; |
968 | ks_greekmodeswith = sym; |
980 | } |
969 | } |
981 | #endif /* GREEK_SUPPORT */ |
970 | #endif /* GREEK_SUPPORT */ |
982 | |
971 | |
983 | #if defined (HOTKEY_CTRL) || defined (HOTKEY_META) |
972 | #if defined (HOTKEY_CTRL) || defined (HOTKEY_META) |
984 | { |
973 | { |
985 | KeySym sym; |
974 | KeySym sym; |
986 | |
975 | |
987 | if (R->rs[Rs_bigfont_key] |
976 | if (rs[Rs_bigfont_key] |
988 | && ((sym = XStringToKeysym(R->rs[Rs_bigfont_key])) != 0)) |
977 | && ((sym = XStringToKeysym(rs[Rs_bigfont_key])) != 0)) |
989 | R->ks_bigfont = sym; |
978 | ks_bigfont = sym; |
990 | if (R->rs[Rs_smallfont_key] |
979 | if (rs[Rs_smallfont_key] |
991 | && ((sym = XStringToKeysym(R->rs[Rs_smallfont_key])) != 0)) |
980 | && ((sym = XStringToKeysym(rs[Rs_smallfont_key])) != 0)) |
992 | R->ks_smallfont = sym; |
981 | ks_smallfont = sym; |
993 | } |
982 | } |
994 | #endif |
983 | #endif |
995 | } |
984 | } |
996 | |
985 | |
997 | /*}}} */ |
986 | /*}}} */ |