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.331 by root, Tue Dec 10 19:47:14 2013 UTC vs.
Revision 1.342 by root, Mon Dec 15 02:04:02 2014 UTC

14 * - extensive modifications 14 * - extensive modifications
15 * Copyright (c) 2003-2008 Marc Lehmann <schmorp@schmorp.de> 15 * Copyright (c) 2003-2008 Marc Lehmann <schmorp@schmorp.de>
16 * 16 *
17 * This program is free software; you can redistribute it and/or modify 17 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License as published by 18 * it under the terms of the GNU General Public License as published by
19 * the Free Software Foundation; either version 2 of the License, or 19 * the Free Software Foundation; either version 3 of the License, or
20 * (at your option) any later version. 20 * (at your option) any later version.
21 * 21 *
22 * This program is distributed in the hope that it will be useful, 22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of 23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
660 pointerBlankDelay = i; 660 pointerBlankDelay = i;
661 else 661 else
662 pointerBlankDelay = 2; 662 pointerBlankDelay = 2;
663#endif 663#endif
664 664
665 if (rs[Rs_multiClickTime] && (i = atoi (rs[Rs_multiClickTime])) >= 0)
666 multiClickTime = i;
667 else
668 multiClickTime = 500;
669
670 cursor_type = option (Opt_cursorUnderline) ? 1 : 0;
671
665 /* no point having a scrollbar without having any scrollback! */ 672 /* no point having a scrollbar without having any scrollback! */
666 if (!saveLines) 673 if (!saveLines)
667 set_option (Opt_scrollBar, 0); 674 set_option (Opt_scrollBar, 0);
668 675
669 if (!rs[Rs_cutchars]) 676 if (!rs[Rs_cutchars])
741 envv->push_back (0); 748 envv->push_back (0);
742 749
743 this->argv = argv; 750 this->argv = argv;
744 this->envv = envv; 751 this->envv = envv;
745 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
746 init2 (argv->size () - 1, argv->begin ()); 757 init2 (argv->size () - 1, argv->begin ());
747} 758}
748 759
749void 760void
750rxvt_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)
768void 779void
769rxvt_term::init2 (int argc, const char *const *argv) 780rxvt_term::init2 (int argc, const char *const *argv)
770{ 781{
771 SET_R (this); 782 SET_R (this);
772 set_locale (""); 783 set_locale ("");
773 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 :(
774 785
775 init_vars (); 786 init_vars ();
776 787
777 const char **cmd_argv = init_resources (argc, argv); 788 const char **cmd_argv = init_resources (argc, argv);
778 789
945 956
946/*----------------------------------------------------------------------*/ 957/*----------------------------------------------------------------------*/
947void 958void
948rxvt_term::set_locale (const char *locale) 959rxvt_term::set_locale (const char *locale)
949{ 960{
950 set_environ (envv); 961 set_environ (env);
951 962
952 free (this->locale); 963 free (this->locale);
953 this->locale = setlocale (LC_CTYPE, locale); 964 this->locale = setlocale (LC_CTYPE, locale);
954 965
955 if (!this->locale) 966 if (!this->locale)
983} 994}
984 995
985void 996void
986rxvt_term::init_xlocale () 997rxvt_term::init_xlocale ()
987{ 998{
988 set_environ (envv); 999 set_environ (env);
989 1000
990#if USE_XIM 1001#if USE_XIM
991 if (!locale) 1002 if (!locale)
992 rxvt_warn ("setting locale failed, continuing without locale support.\n"); 1003 rxvt_warn ("setting locale failed, continuing without locale support.\n");
993 else 1004 else
1045 run_command (argv); 1056 run_command (argv);
1046} 1057}
1047 1058
1048/*----------------------------------------------------------------------*/ 1059/*----------------------------------------------------------------------*/
1049void 1060void
1050rxvt_term::get_colours () 1061rxvt_term::get_colors ()
1051{ 1062{
1052 int i; 1063 int i;
1053 1064
1054#ifdef OFF_FOCUS_FADING 1065#ifdef OFF_FOCUS_FADING
1055 pix_colors = pix_colors_focused; 1066 pix_colors = pix_colors_focused;
1056#endif 1067#endif
1057 1068
1058 for (i = 0; i < (depth <= 2 ? 2 : NRS_COLORS); i++) 1069 for (i = 0; i < NRS_COLORS; i++)
1059 {
1060 const char *name = rs[Rs_color + i]; 1070 if (const char *name = rs[Rs_color + i])
1061
1062 if (!name)
1063 continue;
1064
1065 rxvt_color xcol;
1066
1067 if (!set_color (xcol, name)) 1071 set_color (pix_colors [i], name);
1068 {
1069#ifndef XTERM_REVERSE_VIDEO
1070 if (i < 2 && option (Opt_reverseVideo))
1071 name = def_colorName [1 - i];
1072 else
1073#endif
1074 name = def_colorName [i];
1075
1076 if (!name)
1077 continue;
1078
1079 if (!set_color (xcol, name))
1080 {
1081 switch (i)
1082 {
1083 case Color_fg:
1084 case Color_bg:
1085 rxvt_warn ("unable to get foreground/background colour, continuing.\n");
1086 name = "";
1087 break;
1088#ifndef NO_CURSORCOLOR
1089 case Color_cursor2:
1090#endif
1091 case Color_pointer_fg:
1092 name = rs[Rs_color + Color_fg];
1093 xcol.set (this, name);
1094 break;
1095 default:
1096 name = rs[Rs_color + Color_bg];
1097 xcol.set (this, name);
1098 break;
1099 }
1100 }
1101 }
1102
1103 pix_colors[i] = xcol;
1104 rs[Rs_color + i] = name;
1105 }
1106
1107 if (depth <= 2)
1108 {
1109 if (!rs[Rs_color + Color_pointer_fg]) alias_color (Color_pointer_fg, Color_fg);
1110 if (!rs[Rs_color + Color_pointer_bg]) alias_color (Color_pointer_bg, Color_bg);
1111 if (!rs[Rs_color + Color_border] ) alias_color (Color_border, Color_fg);
1112 }
1113 1072
1114 /* 1073 /*
1115 * get scrollBar shadow colors 1074 * get scrollBar shadow colors
1116 * 1075 *
1117 * The calculations of topShadow/bottomShadow values are adapted 1076 * The calculations of topShadow/bottomShadow values are adapted
1118 * from the fvwm window manager. 1077 * from the fvwm window manager.
1119 */ 1078 */
1120#ifdef RXVT_SCROLLBAR 1079#ifdef RXVT_SCROLLBAR
1121 if (depth <= 2)
1122 {
1123 /* Monochrome */
1124 alias_color (Color_scroll, Color_fg);
1125 alias_color (Color_topShadow, Color_bg);
1126 alias_color (Color_bottomShadow, Color_bg);
1127 }
1128 else
1129 {
1130 pix_colors [Color_scroll].fade (this, 50, pix_colors [Color_bottomShadow]); 1080 pix_colors [Color_scroll].fade (this, 50, pix_colors [Color_bottomShadow]);
1131 1081
1132 rgba cscroll; 1082 rgba cscroll;
1133 pix_colors [Color_scroll].get (cscroll); 1083 pix_colors [Color_scroll].get (cscroll);
1134 1084
1135 /* topShadowColor */ 1085 /* topShadowColor */
1136 if (!pix_colors[Color_topShadow].set (this, 1086 if (!pix_colors[Color_topShadow].set (this,
1137 rgba ( 1087 rgba (
1138 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),
1139 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),
1140 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),
1141 cscroll.a) 1091 cscroll.a)
1142 )) 1092 ))
1143 alias_color (Color_topShadow, Color_White); 1093 alias_color (Color_topShadow, Color_White);
1144 }
1145#endif 1094#endif
1146 1095
1147#ifdef OFF_FOCUS_FADING 1096#ifdef OFF_FOCUS_FADING
1148 for (i = 0; i < (depth <= 2 ? 2 : NRS_COLORS); i++) 1097 for (i = 0; i < NRS_COLORS; i++)
1149 update_fade_color (i); 1098 update_fade_color (i, true);
1150#endif 1099#endif
1151} 1100}
1152 1101
1153/*----------------------------------------------------------------------*/ 1102/*----------------------------------------------------------------------*/
1154/* color aliases, fg/bg bright-bold */ 1103/* color aliases, fg/bg bright-bold */
1203 for (j = map->max_keypermod; j--; k++) 1152 for (j = map->max_keypermod; j--; k++)
1204 { 1153 {
1205 if (kc[k] == 0) 1154 if (kc[k] == 0)
1206 break; 1155 break;
1207 1156
1208 switch (XKeycodeToKeysym (dpy, kc[k], 0)) 1157 switch (rxvt_XKeycodeToKeysym (dpy, kc[k], 0))
1209 { 1158 {
1210 case XK_Num_Lock: 1159 case XK_Num_Lock:
1211 ModNumLockMask = modmasks[i - 1]; 1160 ModNumLockMask = modmasks[i - 1];
1212 continue; 1161 continue;
1213 1162
1333 Window top, parent; 1282 Window top, parent;
1334 1283
1335 dLocal (Display *, dpy); 1284 dLocal (Display *, dpy);
1336 1285
1337 /* grab colors before netscape does */ 1286 /* grab colors before netscape does */
1338 get_colours (); 1287 get_colors ();
1339 1288
1340 if (!set_fonts ()) 1289 if (!set_fonts ())
1341 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");
1342 1291
1343 parent = display->root; 1292 parent = display->root;
1396 classHint.res_name = (char *)rs[Rs_name]; 1345 classHint.res_name = (char *)rs[Rs_name];
1397 classHint.res_class = (char *)RESCLASS; 1346 classHint.res_class = (char *)RESCLASS;
1398 1347
1399 wmHint.flags = InputHint | StateHint | WindowGroupHint; 1348 wmHint.flags = InputHint | StateHint | WindowGroupHint;
1400 wmHint.input = True; 1349 wmHint.input = True;
1401 wmHint.initial_state = option (Opt_iconic) ? IconicState : NormalState; 1350 wmHint.initial_state = option (Opt_iconic) ? IconicState
1351 : option (Opt_dockapp) ? WithdrawnState
1352 : NormalState;
1402 wmHint.window_group = top; 1353 wmHint.window_group = top;
1403 1354
1404 XmbSetWMProperties (dpy, top, NULL, NULL, (char **)argv, argc, 1355 XmbSetWMProperties (dpy, top, NULL, NULL, (char **)argv, argc,
1405 &szHint, &wmHint, &classHint); 1356 &szHint, &wmHint, &classHint);
1406#if ENABLE_EWMH 1357#if ENABLE_EWMH
1494 if (rs[Rs_fade]) 1445 if (rs[Rs_fade])
1495 pix_colors = pix_colors_unfocused; 1446 pix_colors = pix_colors_unfocused;
1496#endif 1447#endif
1497 1448
1498 pointer_unblank (); 1449 pointer_unblank ();
1499 scr_recolour (); 1450 scr_recolor ();
1500} 1451}
1501 1452
1502/*----------------------------------------------------------------------*/ 1453/*----------------------------------------------------------------------*/
1503/* 1454/*
1504 * 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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines