… | |
… | |
612 | rxvt_perl.init (this); |
612 | rxvt_perl.init (this); |
613 | HOOK_INVOKE ((this, HOOK_INIT, DT_END)); |
613 | HOOK_INVOKE ((this, HOOK_INIT, DT_END)); |
614 | } |
614 | } |
615 | #endif |
615 | #endif |
616 | |
616 | |
|
|
617 | // must be called after initialising the perl interpreter as it |
|
|
618 | // may invoke the `on_register_command' hook |
617 | extract_keysym_resources (); |
619 | extract_keysym_resources (); |
618 | |
620 | |
619 | /* |
621 | /* |
620 | * set any defaults not already set |
622 | * set any defaults not already set |
621 | */ |
623 | */ |
… | |
… | |
746 | envv->push_back (0); |
748 | envv->push_back (0); |
747 | |
749 | |
748 | this->argv = argv; |
750 | this->argv = argv; |
749 | this->envv = envv; |
751 | this->envv = envv; |
750 | |
752 | |
|
|
753 | env = new char *[this->envv->size ()]; |
|
|
754 | for (int i = 0; i < this->envv->size (); i++) |
|
|
755 | env[i] = this->envv->at (i); |
|
|
756 | |
751 | init2 (argv->size () - 1, argv->begin ()); |
757 | init2 (argv->size () - 1, argv->begin ()); |
752 | } |
758 | } |
753 | |
759 | |
754 | void |
760 | void |
755 | rxvt_term::init (int argc, const char *const *argv, const char *const *envv) |
761 | rxvt_term::init (int argc, const char *const *argv, const char *const *envv) |
… | |
… | |
773 | void |
779 | void |
774 | rxvt_term::init2 (int argc, const char *const *argv) |
780 | rxvt_term::init2 (int argc, const char *const *argv) |
775 | { |
781 | { |
776 | SET_R (this); |
782 | SET_R (this); |
777 | set_locale (""); |
783 | set_locale (""); |
778 | set_environ (envv); // a few things in X do not call setlocale :( |
784 | set_environ (env); // a few things in X do not call setlocale :( |
779 | |
785 | |
780 | init_vars (); |
786 | init_vars (); |
781 | |
787 | |
782 | const char **cmd_argv = init_resources (argc, argv); |
788 | const char **cmd_argv = init_resources (argc, argv); |
783 | |
789 | |
… | |
… | |
950 | |
956 | |
951 | /*----------------------------------------------------------------------*/ |
957 | /*----------------------------------------------------------------------*/ |
952 | void |
958 | void |
953 | rxvt_term::set_locale (const char *locale) |
959 | rxvt_term::set_locale (const char *locale) |
954 | { |
960 | { |
955 | set_environ (envv); |
961 | set_environ (env); |
956 | |
962 | |
957 | free (this->locale); |
963 | free (this->locale); |
958 | this->locale = setlocale (LC_CTYPE, locale); |
964 | this->locale = setlocale (LC_CTYPE, locale); |
959 | |
965 | |
960 | if (!this->locale) |
966 | if (!this->locale) |
… | |
… | |
988 | } |
994 | } |
989 | |
995 | |
990 | void |
996 | void |
991 | rxvt_term::init_xlocale () |
997 | rxvt_term::init_xlocale () |
992 | { |
998 | { |
993 | set_environ (envv); |
999 | set_environ (env); |
994 | |
1000 | |
995 | #if USE_XIM |
1001 | #if USE_XIM |
996 | if (!locale) |
1002 | if (!locale) |
997 | rxvt_warn ("setting locale failed, continuing without locale support.\n"); |
1003 | rxvt_warn ("setting locale failed, continuing without locale support.\n"); |
998 | else |
1004 | else |
… | |
… | |
1050 | run_command (argv); |
1056 | run_command (argv); |
1051 | } |
1057 | } |
1052 | |
1058 | |
1053 | /*----------------------------------------------------------------------*/ |
1059 | /*----------------------------------------------------------------------*/ |
1054 | void |
1060 | void |
1055 | rxvt_term::get_colours () |
1061 | rxvt_term::get_colors () |
1056 | { |
1062 | { |
1057 | int i; |
1063 | int i; |
1058 | |
1064 | |
1059 | #ifdef OFF_FOCUS_FADING |
1065 | #ifdef OFF_FOCUS_FADING |
1060 | pix_colors = pix_colors_focused; |
1066 | pix_colors = pix_colors_focused; |
1061 | #endif |
1067 | #endif |
1062 | |
1068 | |
1063 | for (i = 0; i < (depth <= 2 ? 2 : NRS_COLORS); i++) |
1069 | for (i = 0; i < NRS_COLORS; i++) |
1064 | { |
|
|
1065 | const char *name = rs[Rs_color + i]; |
1070 | if (const char *name = rs[Rs_color + i]) |
1066 | |
|
|
1067 | if (!name) |
|
|
1068 | continue; |
|
|
1069 | |
|
|
1070 | rxvt_color xcol; |
|
|
1071 | |
|
|
1072 | if (!set_color (xcol, name)) |
1071 | set_color (pix_colors [i], name); |
1073 | { |
|
|
1074 | #ifndef XTERM_REVERSE_VIDEO |
|
|
1075 | if (i < 2 && option (Opt_reverseVideo)) |
|
|
1076 | name = def_colorName [1 - i]; |
|
|
1077 | else |
|
|
1078 | #endif |
|
|
1079 | name = def_colorName [i]; |
|
|
1080 | |
|
|
1081 | if (!name) |
|
|
1082 | continue; |
|
|
1083 | |
|
|
1084 | if (!set_color (xcol, name)) |
|
|
1085 | { |
|
|
1086 | switch (i) |
|
|
1087 | { |
|
|
1088 | case Color_fg: |
|
|
1089 | case Color_bg: |
|
|
1090 | rxvt_warn ("unable to get foreground/background colour, continuing.\n"); |
|
|
1091 | name = ""; |
|
|
1092 | break; |
|
|
1093 | #ifndef NO_CURSORCOLOR |
|
|
1094 | case Color_cursor2: |
|
|
1095 | #endif |
|
|
1096 | case Color_pointer_fg: |
|
|
1097 | name = rs[Rs_color + Color_fg]; |
|
|
1098 | xcol.set (this, name); |
|
|
1099 | break; |
|
|
1100 | default: |
|
|
1101 | name = rs[Rs_color + Color_bg]; |
|
|
1102 | xcol.set (this, name); |
|
|
1103 | break; |
|
|
1104 | } |
|
|
1105 | } |
|
|
1106 | } |
|
|
1107 | |
|
|
1108 | pix_colors[i] = xcol; |
|
|
1109 | rs[Rs_color + i] = name; |
|
|
1110 | } |
|
|
1111 | |
|
|
1112 | if (depth <= 2) |
|
|
1113 | { |
|
|
1114 | if (!rs[Rs_color + Color_pointer_fg]) alias_color (Color_pointer_fg, Color_fg); |
|
|
1115 | if (!rs[Rs_color + Color_pointer_bg]) alias_color (Color_pointer_bg, Color_bg); |
|
|
1116 | if (!rs[Rs_color + Color_border] ) alias_color (Color_border, Color_fg); |
|
|
1117 | } |
|
|
1118 | |
1072 | |
1119 | /* |
1073 | /* |
1120 | * get scrollBar shadow colors |
1074 | * get scrollBar shadow colors |
1121 | * |
1075 | * |
1122 | * The calculations of topShadow/bottomShadow values are adapted |
1076 | * The calculations of topShadow/bottomShadow values are adapted |
1123 | * from the fvwm window manager. |
1077 | * from the fvwm window manager. |
1124 | */ |
1078 | */ |
1125 | #ifdef RXVT_SCROLLBAR |
1079 | #ifdef RXVT_SCROLLBAR |
1126 | if (depth <= 2) |
|
|
1127 | { |
|
|
1128 | /* Monochrome */ |
|
|
1129 | alias_color (Color_scroll, Color_fg); |
|
|
1130 | alias_color (Color_topShadow, Color_bg); |
|
|
1131 | alias_color (Color_bottomShadow, Color_bg); |
|
|
1132 | } |
|
|
1133 | else |
|
|
1134 | { |
|
|
1135 | pix_colors [Color_scroll].fade (this, 50, pix_colors [Color_bottomShadow]); |
1080 | pix_colors [Color_scroll].fade (this, 50, pix_colors [Color_bottomShadow]); |
1136 | |
1081 | |
1137 | rgba cscroll; |
1082 | rgba cscroll; |
1138 | pix_colors [Color_scroll].get (cscroll); |
1083 | pix_colors [Color_scroll].get (cscroll); |
1139 | |
1084 | |
1140 | /* topShadowColor */ |
1085 | /* topShadowColor */ |
1141 | if (!pix_colors[Color_topShadow].set (this, |
1086 | if (!pix_colors[Color_topShadow].set (this, |
1142 | rgba ( |
1087 | rgba ( |
1143 | min ((int)rgba::MAX_CC, max (cscroll.r / 5, cscroll.r) * 7 / 5), |
1088 | min ((int)rgba::MAX_CC, max (cscroll.r / 5, cscroll.r) * 7 / 5), |
1144 | min ((int)rgba::MAX_CC, max (cscroll.g / 5, cscroll.g) * 7 / 5), |
1089 | min ((int)rgba::MAX_CC, max (cscroll.g / 5, cscroll.g) * 7 / 5), |
1145 | min ((int)rgba::MAX_CC, max (cscroll.b / 5, cscroll.b) * 7 / 5), |
1090 | min ((int)rgba::MAX_CC, max (cscroll.b / 5, cscroll.b) * 7 / 5), |
1146 | cscroll.a) |
1091 | cscroll.a) |
1147 | )) |
1092 | )) |
1148 | alias_color (Color_topShadow, Color_White); |
1093 | alias_color (Color_topShadow, Color_White); |
1149 | } |
|
|
1150 | #endif |
1094 | #endif |
1151 | |
1095 | |
1152 | #ifdef OFF_FOCUS_FADING |
1096 | #ifdef OFF_FOCUS_FADING |
1153 | for (i = 0; i < (depth <= 2 ? 2 : NRS_COLORS); i++) |
1097 | for (i = 0; i < NRS_COLORS; i++) |
1154 | update_fade_color (i); |
1098 | update_fade_color (i, true); |
1155 | #endif |
1099 | #endif |
1156 | } |
1100 | } |
1157 | |
1101 | |
1158 | /*----------------------------------------------------------------------*/ |
1102 | /*----------------------------------------------------------------------*/ |
1159 | /* color aliases, fg/bg bright-bold */ |
1103 | /* color aliases, fg/bg bright-bold */ |
… | |
… | |
1338 | Window top, parent; |
1282 | Window top, parent; |
1339 | |
1283 | |
1340 | dLocal (Display *, dpy); |
1284 | dLocal (Display *, dpy); |
1341 | |
1285 | |
1342 | /* grab colors before netscape does */ |
1286 | /* grab colors before netscape does */ |
1343 | get_colours (); |
1287 | get_colors (); |
1344 | |
1288 | |
1345 | if (!set_fonts ()) |
1289 | if (!set_fonts ()) |
1346 | rxvt_fatal ("unable to load base fontset, please specify a valid one using -fn, aborting.\n"); |
1290 | rxvt_fatal ("unable to load base fontset, please specify a valid one using -fn, aborting.\n"); |
1347 | |
1291 | |
1348 | parent = display->root; |
1292 | parent = display->root; |
… | |
… | |
1501 | if (rs[Rs_fade]) |
1445 | if (rs[Rs_fade]) |
1502 | pix_colors = pix_colors_unfocused; |
1446 | pix_colors = pix_colors_unfocused; |
1503 | #endif |
1447 | #endif |
1504 | |
1448 | |
1505 | pointer_unblank (); |
1449 | pointer_unblank (); |
1506 | scr_recolour (); |
1450 | scr_recolor (); |
1507 | } |
1451 | } |
1508 | |
1452 | |
1509 | /*----------------------------------------------------------------------*/ |
1453 | /*----------------------------------------------------------------------*/ |
1510 | /* |
1454 | /* |
1511 | * Run the command in a subprocess and return a file descriptor for the |
1455 | * Run the command in a subprocess and return a file descriptor for the |