ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/init.C
(Generate patch)

Comparing rxvt-unicode/src/init.C (file contents):
Revision 1.337 by sf-exg, Fri Sep 5 19:02:53 2014 UTC vs.
Revision 1.341 by root, Mon Dec 15 00:51:06 2014 UTC

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
754void 760void
755rxvt_term::init (int argc, const char *const *argv, const char *const *envv) 761rxvt_term::init (int argc, const char *const *argv, const char *const *envv)
773void 779void
774rxvt_term::init2 (int argc, const char *const *argv) 780rxvt_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/*----------------------------------------------------------------------*/
952void 958void
953rxvt_term::set_locale (const char *locale) 959rxvt_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
990void 996void
991rxvt_term::init_xlocale () 997rxvt_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/*----------------------------------------------------------------------*/
1054void 1060void
1055rxvt_term::get_colours () 1061rxvt_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 { 1070 {
1065 const char *name = rs[Rs_color + i]; 1071 const char *name = rs[Rs_color + i];
1066 1072
1067 if (!name) 1073 if (!name)
1068 continue; 1074 continue;
1069 1075
1070 rxvt_color xcol;
1071
1072 if (!set_color (xcol, name)) 1076 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 } 1077 }
1118 1078
1119 /* 1079 /*
1120 * get scrollBar shadow colors 1080 * get scrollBar shadow colors
1121 * 1081 *
1122 * The calculations of topShadow/bottomShadow values are adapted 1082 * The calculations of topShadow/bottomShadow values are adapted
1123 * from the fvwm window manager. 1083 * from the fvwm window manager.
1124 */ 1084 */
1125#ifdef RXVT_SCROLLBAR 1085#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]); 1086 pix_colors [Color_scroll].fade (this, 50, pix_colors [Color_bottomShadow]);
1136 1087
1137 rgba cscroll; 1088 rgba cscroll;
1138 pix_colors [Color_scroll].get (cscroll); 1089 pix_colors [Color_scroll].get (cscroll);
1139 1090
1140 /* topShadowColor */ 1091 /* topShadowColor */
1141 if (!pix_colors[Color_topShadow].set (this, 1092 if (!pix_colors[Color_topShadow].set (this,
1142 rgba ( 1093 rgba (
1143 min ((int)rgba::MAX_CC, max (cscroll.r / 5, cscroll.r) * 7 / 5), 1094 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), 1095 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), 1096 min ((int)rgba::MAX_CC, max (cscroll.b / 5, cscroll.b) * 7 / 5),
1146 cscroll.a) 1097 cscroll.a)
1147 )) 1098 ))
1148 alias_color (Color_topShadow, Color_White); 1099 alias_color (Color_topShadow, Color_White);
1149 }
1150#endif 1100#endif
1151 1101
1152#ifdef OFF_FOCUS_FADING 1102#ifdef OFF_FOCUS_FADING
1153 for (i = 0; i < (depth <= 2 ? 2 : NRS_COLORS); i++) 1103 for (i = 0; i < NRS_COLORS; i++)
1154 update_fade_color (i); 1104 update_fade_color (i, true);
1155#endif 1105#endif
1156} 1106}
1157 1107
1158/*----------------------------------------------------------------------*/ 1108/*----------------------------------------------------------------------*/
1159/* color aliases, fg/bg bright-bold */ 1109/* color aliases, fg/bg bright-bold */
1338 Window top, parent; 1288 Window top, parent;
1339 1289
1340 dLocal (Display *, dpy); 1290 dLocal (Display *, dpy);
1341 1291
1342 /* grab colors before netscape does */ 1292 /* grab colors before netscape does */
1343 get_colours (); 1293 get_colors ();
1344 1294
1345 if (!set_fonts ()) 1295 if (!set_fonts ())
1346 rxvt_fatal ("unable to load base fontset, please specify a valid one using -fn, aborting.\n"); 1296 rxvt_fatal ("unable to load base fontset, please specify a valid one using -fn, aborting.\n");
1347 1297
1348 parent = display->root; 1298 parent = display->root;
1501 if (rs[Rs_fade]) 1451 if (rs[Rs_fade])
1502 pix_colors = pix_colors_unfocused; 1452 pix_colors = pix_colors_unfocused;
1503#endif 1453#endif
1504 1454
1505 pointer_unblank (); 1455 pointer_unblank ();
1506 scr_recolour (); 1456 scr_recolor ();
1507} 1457}
1508 1458
1509/*----------------------------------------------------------------------*/ 1459/*----------------------------------------------------------------------*/
1510/* 1460/*
1511 * Run the command in a subprocess and return a file descriptor for the 1461 * Run the command in a subprocess and return a file descriptor for the

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines