… | |
… | |
748 | envv->push_back (0); |
748 | envv->push_back (0); |
749 | |
749 | |
750 | this->argv = argv; |
750 | this->argv = argv; |
751 | this->envv = envv; |
751 | this->envv = envv; |
752 | |
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 | |
753 | init2 (argv->size () - 1, argv->begin ()); |
757 | init2 (argv->size () - 1, argv->begin ()); |
754 | } |
758 | } |
755 | |
759 | |
756 | void |
760 | void |
757 | 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) |
… | |
… | |
775 | void |
779 | void |
776 | rxvt_term::init2 (int argc, const char *const *argv) |
780 | rxvt_term::init2 (int argc, const char *const *argv) |
777 | { |
781 | { |
778 | SET_R (this); |
782 | SET_R (this); |
779 | set_locale (""); |
783 | set_locale (""); |
780 | 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 :( |
781 | |
785 | |
782 | init_vars (); |
786 | init_vars (); |
783 | |
787 | |
784 | const char **cmd_argv = init_resources (argc, argv); |
788 | const char **cmd_argv = init_resources (argc, argv); |
785 | |
789 | |
… | |
… | |
952 | |
956 | |
953 | /*----------------------------------------------------------------------*/ |
957 | /*----------------------------------------------------------------------*/ |
954 | void |
958 | void |
955 | rxvt_term::set_locale (const char *locale) |
959 | rxvt_term::set_locale (const char *locale) |
956 | { |
960 | { |
957 | set_environ (envv); |
961 | set_environ (env); |
958 | |
962 | |
959 | free (this->locale); |
963 | free (this->locale); |
960 | this->locale = setlocale (LC_CTYPE, locale); |
964 | this->locale = setlocale (LC_CTYPE, locale); |
961 | |
965 | |
962 | if (!this->locale) |
966 | if (!this->locale) |
… | |
… | |
990 | } |
994 | } |
991 | |
995 | |
992 | void |
996 | void |
993 | rxvt_term::init_xlocale () |
997 | rxvt_term::init_xlocale () |
994 | { |
998 | { |
995 | set_environ (envv); |
999 | set_environ (env); |
996 | |
1000 | |
997 | #if USE_XIM |
1001 | #if USE_XIM |
998 | if (!locale) |
1002 | if (!locale) |
999 | rxvt_warn ("setting locale failed, continuing without locale support.\n"); |
1003 | rxvt_warn ("setting locale failed, continuing without locale support.\n"); |
1000 | else |
1004 | else |
… | |
… | |
1052 | run_command (argv); |
1056 | run_command (argv); |
1053 | } |
1057 | } |
1054 | |
1058 | |
1055 | /*----------------------------------------------------------------------*/ |
1059 | /*----------------------------------------------------------------------*/ |
1056 | void |
1060 | void |
1057 | rxvt_term::get_colours () |
1061 | rxvt_term::get_colors () |
1058 | { |
1062 | { |
1059 | int i; |
1063 | int i; |
1060 | |
1064 | |
1061 | #ifdef OFF_FOCUS_FADING |
1065 | #ifdef OFF_FOCUS_FADING |
1062 | pix_colors = pix_colors_focused; |
1066 | pix_colors = pix_colors_focused; |
1063 | #endif |
1067 | #endif |
1064 | |
1068 | |
1065 | for (i = 0; i < (depth <= 2 ? 2 : NRS_COLORS); i++) |
1069 | for (i = 0; i < NRS_COLORS; i++) |
1066 | { |
1070 | { |
1067 | const char *name = rs[Rs_color + i]; |
1071 | const char *name = rs[Rs_color + i]; |
1068 | |
1072 | |
1069 | if (!name) |
1073 | if (!name) |
1070 | continue; |
1074 | continue; |
… | |
… | |
1080 | #endif |
1084 | #endif |
1081 | name = def_colorName [i]; |
1085 | name = def_colorName [i]; |
1082 | |
1086 | |
1083 | if (!name) |
1087 | if (!name) |
1084 | continue; |
1088 | continue; |
|
|
1089 | |
|
|
1090 | xcol.free (this); |
1085 | |
1091 | |
1086 | if (!set_color (xcol, name)) |
1092 | if (!set_color (xcol, name)) |
1087 | { |
1093 | { |
1088 | switch (i) |
1094 | switch (i) |
1089 | { |
1095 | { |
… | |
… | |
1109 | |
1115 | |
1110 | pix_colors[i] = xcol; |
1116 | pix_colors[i] = xcol; |
1111 | rs[Rs_color + i] = name; |
1117 | rs[Rs_color + i] = name; |
1112 | } |
1118 | } |
1113 | |
1119 | |
1114 | if (depth <= 2) |
|
|
1115 | { |
|
|
1116 | if (!rs[Rs_color + Color_pointer_fg]) alias_color (Color_pointer_fg, Color_fg); |
|
|
1117 | if (!rs[Rs_color + Color_pointer_bg]) alias_color (Color_pointer_bg, Color_bg); |
|
|
1118 | if (!rs[Rs_color + Color_border] ) alias_color (Color_border, Color_fg); |
|
|
1119 | } |
|
|
1120 | |
|
|
1121 | /* |
1120 | /* |
1122 | * get scrollBar shadow colors |
1121 | * get scrollBar shadow colors |
1123 | * |
1122 | * |
1124 | * The calculations of topShadow/bottomShadow values are adapted |
1123 | * The calculations of topShadow/bottomShadow values are adapted |
1125 | * from the fvwm window manager. |
1124 | * from the fvwm window manager. |
1126 | */ |
1125 | */ |
1127 | #ifdef RXVT_SCROLLBAR |
1126 | #ifdef RXVT_SCROLLBAR |
1128 | if (depth <= 2) |
|
|
1129 | { |
|
|
1130 | /* Monochrome */ |
|
|
1131 | alias_color (Color_scroll, Color_fg); |
|
|
1132 | alias_color (Color_topShadow, Color_bg); |
|
|
1133 | alias_color (Color_bottomShadow, Color_bg); |
|
|
1134 | } |
|
|
1135 | else |
|
|
1136 | { |
|
|
1137 | pix_colors [Color_scroll].fade (this, 50, pix_colors [Color_bottomShadow]); |
1127 | pix_colors [Color_scroll].fade (this, 50, pix_colors [Color_bottomShadow]); |
1138 | |
1128 | |
1139 | rgba cscroll; |
1129 | rgba cscroll; |
1140 | pix_colors [Color_scroll].get (cscroll); |
1130 | pix_colors [Color_scroll].get (cscroll); |
1141 | |
1131 | |
1142 | /* topShadowColor */ |
1132 | /* topShadowColor */ |
1143 | if (!pix_colors[Color_topShadow].set (this, |
1133 | if (!pix_colors[Color_topShadow].set (this, |
1144 | rgba ( |
1134 | rgba ( |
1145 | min ((int)rgba::MAX_CC, max (cscroll.r / 5, cscroll.r) * 7 / 5), |
1135 | min ((int)rgba::MAX_CC, max (cscroll.r / 5, cscroll.r) * 7 / 5), |
1146 | min ((int)rgba::MAX_CC, max (cscroll.g / 5, cscroll.g) * 7 / 5), |
1136 | min ((int)rgba::MAX_CC, max (cscroll.g / 5, cscroll.g) * 7 / 5), |
1147 | min ((int)rgba::MAX_CC, max (cscroll.b / 5, cscroll.b) * 7 / 5), |
1137 | min ((int)rgba::MAX_CC, max (cscroll.b / 5, cscroll.b) * 7 / 5), |
1148 | cscroll.a) |
1138 | cscroll.a) |
1149 | )) |
1139 | )) |
1150 | alias_color (Color_topShadow, Color_White); |
1140 | alias_color (Color_topShadow, Color_White); |
1151 | } |
|
|
1152 | #endif |
1141 | #endif |
1153 | |
1142 | |
1154 | #ifdef OFF_FOCUS_FADING |
1143 | #ifdef OFF_FOCUS_FADING |
1155 | for (i = 0; i < (depth <= 2 ? 2 : NRS_COLORS); i++) |
1144 | for (i = 0; i < NRS_COLORS; i++) |
1156 | update_fade_color (i); |
1145 | update_fade_color (i, true); |
1157 | #endif |
1146 | #endif |
1158 | } |
1147 | } |
1159 | |
1148 | |
1160 | /*----------------------------------------------------------------------*/ |
1149 | /*----------------------------------------------------------------------*/ |
1161 | /* color aliases, fg/bg bright-bold */ |
1150 | /* color aliases, fg/bg bright-bold */ |
… | |
… | |
1210 | for (j = map->max_keypermod; j--; k++) |
1199 | for (j = map->max_keypermod; j--; k++) |
1211 | { |
1200 | { |
1212 | if (kc[k] == 0) |
1201 | if (kc[k] == 0) |
1213 | break; |
1202 | break; |
1214 | |
1203 | |
1215 | switch (XKeycodeToKeysym (dpy, kc[k], 0)) |
1204 | switch (rxvt_XKeycodeToKeysym (dpy, kc[k], 0)) |
1216 | { |
1205 | { |
1217 | case XK_Num_Lock: |
1206 | case XK_Num_Lock: |
1218 | ModNumLockMask = modmasks[i - 1]; |
1207 | ModNumLockMask = modmasks[i - 1]; |
1219 | continue; |
1208 | continue; |
1220 | |
1209 | |
… | |
… | |
1340 | Window top, parent; |
1329 | Window top, parent; |
1341 | |
1330 | |
1342 | dLocal (Display *, dpy); |
1331 | dLocal (Display *, dpy); |
1343 | |
1332 | |
1344 | /* grab colors before netscape does */ |
1333 | /* grab colors before netscape does */ |
1345 | get_colours (); |
1334 | get_colors (); |
1346 | |
1335 | |
1347 | if (!set_fonts ()) |
1336 | if (!set_fonts ()) |
1348 | rxvt_fatal ("unable to load base fontset, please specify a valid one using -fn, aborting.\n"); |
1337 | rxvt_fatal ("unable to load base fontset, please specify a valid one using -fn, aborting.\n"); |
1349 | |
1338 | |
1350 | parent = display->root; |
1339 | parent = display->root; |
… | |
… | |
1503 | if (rs[Rs_fade]) |
1492 | if (rs[Rs_fade]) |
1504 | pix_colors = pix_colors_unfocused; |
1493 | pix_colors = pix_colors_unfocused; |
1505 | #endif |
1494 | #endif |
1506 | |
1495 | |
1507 | pointer_unblank (); |
1496 | pointer_unblank (); |
1508 | scr_recolour (); |
1497 | scr_recolor (); |
1509 | } |
1498 | } |
1510 | |
1499 | |
1511 | /*----------------------------------------------------------------------*/ |
1500 | /*----------------------------------------------------------------------*/ |
1512 | /* |
1501 | /* |
1513 | * Run the command in a subprocess and return a file descriptor for the |
1502 | * Run the command in a subprocess and return a file descriptor for the |