… | |
… | |
747 | return cmd_argv; |
747 | return cmd_argv; |
748 | } |
748 | } |
749 | |
749 | |
750 | /*----------------------------------------------------------------------*/ |
750 | /*----------------------------------------------------------------------*/ |
751 | void |
751 | void |
|
|
752 | rxvt_term::init (stringvec *argv, stringvec *envv) |
|
|
753 | { |
|
|
754 | argv->push_back (0); |
|
|
755 | envv->push_back (0); |
|
|
756 | |
|
|
757 | this->argv = argv; |
|
|
758 | this->envv = envv; |
|
|
759 | |
|
|
760 | init2 (argv->size () - 1, argv->begin ()); |
|
|
761 | } |
|
|
762 | |
|
|
763 | void |
|
|
764 | rxvt_term::init (int argc, const char *const *argv, const char *const *envv) |
|
|
765 | { |
|
|
766 | #if ENABLE_PERL |
|
|
767 | // perl might want to access the stringvecs later, so we need to copy them |
|
|
768 | stringvec *args = new stringvec; |
|
|
769 | for (int i = 0; i < argc; i++) |
|
|
770 | args->push_back (strdup (argv [i])); |
|
|
771 | |
|
|
772 | stringvec *envs = new stringvec; |
|
|
773 | for (const char *const *var = envv; *var; var++) |
|
|
774 | envs->push_back (strdup (*var)); |
|
|
775 | |
|
|
776 | init (args, envs); |
|
|
777 | #else |
|
|
778 | init2 (argc, argv); |
|
|
779 | #endif |
|
|
780 | } |
|
|
781 | |
|
|
782 | void |
752 | rxvt_term::init (int argc, const char *const *argv) |
783 | rxvt_term::init2 (int argc, const char *const *argv) |
753 | { |
784 | { |
754 | SET_R (this); |
785 | SET_R (this); |
755 | set_locale (""); |
786 | set_locale (""); |
756 | set_environ (envv); // a few things in X do not call setlocale :( |
787 | set_environ (envv); // a few things in X do not call setlocale :( |
757 | |
788 | |
… | |
… | |
824 | } |
855 | } |
825 | #endif |
856 | #endif |
826 | |
857 | |
827 | #ifdef BG_IMAGE_FROM_FILE |
858 | #ifdef BG_IMAGE_FROM_FILE |
828 | if (rs[Rs_backgroundPixmap]) |
859 | if (rs[Rs_backgroundPixmap]) |
829 | { |
|
|
830 | if (bg_set_file (rs[Rs_backgroundPixmap])) |
860 | if (bg_set_file (rs[Rs_backgroundPixmap])) |
831 | if (!bg_window_position_sensitive ()) |
861 | if (!bg_window_position_sensitive ()) |
832 | update_background (); |
862 | update_background (); |
833 | } |
|
|
834 | #endif |
863 | #endif |
835 | } |
864 | } |
836 | #endif |
865 | #endif |
837 | |
866 | |
838 | #if ENABLE_PERL |
867 | #if ENABLE_PERL |
… | |
… | |
960 | unsetenv ("TERMCAP"); /* terminfo should be okay */ |
989 | unsetenv ("TERMCAP"); /* terminfo should be okay */ |
961 | #endif /* HAVE_UNSETENV */ |
990 | #endif /* HAVE_UNSETENV */ |
962 | } |
991 | } |
963 | |
992 | |
964 | /*----------------------------------------------------------------------*/ |
993 | /*----------------------------------------------------------------------*/ |
965 | /* |
|
|
966 | * This is more or less stolen straight from XFree86 xterm. |
|
|
967 | * This should support all European type languages. |
|
|
968 | */ |
|
|
969 | void |
994 | void |
970 | rxvt_term::set_locale (const char *locale) |
995 | rxvt_term::set_locale (const char *locale) |
971 | { |
996 | { |
972 | set_environ (envv); |
997 | set_environ (envv); |
973 | |
998 | |
… | |
… | |
993 | SET_LOCALE (this->locale); |
1018 | SET_LOCALE (this->locale); |
994 | mbstate.reset (); |
1019 | mbstate.reset (); |
995 | #endif |
1020 | #endif |
996 | |
1021 | |
997 | #if HAVE_NL_LANGINFO |
1022 | #if HAVE_NL_LANGINFO |
998 | char *codeset = strdup (nl_langinfo (CODESET)); |
1023 | char *codeset = nl_langinfo (CODESET); |
999 | // /^UTF.?8/i |
1024 | // /^UTF.?8/i |
1000 | enc_utf8 = (codeset[0] == 'U' || codeset[0] == 'u') |
1025 | enc_utf8 = (codeset[0] == 'U' || codeset[0] == 'u') |
1001 | && (codeset[1] == 'T' || codeset[1] == 't') |
1026 | && (codeset[1] == 'T' || codeset[1] == 't') |
1002 | && (codeset[2] == 'F' || codeset[2] == 'f') |
1027 | && (codeset[2] == 'F' || codeset[2] == 'f') |
1003 | && (codeset[3] == '8' || codeset[4] == '8'); |
1028 | && (codeset[3] == '8' || codeset[4] == '8'); |
1004 | free (codeset); |
|
|
1005 | #else |
1029 | #else |
1006 | enc_utf8 = 0; |
1030 | enc_utf8 = 0; |
1007 | #endif |
1031 | #endif |
1008 | } |
1032 | } |
1009 | |
1033 | |
… | |
… | |
1012 | { |
1036 | { |
1013 | set_environ (envv); |
1037 | set_environ (envv); |
1014 | |
1038 | |
1015 | #ifdef USE_XIM |
1039 | #ifdef USE_XIM |
1016 | if (!locale) |
1040 | if (!locale) |
1017 | rxvt_warn ("setting locale failed, working without locale support.\n"); |
1041 | rxvt_warn ("setting locale failed, continuing without locale support.\n"); |
1018 | else |
1042 | else |
1019 | { |
1043 | { |
1020 | set_string_property (xa[XA_WM_LOCALE_NAME], locale); |
1044 | set_string_property (xa[XA_WM_LOCALE_NAME], locale); |
1021 | |
1045 | |
1022 | if (!XSupportsLocale ()) |
1046 | if (!XSupportsLocale ()) |
1023 | { |
1047 | { |
1024 | rxvt_warn ("the locale is not supported by Xlib, working without locale support.\n"); |
1048 | rxvt_warn ("the locale is not supported by Xlib, continuing without locale support.\n"); |
1025 | return; |
1049 | return; |
1026 | } |
1050 | } |
1027 | |
1051 | |
1028 | im_ev.start (display); |
1052 | im_ev.start (display); |
1029 | |
1053 | |