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.26 by pcg, Fri Feb 13 12:16:21 2004 UTC vs.
Revision 1.39 by pcg, Sun Mar 14 17:33:07 2004 UTC

9 * - extensive modifications 9 * - extensive modifications
10 * Copyright (c) 1998-2001 Geoff Wing <gcw@pobox.com> 10 * Copyright (c) 1998-2001 Geoff Wing <gcw@pobox.com>
11 * - extensive modifications 11 * - extensive modifications
12 * Copyright (c) 1999 D J Hawkey Jr <hawkeyd@visi.com> 12 * Copyright (c) 1999 D J Hawkey Jr <hawkeyd@visi.com>
13 * - QNX support 13 * - QNX support
14 * Copyright (c) 2003-2004 Marc Lehmann <pcg@goof.com>
14 * 15 *
15 * This program is free software; you can redistribute it and/or modify 16 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by 17 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or 18 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version. 19 * (at your option) any later version.
393 394
394#ifndef NO_BRIGHTCOLOR 395#ifndef NO_BRIGHTCOLOR
395 colorfgbg = DEFAULT_RSTYLE; 396 colorfgbg = DEFAULT_RSTYLE;
396#endif 397#endif
397 398
398#if defined (HOTKEY_CTRL) || defined (HOTKEY_META)
399 ks_bigfont = XK_greater;
400 ks_smallfont = XK_less;
401#endif
402
403#ifdef GREEK_SUPPORT
404 ks_greekmodeswith = GREEK_KEYBOARD_MODESWITCH;
405#endif
406
407 refresh_limit = 1; 399 refresh_limit = 1;
408 refresh_type = SLOW_REFRESH; 400 refresh_type = SLOW_REFRESH;
409 prev_nrow = prev_ncol = 0; 401 prev_nrow = prev_ncol = 0;
410#ifdef MULTICHAR_SET
411# ifdef MULTICHAR_ENCODING
412 encoding_method = MULTICHAR_ENCODING;
413# endif
414 multichar_decode = rxvt_euc2jis;
415#endif
416 402
417 oldcursor.row = oldcursor.col = -1; 403 oldcursor.row = oldcursor.col = -1;
418#ifdef XPM_BACKGROUND 404#ifdef XPM_BACKGROUND
419 /* bgPixmap.w = bgPixmap.h = 0; */ 405 /* bgPixmap.w = bgPixmap.h = 0; */
420 bgPixmap.x = bgPixmap.y = 50; 406 bgPixmap.x = bgPixmap.y = 50;
601#endif 587#endif
602 588
603 if (!rs[Rs_cutchars]) 589 if (!rs[Rs_cutchars])
604 rs[Rs_cutchars] = CUTCHARS; 590 rs[Rs_cutchars] = CUTCHARS;
605 591
606#ifdef ACS_ASCII
607 if (!rs[Rs_acs_chars])
608 rs[Rs_acs_chars] = ACS_CHARS;
609 if ((i = STRLEN (rs[Rs_acs_chars])) < 0x20)
610 {
611 val = rxvt_realloc ((void *)rs[Rs_acs_chars], 0x20);
612 for (; i < 0x20; )
613 val[i] = ' ';
614 rs[Rs_acs_chars] = val;
615 }
616#endif
617
618#ifndef NO_BACKSPACE_KEY 592#ifndef NO_BACKSPACE_KEY
619 if (!rs[Rs_backspace_key]) 593 if (!rs[Rs_backspace_key])
620# ifdef DEFAULT_BACKSPACE 594# ifdef DEFAULT_BACKSPACE
621 key_backspace = DEFAULT_BACKSPACE; 595 key_backspace = DEFAULT_BACKSPACE;
622# else 596# else
666 640
667#ifdef HAVE_SCROLLBARS 641#ifdef HAVE_SCROLLBARS
668 setup_scrollbar (rs[Rs_scrollBar_align], rs[Rs_scrollstyle], 642 setup_scrollbar (rs[Rs_scrollBar_align], rs[Rs_scrollstyle],
669 rs[Rs_scrollBar_thickness]); 643 rs[Rs_scrollBar_thickness]);
670#endif 644#endif
671
672 TermWin.fontset = new rxvt_fontset (this);
673 TermWin.fontset->populate (rs[Rs_font]);
674 TermWin.fwidth = TermWin.fontset->base_font ()->width;
675 TermWin.fheight = TermWin.fontset->base_font ()->height;
676 TermWin.fbase = TermWin.fontset->base_font ()->ascent;
677 645
678#ifdef XTERM_REVERSE_VIDEO 646#ifdef XTERM_REVERSE_VIDEO
679 /* this is how xterm implements reverseVideo */ 647 /* this is how xterm implements reverseVideo */
680 if (Options & Opt_reverseVideo) 648 if (Options & Opt_reverseVideo)
681 { 649 {
762 * @ DISPLAY: in case we started with -display 730 * @ DISPLAY: in case we started with -display
763 * @ WINDOWID: X window id number of the window 731 * @ WINDOWID: X window id number of the window
764 * @ COLORTERM: terminal sub-name and also indicates its color 732 * @ COLORTERM: terminal sub-name and also indicates its color
765 * @ TERM: terminal name 733 * @ TERM: terminal name
766 * @ TERMINFO: path to terminfo directory 734 * @ TERMINFO: path to terminfo directory
735 * @ COLORFGBG: fg;bg color codes
767 */ 736 */
768 putenv (env_display); 737 putenv (env_display);
769 putenv (env_windowid); 738 putenv (env_windowid);
739 if (env_colorfgbg)
740 putenv (env_colorfgbg);
770 741
771#ifdef RXVT_TERMINFO 742#ifdef RXVT_TERMINFO
772 putenv ("TERMINFO=" RXVT_TERMINFO); 743 putenv ("TERMINFO=" RXVT_TERMINFO);
773#endif 744#endif
774 745
802void 773void
803rxvt_term::set_locale (const char *locale) 774rxvt_term::set_locale (const char *locale)
804{ 775{
805#if HAVE_XSETLOCALE || HAVE_SETLOCALE 776#if HAVE_XSETLOCALE || HAVE_SETLOCALE
806 free (this->locale); 777 free (this->locale);
807 this->locale = rxvt_strdup (setlocale (LC_CTYPE, "")); 778 this->locale = rxvt_strdup (setlocale (LC_CTYPE, locale));
779 SET_LOCALE (this->locale);
780 mbstate.reset ();
808#endif 781#endif
809#if HAVE_NL_LANGINFO 782#if HAVE_NL_LANGINFO
810 free (codeset); 783 free (codeset);
811 codeset = strdup (nl_langinfo (CODESET)); 784 codeset = strdup (nl_langinfo (CODESET));
812 enc_utf8 = !STRCASECMP (codeset, "UTF-8") 785 enc_utf8 = !STRCASECMP (codeset, "UTF-8")
894 if (menubar_visible ()) 867 if (menubar_visible ())
895 { 868 {
896 PrivateModes |= PrivMode_menuBar; 869 PrivateModes |= PrivMode_menuBar;
897 SavedModes |= PrivMode_menuBar; 870 SavedModes |= PrivMode_menuBar;
898 } 871 }
899
900#ifdef GREEK_SUPPORT
901 greek_init ();
902#endif
903 872
904#ifdef CURSOR_BLINK 873#ifdef CURSOR_BLINK
905 if (Options & Opt_cursorBlink) 874 if (Options & Opt_cursorBlink)
906 (void)gettimeofday (&lastcursorchange, NULL); 875 (void)gettimeofday (&lastcursorchange, NULL);
907#endif 876#endif
1139 } 1108 }
1140 1109
1141 /* grab colors before netscape does */ 1110 /* grab colors before netscape does */
1142 Get_Colours (); 1111 Get_Colours ();
1143 1112
1144 change_font (1, NULL); 1113 if (!change_font (rs[Rs_font]))
1114 {
1115 fprintf (stderr, "unable to load a base font, please provide one using -fn fontname\n");
1116 destroy ();
1117 return;
1118 }
1119
1145 window_calc (0, 0); 1120 window_calc (0, 0);
1146 old_width = szHint.width; 1121 old_width = szHint.width;
1147 old_height = szHint.height; 1122 old_height = szHint.height;
1148 1123
1149 /* parent window - reverse video so we can see placement errors 1124 /* parent window - reverse video so we can see placement errors
1175 1150
1176 xterm_seq (XTerm_title, rs[Rs_title], CHAR_ST); 1151 xterm_seq (XTerm_title, rs[Rs_title], CHAR_ST);
1177 xterm_seq (XTerm_iconName, rs[Rs_iconName], CHAR_ST); 1152 xterm_seq (XTerm_iconName, rs[Rs_iconName], CHAR_ST);
1178 1153
1179 classHint.res_name = (char *)rs[Rs_name]; 1154 classHint.res_name = (char *)rs[Rs_name];
1180 classHint.res_class = (char *)APL_CLASS; 1155 classHint.res_class = (char *)RESCLASS;
1181 1156
1182 wmHint.flags = (InputHint | StateHint | WindowGroupHint); 1157 wmHint.flags = (InputHint | StateHint | WindowGroupHint);
1183 wmHint.input = True; 1158 wmHint.input = True;
1184 wmHint.initial_state = (Options & Opt_iconic ? IconicState 1159 wmHint.initial_state = (Options & Opt_iconic ? IconicState
1185 : NormalState); 1160 : NormalState);
1248 1223
1249#if defined(MENUBAR) && (MENUBAR_MAX > 1) 1224#if defined(MENUBAR) && (MENUBAR_MAX > 1)
1250 if (menuBar_height ()) 1225 if (menuBar_height ())
1251 { 1226 {
1252 menuBar.win = XCreateSimpleWindow (display->display, TermWin.parent[0], 1227 menuBar.win = XCreateSimpleWindow (display->display, TermWin.parent[0],
1253 window_vt_x, 0, 1228 window_vt_x, 0,
1254 TermWin_TotalWidth (), 1229 TermWin_TotalWidth (),
1255 menuBar_TotalHeight (), 1230 menuBar_TotalHeight (),
1256 0, 1231 0,
1257 PixColors[Color_fg], 1232 PixColors[Color_fg],
1258 PixColors[Color_scroll]); 1233 PixColors[Color_scroll]);
1234
1259#ifdef DEBUG_X 1235#ifdef DEBUG_X
1260 XStoreName (display->display, menuBar.win, "menubar"); 1236 XStoreName (display->display, menuBar.win, "menubar");
1261#endif 1237#endif
1262 1238
1239 menuBar.drawable = new rxvt_drawable (display, menuBar.win);
1240
1263 XDefineCursor (display->display, menuBar.win, pointer_leftptr); 1241 XDefineCursor (display->display, menuBar.win,
1242 XCreateFontCursor (display->display, XC_left_ptr));
1264 1243
1265 XSelectInput (display->display, menuBar.win, 1244 XSelectInput (display->display, menuBar.win,
1266 (ExposureMask | ButtonPressMask | ButtonReleaseMask 1245 (ExposureMask | ButtonPressMask | ButtonReleaseMask
1267 | Button1MotionMask)); 1246 | Button1MotionMask));
1268 menubar_ev.start (display, menuBar.win); 1247 menubar_ev.start (display, menuBar.win);
1291 gcvalue.graphics_exposures = 1; 1270 gcvalue.graphics_exposures = 1;
1292 TermWin.gc = XCreateGC (display->display, TermWin.vt, 1271 TermWin.gc = XCreateGC (display->display, TermWin.vt,
1293 GCForeground | GCBackground 1272 GCForeground | GCBackground
1294 | GCGraphicsExposures, &gcvalue); 1273 | GCGraphicsExposures, &gcvalue);
1295 1274
1275 TermWin.drawable = new rxvt_drawable (display, TermWin.vt);
1276
1296#if defined(MENUBAR) || defined(RXVT_SCROLLBAR) 1277#if defined(MENUBAR) || defined(RXVT_SCROLLBAR)
1297 gcvalue.foreground = PixColors[Color_topShadow]; 1278 gcvalue.foreground = PixColors[Color_topShadow];
1298 topShadowGC = XCreateGC (display->display, TermWin.vt, 1279 topShadowGC = XCreateGC (display->display, TermWin.vt, GCForeground, &gcvalue);
1299 GCForeground, &gcvalue);
1300 gcvalue.foreground = PixColors[Color_bottomShadow]; 1280 gcvalue.foreground = PixColors[Color_bottomShadow];
1301 botShadowGC = XCreateGC (display->display, TermWin.vt, 1281 botShadowGC = XCreateGC (display->display, TermWin.vt, GCForeground, &gcvalue);
1302 GCForeground, &gcvalue);
1303 gcvalue.foreground = PixColors[ (XDEPTH <= 2 ? Color_fg 1282 gcvalue.foreground = PixColors[ (XDEPTH <= 2 ? Color_fg : Color_scroll)];
1304 : Color_scroll)];
1305 scrollbarGC = XCreateGC (display->display, TermWin.vt, 1283 scrollbarGC = XCreateGC (display->display, TermWin.vt, GCForeground, &gcvalue);
1306 GCForeground, &gcvalue);
1307#endif 1284#endif
1308} 1285}
1309 1286
1310/*----------------------------------------------------------------------*/ 1287/*----------------------------------------------------------------------*/
1311/* 1288/*
1360 case -1: 1337 case -1:
1361 rxvt_print_error ("can't fork"); 1338 rxvt_print_error ("can't fork");
1362 return -1; 1339 return -1;
1363 case 0: 1340 case 0:
1364 close (cfd); /* only keep tty_fd and STDERR open */ 1341 close (cfd); /* only keep tty_fd and STDERR open */
1342
1343 init_env ();
1365 1344
1366 if (rxvt_control_tty (tty_fd, ttydev) < 0) 1345 if (rxvt_control_tty (tty_fd, ttydev) < 0)
1367 rxvt_print_error ("could not obtain control of tty"); 1346 rxvt_print_error ("could not obtain control of tty");
1368 else 1347 else
1369 { 1348 {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines