… | |
… | |
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. |
… | |
… | |
383 | TermWin.ext_bwidth = EXTERNALBORDERWIDTH; |
384 | TermWin.ext_bwidth = EXTERNALBORDERWIDTH; |
384 | TermWin.lineSpace = LINESPACE; |
385 | TermWin.lineSpace = LINESPACE; |
385 | TermWin.saveLines = SAVELINES; |
386 | TermWin.saveLines = SAVELINES; |
386 | numPixColors = TOTAL_COLORS; |
387 | numPixColors = TOTAL_COLORS; |
387 | |
388 | |
388 | #ifndef NO_NEW_SELECTION |
|
|
389 | selection_style = NEW_SELECT; |
|
|
390 | #else |
|
|
391 | selection_style = OLD_SELECT; |
|
|
392 | #endif |
|
|
393 | |
|
|
394 | #ifndef NO_BRIGHTCOLOR |
389 | #ifndef NO_BRIGHTCOLOR |
395 | colorfgbg = DEFAULT_RSTYLE; |
390 | colorfgbg = DEFAULT_RSTYLE; |
396 | #endif |
|
|
397 | |
|
|
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 |
391 | #endif |
406 | |
392 | |
407 | refresh_limit = 1; |
393 | refresh_limit = 1; |
408 | refresh_type = SLOW_REFRESH; |
394 | refresh_type = SLOW_REFRESH; |
409 | prev_nrow = prev_ncol = 0; |
395 | 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 | |
396 | |
417 | oldcursor.row = oldcursor.col = -1; |
397 | oldcursor.row = oldcursor.col = -1; |
418 | #ifdef XPM_BACKGROUND |
398 | #ifdef XPM_BACKGROUND |
419 | /* bgPixmap.w = bgPixmap.h = 0; */ |
399 | /* bgPixmap.w = bgPixmap.h = 0; */ |
420 | bgPixmap.x = bgPixmap.y = 50; |
400 | bgPixmap.x = bgPixmap.y = 50; |
… | |
… | |
601 | #endif |
581 | #endif |
602 | |
582 | |
603 | if (!rs[Rs_cutchars]) |
583 | if (!rs[Rs_cutchars]) |
604 | rs[Rs_cutchars] = CUTCHARS; |
584 | rs[Rs_cutchars] = CUTCHARS; |
605 | |
585 | |
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 |
586 | #ifndef NO_BACKSPACE_KEY |
619 | if (!rs[Rs_backspace_key]) |
587 | if (!rs[Rs_backspace_key]) |
620 | # ifdef DEFAULT_BACKSPACE |
588 | # ifdef DEFAULT_BACKSPACE |
621 | key_backspace = DEFAULT_BACKSPACE; |
589 | key_backspace = DEFAULT_BACKSPACE; |
622 | # else |
590 | # else |
… | |
… | |
650 | { |
618 | { |
651 | rxvt_Str_trim ((char *)rs[Rs_answerbackstring]); |
619 | rxvt_Str_trim ((char *)rs[Rs_answerbackstring]); |
652 | rxvt_Str_escaped ((char *)rs[Rs_answerbackstring]); |
620 | rxvt_Str_escaped ((char *)rs[Rs_answerbackstring]); |
653 | } |
621 | } |
654 | |
622 | |
655 | if (rs[Rs_selectstyle]) |
|
|
656 | { |
|
|
657 | if (STRNCASECMP (rs[Rs_selectstyle], "oldword", 7) == 0) |
|
|
658 | selection_style = OLD_WORD_SELECT; |
|
|
659 | #ifndef NO_OLD_SELECTION |
|
|
660 | |
|
|
661 | else if (STRNCASECMP (rs[Rs_selectstyle], "old", 3) == 0) |
|
|
662 | selection_style = OLD_SELECT; |
|
|
663 | #endif |
|
|
664 | |
|
|
665 | } |
|
|
666 | |
|
|
667 | #ifdef HAVE_SCROLLBARS |
623 | #ifdef HAVE_SCROLLBARS |
668 | setup_scrollbar (rs[Rs_scrollBar_align], rs[Rs_scrollstyle], |
624 | setup_scrollbar (rs[Rs_scrollBar_align], rs[Rs_scrollstyle], |
669 | rs[Rs_scrollBar_thickness]); |
625 | rs[Rs_scrollBar_thickness]); |
670 | #endif |
626 | #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 | |
627 | |
678 | #ifdef XTERM_REVERSE_VIDEO |
628 | #ifdef XTERM_REVERSE_VIDEO |
679 | /* this is how xterm implements reverseVideo */ |
629 | /* this is how xterm implements reverseVideo */ |
680 | if (Options & Opt_reverseVideo) |
630 | if (Options & Opt_reverseVideo) |
681 | { |
631 | { |
… | |
… | |
805 | void |
755 | void |
806 | rxvt_term::set_locale (const char *locale) |
756 | rxvt_term::set_locale (const char *locale) |
807 | { |
757 | { |
808 | #if HAVE_XSETLOCALE || HAVE_SETLOCALE |
758 | #if HAVE_XSETLOCALE || HAVE_SETLOCALE |
809 | free (this->locale); |
759 | free (this->locale); |
810 | this->locale = rxvt_strdup (setlocale (LC_CTYPE, "")); |
760 | this->locale = rxvt_strdup (setlocale (LC_CTYPE, locale)); |
811 | rxvt_set_locale (this->locale); |
761 | SET_LOCALE (this->locale); |
812 | mbstate.reset (); |
762 | mbstate.reset (); |
813 | #endif |
763 | #endif |
814 | #if HAVE_NL_LANGINFO |
764 | #if HAVE_NL_LANGINFO |
815 | free (codeset); |
765 | free (codeset); |
816 | codeset = strdup (nl_langinfo (CODESET)); |
766 | codeset = strdup (nl_langinfo (CODESET)); |
… | |
… | |
899 | if (menubar_visible ()) |
849 | if (menubar_visible ()) |
900 | { |
850 | { |
901 | PrivateModes |= PrivMode_menuBar; |
851 | PrivateModes |= PrivMode_menuBar; |
902 | SavedModes |= PrivMode_menuBar; |
852 | SavedModes |= PrivMode_menuBar; |
903 | } |
853 | } |
904 | |
|
|
905 | #ifdef GREEK_SUPPORT |
|
|
906 | greek_init (); |
|
|
907 | #endif |
|
|
908 | |
854 | |
909 | #ifdef CURSOR_BLINK |
855 | #ifdef CURSOR_BLINK |
910 | if (Options & Opt_cursorBlink) |
856 | if (Options & Opt_cursorBlink) |
911 | (void)gettimeofday (&lastcursorchange, NULL); |
857 | (void)gettimeofday (&lastcursorchange, NULL); |
912 | #endif |
858 | #endif |
… | |
… | |
1144 | } |
1090 | } |
1145 | |
1091 | |
1146 | /* grab colors before netscape does */ |
1092 | /* grab colors before netscape does */ |
1147 | Get_Colours (); |
1093 | Get_Colours (); |
1148 | |
1094 | |
1149 | change_font (1, NULL); |
1095 | if (!change_font (rs[Rs_font])) |
|
|
1096 | { |
|
|
1097 | fprintf (stderr, "unable to load a base font, please provide one using -fn fontname\n"); |
|
|
1098 | destroy (); |
|
|
1099 | return; |
|
|
1100 | } |
|
|
1101 | |
1150 | window_calc (0, 0); |
1102 | window_calc (0, 0); |
1151 | old_width = szHint.width; |
1103 | old_width = szHint.width; |
1152 | old_height = szHint.height; |
1104 | old_height = szHint.height; |
1153 | |
1105 | |
1154 | /* parent window - reverse video so we can see placement errors |
1106 | /* parent window - reverse video so we can see placement errors |
… | |
… | |
1180 | |
1132 | |
1181 | xterm_seq (XTerm_title, rs[Rs_title], CHAR_ST); |
1133 | xterm_seq (XTerm_title, rs[Rs_title], CHAR_ST); |
1182 | xterm_seq (XTerm_iconName, rs[Rs_iconName], CHAR_ST); |
1134 | xterm_seq (XTerm_iconName, rs[Rs_iconName], CHAR_ST); |
1183 | |
1135 | |
1184 | classHint.res_name = (char *)rs[Rs_name]; |
1136 | classHint.res_name = (char *)rs[Rs_name]; |
1185 | classHint.res_class = (char *)APL_CLASS; |
1137 | classHint.res_class = (char *)RESCLASS; |
1186 | |
1138 | |
1187 | wmHint.flags = (InputHint | StateHint | WindowGroupHint); |
1139 | wmHint.flags = (InputHint | StateHint | WindowGroupHint); |
1188 | wmHint.input = True; |
1140 | wmHint.input = True; |
1189 | wmHint.initial_state = (Options & Opt_iconic ? IconicState |
1141 | wmHint.initial_state = (Options & Opt_iconic ? IconicState |
1190 | : NormalState); |
1142 | : NormalState); |
… | |
… | |
1253 | |
1205 | |
1254 | #if defined(MENUBAR) && (MENUBAR_MAX > 1) |
1206 | #if defined(MENUBAR) && (MENUBAR_MAX > 1) |
1255 | if (menuBar_height ()) |
1207 | if (menuBar_height ()) |
1256 | { |
1208 | { |
1257 | menuBar.win = XCreateSimpleWindow (display->display, TermWin.parent[0], |
1209 | menuBar.win = XCreateSimpleWindow (display->display, TermWin.parent[0], |
1258 | window_vt_x, 0, |
1210 | window_vt_x, 0, |
1259 | TermWin_TotalWidth (), |
1211 | TermWin_TotalWidth (), |
1260 | menuBar_TotalHeight (), |
1212 | menuBar_TotalHeight (), |
1261 | 0, |
1213 | 0, |
1262 | PixColors[Color_fg], |
1214 | PixColors[Color_fg], |
1263 | PixColors[Color_scroll]); |
1215 | PixColors[Color_scroll]); |
|
|
1216 | |
1264 | #ifdef DEBUG_X |
1217 | #ifdef DEBUG_X |
1265 | XStoreName (display->display, menuBar.win, "menubar"); |
1218 | XStoreName (display->display, menuBar.win, "menubar"); |
1266 | #endif |
1219 | #endif |
1267 | |
1220 | |
|
|
1221 | menuBar.drawable = new rxvt_drawable (display, menuBar.win); |
|
|
1222 | |
1268 | XDefineCursor (display->display, menuBar.win, pointer_leftptr); |
1223 | XDefineCursor (display->display, menuBar.win, |
|
|
1224 | XCreateFontCursor (display->display, XC_left_ptr)); |
1269 | |
1225 | |
1270 | XSelectInput (display->display, menuBar.win, |
1226 | XSelectInput (display->display, menuBar.win, |
1271 | (ExposureMask | ButtonPressMask | ButtonReleaseMask |
1227 | (ExposureMask | ButtonPressMask | ButtonReleaseMask |
1272 | | Button1MotionMask)); |
1228 | | Button1MotionMask)); |
1273 | menubar_ev.start (display, menuBar.win); |
1229 | menubar_ev.start (display, menuBar.win); |
… | |
… | |
1296 | gcvalue.graphics_exposures = 1; |
1252 | gcvalue.graphics_exposures = 1; |
1297 | TermWin.gc = XCreateGC (display->display, TermWin.vt, |
1253 | TermWin.gc = XCreateGC (display->display, TermWin.vt, |
1298 | GCForeground | GCBackground |
1254 | GCForeground | GCBackground |
1299 | | GCGraphicsExposures, &gcvalue); |
1255 | | GCGraphicsExposures, &gcvalue); |
1300 | |
1256 | |
|
|
1257 | TermWin.drawable = new rxvt_drawable (display, TermWin.vt); |
|
|
1258 | |
1301 | #if defined(MENUBAR) || defined(RXVT_SCROLLBAR) |
1259 | #if defined(MENUBAR) || defined(RXVT_SCROLLBAR) |
1302 | gcvalue.foreground = PixColors[Color_topShadow]; |
1260 | gcvalue.foreground = PixColors[Color_topShadow]; |
1303 | topShadowGC = XCreateGC (display->display, TermWin.vt, |
1261 | topShadowGC = XCreateGC (display->display, TermWin.vt, GCForeground, &gcvalue); |
1304 | GCForeground, &gcvalue); |
|
|
1305 | gcvalue.foreground = PixColors[Color_bottomShadow]; |
1262 | gcvalue.foreground = PixColors[Color_bottomShadow]; |
1306 | botShadowGC = XCreateGC (display->display, TermWin.vt, |
1263 | botShadowGC = XCreateGC (display->display, TermWin.vt, GCForeground, &gcvalue); |
1307 | GCForeground, &gcvalue); |
|
|
1308 | gcvalue.foreground = PixColors[ (XDEPTH <= 2 ? Color_fg |
1264 | gcvalue.foreground = PixColors[ (XDEPTH <= 2 ? Color_fg : Color_scroll)]; |
1309 | : Color_scroll)]; |
|
|
1310 | scrollbarGC = XCreateGC (display->display, TermWin.vt, |
1265 | scrollbarGC = XCreateGC (display->display, TermWin.vt, GCForeground, &gcvalue); |
1311 | GCForeground, &gcvalue); |
|
|
1312 | #endif |
1266 | #endif |
1313 | } |
1267 | } |
1314 | |
1268 | |
1315 | /*----------------------------------------------------------------------*/ |
1269 | /*----------------------------------------------------------------------*/ |
1316 | /* |
1270 | /* |