… | |
… | |
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. |
… | |
… | |
398 | #if defined (HOTKEY_CTRL) || defined (HOTKEY_META) |
399 | #if defined (HOTKEY_CTRL) || defined (HOTKEY_META) |
399 | ks_bigfont = XK_greater; |
400 | ks_bigfont = XK_greater; |
400 | ks_smallfont = XK_less; |
401 | ks_smallfont = XK_less; |
401 | #endif |
402 | #endif |
402 | |
403 | |
403 | #ifdef GREEK_SUPPORT |
|
|
404 | ks_greekmodeswith = GREEK_KEYBOARD_MODESWITCH; |
|
|
405 | #endif |
|
|
406 | |
|
|
407 | refresh_limit = 1; |
404 | refresh_limit = 1; |
408 | refresh_type = SLOW_REFRESH; |
405 | refresh_type = SLOW_REFRESH; |
409 | prev_nrow = prev_ncol = 0; |
406 | 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 | |
407 | |
417 | oldcursor.row = oldcursor.col = -1; |
408 | oldcursor.row = oldcursor.col = -1; |
418 | #ifdef XPM_BACKGROUND |
409 | #ifdef XPM_BACKGROUND |
419 | /* bgPixmap.w = bgPixmap.h = 0; */ |
410 | /* bgPixmap.w = bgPixmap.h = 0; */ |
420 | bgPixmap.x = bgPixmap.y = 50; |
411 | bgPixmap.x = bgPixmap.y = 50; |
… | |
… | |
666 | |
657 | |
667 | #ifdef HAVE_SCROLLBARS |
658 | #ifdef HAVE_SCROLLBARS |
668 | setup_scrollbar (rs[Rs_scrollBar_align], rs[Rs_scrollstyle], |
659 | setup_scrollbar (rs[Rs_scrollBar_align], rs[Rs_scrollstyle], |
669 | rs[Rs_scrollBar_thickness]); |
660 | rs[Rs_scrollBar_thickness]); |
670 | #endif |
661 | #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 | |
662 | |
678 | #ifdef XTERM_REVERSE_VIDEO |
663 | #ifdef XTERM_REVERSE_VIDEO |
679 | /* this is how xterm implements reverseVideo */ |
664 | /* this is how xterm implements reverseVideo */ |
680 | if (Options & Opt_reverseVideo) |
665 | if (Options & Opt_reverseVideo) |
681 | { |
666 | { |
… | |
… | |
762 | * @ DISPLAY: in case we started with -display |
747 | * @ DISPLAY: in case we started with -display |
763 | * @ WINDOWID: X window id number of the window |
748 | * @ WINDOWID: X window id number of the window |
764 | * @ COLORTERM: terminal sub-name and also indicates its color |
749 | * @ COLORTERM: terminal sub-name and also indicates its color |
765 | * @ TERM: terminal name |
750 | * @ TERM: terminal name |
766 | * @ TERMINFO: path to terminfo directory |
751 | * @ TERMINFO: path to terminfo directory |
|
|
752 | * @ COLORFGBG: fg;bg color codes |
767 | */ |
753 | */ |
768 | putenv (env_display); |
754 | putenv (env_display); |
769 | putenv (env_windowid); |
755 | putenv (env_windowid); |
|
|
756 | if (env_colorfgbg) |
|
|
757 | putenv (env_colorfgbg); |
770 | |
758 | |
771 | #ifdef RXVT_TERMINFO |
759 | #ifdef RXVT_TERMINFO |
772 | putenv ("TERMINFO=" RXVT_TERMINFO); |
760 | putenv ("TERMINFO=" RXVT_TERMINFO); |
773 | #endif |
761 | #endif |
774 | |
762 | |
… | |
… | |
802 | void |
790 | void |
803 | rxvt_term::set_locale (const char *locale) |
791 | rxvt_term::set_locale (const char *locale) |
804 | { |
792 | { |
805 | #if HAVE_XSETLOCALE || HAVE_SETLOCALE |
793 | #if HAVE_XSETLOCALE || HAVE_SETLOCALE |
806 | free (this->locale); |
794 | free (this->locale); |
807 | this->locale = rxvt_strdup (setlocale (LC_CTYPE, "")); |
795 | this->locale = rxvt_strdup (setlocale (LC_CTYPE, locale)); |
|
|
796 | SET_LOCALE (this->locale); |
|
|
797 | mbstate.reset (); |
808 | #endif |
798 | #endif |
809 | #if HAVE_NL_LANGINFO |
799 | #if HAVE_NL_LANGINFO |
810 | free (codeset); |
800 | free (codeset); |
811 | codeset = strdup (nl_langinfo (CODESET)); |
801 | codeset = strdup (nl_langinfo (CODESET)); |
812 | enc_utf8 = !STRCASECMP (codeset, "UTF-8") |
802 | enc_utf8 = !STRCASECMP (codeset, "UTF-8") |
… | |
… | |
894 | if (menubar_visible ()) |
884 | if (menubar_visible ()) |
895 | { |
885 | { |
896 | PrivateModes |= PrivMode_menuBar; |
886 | PrivateModes |= PrivMode_menuBar; |
897 | SavedModes |= PrivMode_menuBar; |
887 | SavedModes |= PrivMode_menuBar; |
898 | } |
888 | } |
899 | |
|
|
900 | #ifdef GREEK_SUPPORT |
|
|
901 | greek_init (); |
|
|
902 | #endif |
|
|
903 | |
889 | |
904 | #ifdef CURSOR_BLINK |
890 | #ifdef CURSOR_BLINK |
905 | if (Options & Opt_cursorBlink) |
891 | if (Options & Opt_cursorBlink) |
906 | (void)gettimeofday (&lastcursorchange, NULL); |
892 | (void)gettimeofday (&lastcursorchange, NULL); |
907 | #endif |
893 | #endif |
… | |
… | |
1139 | } |
1125 | } |
1140 | |
1126 | |
1141 | /* grab colors before netscape does */ |
1127 | /* grab colors before netscape does */ |
1142 | Get_Colours (); |
1128 | Get_Colours (); |
1143 | |
1129 | |
1144 | change_font (1, NULL); |
1130 | if (!change_font (rs[Rs_font])) |
|
|
1131 | { |
|
|
1132 | fprintf (stderr, "unable to load a base font, please provide one using -fn fontname\n"); |
|
|
1133 | destroy (); |
|
|
1134 | return; |
|
|
1135 | } |
|
|
1136 | |
1145 | window_calc (0, 0); |
1137 | window_calc (0, 0); |
1146 | old_width = szHint.width; |
1138 | old_width = szHint.width; |
1147 | old_height = szHint.height; |
1139 | old_height = szHint.height; |
1148 | |
1140 | |
1149 | /* parent window - reverse video so we can see placement errors |
1141 | /* parent window - reverse video so we can see placement errors |
… | |
… | |
1254 | TermWin_TotalWidth (), |
1246 | TermWin_TotalWidth (), |
1255 | menuBar_TotalHeight (), |
1247 | menuBar_TotalHeight (), |
1256 | 0, |
1248 | 0, |
1257 | PixColors[Color_fg], |
1249 | PixColors[Color_fg], |
1258 | PixColors[Color_scroll]); |
1250 | PixColors[Color_scroll]); |
|
|
1251 | |
1259 | #ifdef DEBUG_X |
1252 | #ifdef DEBUG_X |
1260 | XStoreName (display->display, menuBar.win, "menubar"); |
1253 | XStoreName (display->display, menuBar.win, "menubar"); |
1261 | #endif |
1254 | #endif |
1262 | |
1255 | |
|
|
1256 | menuBar.drawable = new rxvt_drawable (display, menuBar.win); |
|
|
1257 | |
1263 | XDefineCursor (display->display, menuBar.win, pointer_leftptr); |
1258 | XDefineCursor (display->display, menuBar.win, |
|
|
1259 | XCreateFontCursor (display->display, XC_left_ptr)); |
1264 | |
1260 | |
1265 | XSelectInput (display->display, menuBar.win, |
1261 | XSelectInput (display->display, menuBar.win, |
1266 | (ExposureMask | ButtonPressMask | ButtonReleaseMask |
1262 | (ExposureMask | ButtonPressMask | ButtonReleaseMask |
1267 | | Button1MotionMask)); |
1263 | | Button1MotionMask)); |
1268 | menubar_ev.start (display, menuBar.win); |
1264 | menubar_ev.start (display, menuBar.win); |
… | |
… | |
1291 | gcvalue.graphics_exposures = 1; |
1287 | gcvalue.graphics_exposures = 1; |
1292 | TermWin.gc = XCreateGC (display->display, TermWin.vt, |
1288 | TermWin.gc = XCreateGC (display->display, TermWin.vt, |
1293 | GCForeground | GCBackground |
1289 | GCForeground | GCBackground |
1294 | | GCGraphicsExposures, &gcvalue); |
1290 | | GCGraphicsExposures, &gcvalue); |
1295 | |
1291 | |
|
|
1292 | TermWin.drawable = new rxvt_drawable (display, TermWin.vt); |
|
|
1293 | |
1296 | #if defined(MENUBAR) || defined(RXVT_SCROLLBAR) |
1294 | #if defined(MENUBAR) || defined(RXVT_SCROLLBAR) |
1297 | gcvalue.foreground = PixColors[Color_topShadow]; |
1295 | gcvalue.foreground = PixColors[Color_topShadow]; |
1298 | topShadowGC = XCreateGC (display->display, TermWin.vt, |
1296 | topShadowGC = XCreateGC (display->display, TermWin.vt, GCForeground, &gcvalue); |
1299 | GCForeground, &gcvalue); |
|
|
1300 | gcvalue.foreground = PixColors[Color_bottomShadow]; |
1297 | gcvalue.foreground = PixColors[Color_bottomShadow]; |
1301 | botShadowGC = XCreateGC (display->display, TermWin.vt, |
1298 | botShadowGC = XCreateGC (display->display, TermWin.vt, GCForeground, &gcvalue); |
1302 | GCForeground, &gcvalue); |
|
|
1303 | gcvalue.foreground = PixColors[ (XDEPTH <= 2 ? Color_fg |
1299 | gcvalue.foreground = PixColors[ (XDEPTH <= 2 ? Color_fg : Color_scroll)]; |
1304 | : Color_scroll)]; |
|
|
1305 | scrollbarGC = XCreateGC (display->display, TermWin.vt, |
1300 | scrollbarGC = XCreateGC (display->display, TermWin.vt, GCForeground, &gcvalue); |
1306 | GCForeground, &gcvalue); |
|
|
1307 | #endif |
1301 | #endif |
1308 | } |
1302 | } |
1309 | |
1303 | |
1310 | /*----------------------------------------------------------------------*/ |
1304 | /*----------------------------------------------------------------------*/ |
1311 | /* |
1305 | /* |
… | |
… | |
1360 | case -1: |
1354 | case -1: |
1361 | rxvt_print_error ("can't fork"); |
1355 | rxvt_print_error ("can't fork"); |
1362 | return -1; |
1356 | return -1; |
1363 | case 0: |
1357 | case 0: |
1364 | close (cfd); /* only keep tty_fd and STDERR open */ |
1358 | close (cfd); /* only keep tty_fd and STDERR open */ |
|
|
1359 | |
|
|
1360 | init_env (); |
1365 | |
1361 | |
1366 | if (rxvt_control_tty (tty_fd, ttydev) < 0) |
1362 | if (rxvt_control_tty (tty_fd, ttydev) < 0) |
1367 | rxvt_print_error ("could not obtain control of tty"); |
1363 | rxvt_print_error ("could not obtain control of tty"); |
1368 | else |
1364 | else |
1369 | { |
1365 | { |