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.2 by pcg, Mon Nov 24 17:31:28 2003 UTC vs.
Revision 1.3 by pcg, Tue Nov 25 11:52:42 2003 UTC

1/*--------------------------------*-C-*---------------------------------* 1/*--------------------------------*-C-*---------------------------------*
2 * File: xdefaults.c 2 * File: xdefaults.c
3 *----------------------------------------------------------------------* 3 *----------------------------------------------------------------------*
4 * $Id: xdefaults.C,v 1.2 2003/11/24 17:31:28 pcg Exp $ 4 * $Id: xdefaults.C,v 1.3 2003/11/25 11:52:42 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>
500#endif 500#endif
501 if (flag == On && str && (optList[entry].doff != -1)) { 501 if (flag == On && str && (optList[entry].doff != -1)) {
502#ifdef DEBUG_RESOURCES 502#ifdef DEBUG_RESOURCES
503 fprintf(stderr, "\"%s\"\n", str); 503 fprintf(stderr, "\"%s\"\n", str);
504#endif 504#endif
505 R->h->rs[optList[entry].doff] = str; 505 R->rs[optList[entry].doff] = str;
506 /* 506 /*
507 * special cases are handled in main.c:main() to allow 507 * special cases are handled in main.c:main() to allow
508 * X resources to set these values before we settle for 508 * X resources to set these values before we settle for
509 * default values 509 * default values
510 */ 510 */
522 R->Options |= (optList[entry].flag); 522 R->Options |= (optList[entry].flag);
523 else 523 else
524 R->Options &= ~(optList[entry].flag); 524 R->Options &= ~(optList[entry].flag);
525 525
526 if (optList[entry].doff != -1) 526 if (optList[entry].doff != -1)
527 R->h->rs[optList[entry].doff] = flag; 527 R->rs[optList[entry].doff] = flag;
528 } 528 }
529 } else 529 } else
530#ifdef KEYSYM_RESOURCE 530#ifdef KEYSYM_RESOURCE
531 /* if (!STRNCMP(opt, "keysym.", sizeof("keysym.") - 1)) */ 531 /* if (!STRNCMP(opt, "keysym.", sizeof("keysym.") - 1)) */
532 if (rxvt_Str_match(opt, "keysym.")) { 532 if (rxvt_Str_match(opt, "keysym.")) {
624 } 624 }
625 625
626 if (sym < 0xFF00 || sym > 0xFFFF) /* we only do extended keys */ 626 if (sym < 0xFF00 || sym > 0xFFFF) /* we only do extended keys */
627 return -1; 627 return -1;
628 sym &= 0xFF; 628 sym &= 0xFF;
629 if (R->h->Keysym_map[sym] != NULL) /* already set ? */ 629 if (R->Keysym_map[sym] != NULL) /* already set ? */
630 return -1; 630 return -1;
631 631
632 if (newarg == NULL) { 632 if (newarg == NULL) {
633 STRNCPY(newargstr, arg, NEWARGLIM - 1); 633 STRNCPY(newargstr, arg, NEWARGLIM - 1);
634 newargstr[NEWARGLIM - 1] = '\0'; 634 newargstr[NEWARGLIM - 1] = '\0';
640 MIN_IT(n, 255); 640 MIN_IT(n, 255);
641 key_string = (char *)rxvt_malloc((n + 1) * sizeof(char)); 641 key_string = (char *)rxvt_malloc((n + 1) * sizeof(char));
642 642
643 key_string[0] = n; 643 key_string[0] = n;
644 STRNCPY(key_string + 1, newarg, n); 644 STRNCPY(key_string + 1, newarg, n);
645 R->h->Keysym_map[sym] = (unsigned char *)key_string; 645 R->Keysym_map[sym] = (unsigned char *)key_string;
646 646
647 return 1; 647 return 1;
648} 648}
649 649
650# endif /* KEYSYM_RESOURCE */ 650# endif /* KEYSYM_RESOURCE */
687 if (str[n] == ':' && rxvt_Str_match(str, kw)) { 687 if (str[n] == ':' && rxvt_Str_match(str, kw)) {
688 /* skip `keyword:' */ 688 /* skip `keyword:' */
689 str += (n + 1); 689 str += (n + 1);
690 rxvt_Str_trim(str); 690 rxvt_Str_trim(str);
691 n = STRLEN(str); 691 n = STRLEN(str);
692 if (n && R->h->rs[optList[entry].doff] == NULL) { 692 if (n && R->rs[optList[entry].doff] == NULL) {
693 /* not already set */ 693 /* not already set */
694 int s; 694 int s;
695 char *p = (char *)rxvt_malloc((n + 1) * sizeof(char)); 695 char *p = (char *)rxvt_malloc((n + 1) * sizeof(char));
696 696
697 STRCPY(p, str); 697 STRCPY(p, str);
698 R->h->rs[optList[entry].doff] = p; 698 R->rs[optList[entry].doff] = p;
699 if (optList_isBool(entry)) { 699 if (optList_isBool(entry)) {
700 s = STRCASECMP(str, "TRUE") == 0 700 s = STRCASECMP(str, "TRUE") == 0
701 || STRCASECMP(str, "YES") == 0 701 || STRCASECMP(str, "YES") == 0
702 || STRCASECMP(str, "ON") == 0 702 || STRCASECMP(str, "ON") == 0
703 || STRCASECMP(str, "1") == 0; 703 || STRCASECMP(str, "1") == 0;
734# if defined XAPPLOADDIR 734# if defined XAPPLOADDIR
735# if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE) 735# if defined(HAVE_XSETLOCALE) || defined(HAVE_SETLOCALE)
736 /* Compute the path of the possibly available localized Rxvt file */ 736 /* Compute the path of the possibly available localized Rxvt file */
737 char *localepath = NULL; 737 char *localepath = NULL;
738 738
739 if (R->h->locale != NULL) { /* XXX: must limit length of string */ 739 if (R->locale != NULL) { /* XXX: must limit length of string */
740 localepath = (char *)rxvt_malloc(256); 740 localepath = (char *)rxvt_malloc(256);
741 sprintf(localepath, XAPPLOADDIRLOCALE "/" APL_SUBCLASS, 741 sprintf(localepath, XAPPLOADDIRLOCALE "/" APL_SUBCLASS,
742 (int)(258 - sizeof(XAPPLOADDIRLOCALE) - sizeof(APL_SUBCLASS)), 742 (int)(258 - sizeof(XAPPLOADDIRLOCALE) - sizeof(APL_SUBCLASS)),
743 R->h->locale); /* 258 = 255 + 4 (-.*s) - 1 (/) */ 743 R->locale); /* 258 = 255 + 4 (-.*s) - 1 (/) */
744 } 744 }
745 745
746 { 746 {
747# endif 747# endif
748# endif 748# endif
822 for (entry = 0; entry < optList_size(); entry++) { 822 for (entry = 0; entry < optList_size(); entry++) {
823 int s; 823 int s;
824 char *p, *p0; 824 char *p, *p0;
825 const char *kw = optList[entry].kw; 825 const char *kw = optList[entry].kw;
826 826
827 if (kw == NULL || R->h->rs[optList[entry].doff] != NULL) 827 if (kw == NULL || R->rs[optList[entry].doff] != NULL)
828 continue; /* previously set */ 828 continue; /* previously set */
829 829
830 p = XGetDefault(display, name, kw); 830 p = XGetDefault(display, name, kw);
831 p0 = XGetDefault(display, "!INVALIDPROGRAMMENAMEDONTMATCH!", kw); 831 p0 = XGetDefault(display, "!INVALIDPROGRAMMENAMEDONTMATCH!", kw);
832 if (p == NULL || (p0 && STRCMP(p, p0) == 0)) { 832 if (p == NULL || (p0 && STRCMP(p, p0) == 0)) {
835 p = XGetDefault(display, APL_CLASS, kw); 835 p = XGetDefault(display, APL_CLASS, kw);
836 } 836 }
837 if (p == NULL && p0) 837 if (p == NULL && p0)
838 p = p0; 838 p = p0;
839 if (p) { 839 if (p) {
840 R->h->rs[optList[entry].doff] = p; 840 R->rs[optList[entry].doff] = p;
841 841
842 if (optList_isBool(entry)) { 842 if (optList_isBool(entry)) {
843 s = STRCASECMP(p, "TRUE") == 0 843 s = STRCASECMP(p, "TRUE") == 0
844 || STRCASECMP(p, "YES") == 0 844 || STRCASECMP(p, "YES") == 0
845 || STRCASECMP(p, "ON") == 0 845 || STRCASECMP(p, "ON") == 0
958/* 958/*
959 * even without resources, at least do this setup for command-line 959 * even without resources, at least do this setup for command-line
960 * options and command-line long options 960 * options and command-line long options
961 */ 961 */
962#ifdef MULTICHAR_SET 962#ifdef MULTICHAR_SET
963 rxvt_set_multichar_encoding(aR_ R->h->rs[Rs_multichar_encoding]); 963 rxvt_set_multichar_encoding(aR_ R->rs[Rs_multichar_encoding]);
964#endif 964#endif
965#ifdef GREEK_SUPPORT 965#ifdef GREEK_SUPPORT
966/* this could be a function in grkelot.c */ 966/* this could be a function in grkelot.c */
967/* void set_greek_keyboard (const char * str); */ 967/* void set_greek_keyboard (const char * str); */
968 if (R->h->rs[Rs_greek_keyboard]) { 968 if (R->rs[Rs_greek_keyboard]) {
969 if (!STRCMP(R->h->rs[Rs_greek_keyboard], "iso")) 969 if (!STRCMP(R->rs[Rs_greek_keyboard], "iso"))
970 greek_setmode(GREEK_ELOT928); /* former -grk9 */ 970 greek_setmode(GREEK_ELOT928); /* former -grk9 */
971 else if (!STRCMP(R->h->rs[Rs_greek_keyboard], "ibm")) 971 else if (!STRCMP(R->rs[Rs_greek_keyboard], "ibm"))
972 greek_setmode(GREEK_IBM437); /* former -grk4 */ 972 greek_setmode(GREEK_IBM437); /* former -grk4 */
973 } 973 }
974 { 974 {
975 KeySym sym; 975 KeySym sym;
976 976
977 if (R->h->rs[Rs_greektoggle_key] 977 if (R->rs[Rs_greektoggle_key]
978 && ((sym = XStringToKeysym(R->h->rs[Rs_greektoggle_key])) != 0)) 978 && ((sym = XStringToKeysym(R->rs[Rs_greektoggle_key])) != 0))
979 R->h->ks_greekmodeswith = sym; 979 R->ks_greekmodeswith = sym;
980 } 980 }
981#endif /* GREEK_SUPPORT */ 981#endif /* GREEK_SUPPORT */
982 982
983#if defined (HOTKEY_CTRL) || defined (HOTKEY_META) 983#if defined (HOTKEY_CTRL) || defined (HOTKEY_META)
984 { 984 {
985 KeySym sym; 985 KeySym sym;
986 986
987 if (R->h->rs[Rs_bigfont_key] 987 if (R->rs[Rs_bigfont_key]
988 && ((sym = XStringToKeysym(R->h->rs[Rs_bigfont_key])) != 0)) 988 && ((sym = XStringToKeysym(R->rs[Rs_bigfont_key])) != 0))
989 R->h->ks_bigfont = sym; 989 R->ks_bigfont = sym;
990 if (R->h->rs[Rs_smallfont_key] 990 if (R->rs[Rs_smallfont_key]
991 && ((sym = XStringToKeysym(R->h->rs[Rs_smallfont_key])) != 0)) 991 && ((sym = XStringToKeysym(R->rs[Rs_smallfont_key])) != 0))
992 R->h->ks_smallfont = sym; 992 R->ks_smallfont = sym;
993 } 993 }
994#endif 994#endif
995} 995}
996 996
997/*}}} */ 997/*}}} */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines