… | |
… | |
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 | { |
… | |
… | |
805 | void |
790 | void |
806 | rxvt_term::set_locale (const char *locale) |
791 | rxvt_term::set_locale (const char *locale) |
807 | { |
792 | { |
808 | #if HAVE_XSETLOCALE || HAVE_SETLOCALE |
793 | #if HAVE_XSETLOCALE || HAVE_SETLOCALE |
809 | free (this->locale); |
794 | free (this->locale); |
810 | this->locale = rxvt_strdup (setlocale (LC_CTYPE, "")); |
795 | this->locale = rxvt_strdup (setlocale (LC_CTYPE, locale)); |
811 | rxvt_set_locale (this->locale); |
796 | SET_LOCALE (this->locale); |
812 | mbstate.reset (); |
797 | mbstate.reset (); |
813 | #endif |
798 | #endif |
814 | #if HAVE_NL_LANGINFO |
799 | #if HAVE_NL_LANGINFO |
815 | free (codeset); |
800 | free (codeset); |
816 | codeset = strdup (nl_langinfo (CODESET)); |
801 | codeset = strdup (nl_langinfo (CODESET)); |
… | |
… | |
899 | if (menubar_visible ()) |
884 | if (menubar_visible ()) |
900 | { |
885 | { |
901 | PrivateModes |= PrivMode_menuBar; |
886 | PrivateModes |= PrivMode_menuBar; |
902 | SavedModes |= PrivMode_menuBar; |
887 | SavedModes |= PrivMode_menuBar; |
903 | } |
888 | } |
904 | |
|
|
905 | #ifdef GREEK_SUPPORT |
|
|
906 | greek_init (); |
|
|
907 | #endif |
|
|
908 | |
889 | |
909 | #ifdef CURSOR_BLINK |
890 | #ifdef CURSOR_BLINK |
910 | if (Options & Opt_cursorBlink) |
891 | if (Options & Opt_cursorBlink) |
911 | (void)gettimeofday (&lastcursorchange, NULL); |
892 | (void)gettimeofday (&lastcursorchange, NULL); |
912 | #endif |
893 | #endif |
… | |
… | |
1144 | } |
1125 | } |
1145 | |
1126 | |
1146 | /* grab colors before netscape does */ |
1127 | /* grab colors before netscape does */ |
1147 | Get_Colours (); |
1128 | Get_Colours (); |
1148 | |
1129 | |
1149 | 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 | |
1150 | window_calc (0, 0); |
1137 | window_calc (0, 0); |
1151 | old_width = szHint.width; |
1138 | old_width = szHint.width; |
1152 | old_height = szHint.height; |
1139 | old_height = szHint.height; |
1153 | |
1140 | |
1154 | /* parent window - reverse video so we can see placement errors |
1141 | /* parent window - reverse video so we can see placement errors |
… | |
… | |
1253 | |
1240 | |
1254 | #if defined(MENUBAR) && (MENUBAR_MAX > 1) |
1241 | #if defined(MENUBAR) && (MENUBAR_MAX > 1) |
1255 | if (menuBar_height ()) |
1242 | if (menuBar_height ()) |
1256 | { |
1243 | { |
1257 | menuBar.win = XCreateSimpleWindow (display->display, TermWin.parent[0], |
1244 | menuBar.win = XCreateSimpleWindow (display->display, TermWin.parent[0], |
1258 | window_vt_x, 0, |
1245 | window_vt_x, 0, |
1259 | TermWin_TotalWidth (), |
1246 | TermWin_TotalWidth (), |
1260 | menuBar_TotalHeight (), |
1247 | menuBar_TotalHeight (), |
1261 | 0, |
1248 | 0, |
1262 | PixColors[Color_fg], |
1249 | PixColors[Color_fg], |
1263 | PixColors[Color_scroll]); |
1250 | PixColors[Color_scroll]); |
|
|
1251 | |
1264 | #ifdef DEBUG_X |
1252 | #ifdef DEBUG_X |
1265 | XStoreName (display->display, menuBar.win, "menubar"); |
1253 | XStoreName (display->display, menuBar.win, "menubar"); |
1266 | #endif |
1254 | #endif |
1267 | |
1255 | |
|
|
1256 | menuBar.drawable = new rxvt_drawable (display, menuBar.win); |
|
|
1257 | |
1268 | XDefineCursor (display->display, menuBar.win, pointer_leftptr); |
1258 | XDefineCursor (display->display, menuBar.win, |
|
|
1259 | XCreateFontCursor (display->display, XC_left_ptr)); |
1269 | |
1260 | |
1270 | XSelectInput (display->display, menuBar.win, |
1261 | XSelectInput (display->display, menuBar.win, |
1271 | (ExposureMask | ButtonPressMask | ButtonReleaseMask |
1262 | (ExposureMask | ButtonPressMask | ButtonReleaseMask |
1272 | | Button1MotionMask)); |
1263 | | Button1MotionMask)); |
1273 | menubar_ev.start (display, menuBar.win); |
1264 | menubar_ev.start (display, menuBar.win); |
… | |
… | |
1296 | gcvalue.graphics_exposures = 1; |
1287 | gcvalue.graphics_exposures = 1; |
1297 | TermWin.gc = XCreateGC (display->display, TermWin.vt, |
1288 | TermWin.gc = XCreateGC (display->display, TermWin.vt, |
1298 | GCForeground | GCBackground |
1289 | GCForeground | GCBackground |
1299 | | GCGraphicsExposures, &gcvalue); |
1290 | | GCGraphicsExposures, &gcvalue); |
1300 | |
1291 | |
|
|
1292 | TermWin.drawable = new rxvt_drawable (display, TermWin.vt); |
|
|
1293 | |
1301 | #if defined(MENUBAR) || defined(RXVT_SCROLLBAR) |
1294 | #if defined(MENUBAR) || defined(RXVT_SCROLLBAR) |
1302 | gcvalue.foreground = PixColors[Color_topShadow]; |
1295 | gcvalue.foreground = PixColors[Color_topShadow]; |
1303 | topShadowGC = XCreateGC (display->display, TermWin.vt, |
1296 | topShadowGC = XCreateGC (display->display, TermWin.vt, GCForeground, &gcvalue); |
1304 | GCForeground, &gcvalue); |
|
|
1305 | gcvalue.foreground = PixColors[Color_bottomShadow]; |
1297 | gcvalue.foreground = PixColors[Color_bottomShadow]; |
1306 | botShadowGC = XCreateGC (display->display, TermWin.vt, |
1298 | botShadowGC = XCreateGC (display->display, TermWin.vt, GCForeground, &gcvalue); |
1307 | GCForeground, &gcvalue); |
|
|
1308 | gcvalue.foreground = PixColors[ (XDEPTH <= 2 ? Color_fg |
1299 | gcvalue.foreground = PixColors[ (XDEPTH <= 2 ? Color_fg : Color_scroll)]; |
1309 | : Color_scroll)]; |
|
|
1310 | scrollbarGC = XCreateGC (display->display, TermWin.vt, |
1300 | scrollbarGC = XCreateGC (display->display, TermWin.vt, GCForeground, &gcvalue); |
1311 | GCForeground, &gcvalue); |
|
|
1312 | #endif |
1301 | #endif |
1313 | } |
1302 | } |
1314 | |
1303 | |
1315 | /*----------------------------------------------------------------------*/ |
1304 | /*----------------------------------------------------------------------*/ |
1316 | /* |
1305 | /* |