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.336 by sf-exg, Wed Sep 3 18:20:37 2014 UTC vs.
Revision 1.340 by root, Sat Dec 13 12:24:32 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;
1078#endif 1084#endif
1079 name = def_colorName [i]; 1085 name = def_colorName [i];
1080 1086
1081 if (!name) 1087 if (!name)
1082 continue; 1088 continue;
1089
1090 xcol.free (this);
1083 1091
1084 if (!set_color (xcol, name)) 1092 if (!set_color (xcol, name))
1085 { 1093 {
1086 switch (i) 1094 switch (i)
1087 { 1095 {
1107 1115
1108 pix_colors[i] = xcol; 1116 pix_colors[i] = xcol;
1109 rs[Rs_color + i] = name; 1117 rs[Rs_color + i] = name;
1110 } 1118 }
1111 1119
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
1119 /* 1120 /*
1120 * get scrollBar shadow colors 1121 * get scrollBar shadow colors
1121 * 1122 *
1122 * The calculations of topShadow/bottomShadow values are adapted 1123 * The calculations of topShadow/bottomShadow values are adapted
1123 * from the fvwm window manager. 1124 * from the fvwm window manager.
1124 */ 1125 */
1125#ifdef RXVT_SCROLLBAR 1126#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]); 1127 pix_colors [Color_scroll].fade (this, 50, pix_colors [Color_bottomShadow]);
1136 1128
1137 rgba cscroll; 1129 rgba cscroll;
1138 pix_colors [Color_scroll].get (cscroll); 1130 pix_colors [Color_scroll].get (cscroll);
1139 1131
1140 /* topShadowColor */ 1132 /* topShadowColor */
1141 if (!pix_colors[Color_topShadow].set (this, 1133 if (!pix_colors[Color_topShadow].set (this,
1142 rgba ( 1134 rgba (
1143 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),
1144 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),
1145 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),
1146 cscroll.a) 1138 cscroll.a)
1147 )) 1139 ))
1148 alias_color (Color_topShadow, Color_White); 1140 alias_color (Color_topShadow, Color_White);
1149 }
1150#endif 1141#endif
1151 1142
1152#ifdef OFF_FOCUS_FADING 1143#ifdef OFF_FOCUS_FADING
1153 for (i = 0; i < (depth <= 2 ? 2 : NRS_COLORS); i++) 1144 for (i = 0; i < NRS_COLORS; i++)
1154 update_fade_color (i); 1145 update_fade_color (i, true);
1155#endif 1146#endif
1156} 1147}
1157 1148
1158/*----------------------------------------------------------------------*/ 1149/*----------------------------------------------------------------------*/
1159/* color aliases, fg/bg bright-bold */ 1150/* color aliases, fg/bg bright-bold */
1208 for (j = map->max_keypermod; j--; k++) 1199 for (j = map->max_keypermod; j--; k++)
1209 { 1200 {
1210 if (kc[k] == 0) 1201 if (kc[k] == 0)
1211 break; 1202 break;
1212 1203
1213 switch (XKeycodeToKeysym (dpy, kc[k], 0)) 1204 switch (rxvt_XKeycodeToKeysym (dpy, kc[k], 0))
1214 { 1205 {
1215 case XK_Num_Lock: 1206 case XK_Num_Lock:
1216 ModNumLockMask = modmasks[i - 1]; 1207 ModNumLockMask = modmasks[i - 1];
1217 continue; 1208 continue;
1218 1209
1338 Window top, parent; 1329 Window top, parent;
1339 1330
1340 dLocal (Display *, dpy); 1331 dLocal (Display *, dpy);
1341 1332
1342 /* grab colors before netscape does */ 1333 /* grab colors before netscape does */
1343 get_colours (); 1334 get_colors ();
1344 1335
1345 if (!set_fonts ()) 1336 if (!set_fonts ())
1346 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");
1347 1338
1348 parent = display->root; 1339 parent = display->root;
1501 if (rs[Rs_fade]) 1492 if (rs[Rs_fade])
1502 pix_colors = pix_colors_unfocused; 1493 pix_colors = pix_colors_unfocused;
1503#endif 1494#endif
1504 1495
1505 pointer_unblank (); 1496 pointer_unblank ();
1506 scr_recolour (); 1497 scr_recolor ();
1507} 1498}
1508 1499
1509/*----------------------------------------------------------------------*/ 1500/*----------------------------------------------------------------------*/
1510/* 1501/*
1511 * 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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines