… | |
… | |
10 | * Copyright (c) 1996 Chuck Blake <cblake@BBN.COM> |
10 | * Copyright (c) 1996 Chuck Blake <cblake@BBN.COM> |
11 | * Copyright (c) 1997 mj olesen <olesen@me.queensu.ca> |
11 | * Copyright (c) 1997 mj olesen <olesen@me.queensu.ca> |
12 | * Copyright (c) 1997,1998 Oezguer Kesim <kesim@math.fu-berlin.de> |
12 | * Copyright (c) 1997,1998 Oezguer Kesim <kesim@math.fu-berlin.de> |
13 | * Copyright (c) 1998-2001 Geoff Wing <gcw@pobox.com> |
13 | * Copyright (c) 1998-2001 Geoff Wing <gcw@pobox.com> |
14 | * - extensive modifications |
14 | * - extensive modifications |
15 | * Copyright (c) 2003-2006 Marc Lehmann <pcg@goof.com> |
15 | * Copyright (c) 2003-2007 Marc Lehmann <pcg@goof.com> |
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 2 of the License, or |
20 | * (at your option) any later version. |
20 | * (at your option) any later version. |
… | |
… | |
281 | }; |
281 | }; |
282 | |
282 | |
283 | void |
283 | void |
284 | rxvt_term::init_vars () |
284 | rxvt_term::init_vars () |
285 | { |
285 | { |
286 | pix_colors = // |
286 | pix_colors = pix_colors_focused; |
287 | pix_colors_focused = new rxvt_color [TOTAL_COLORS]; |
|
|
288 | #ifdef OFF_FOCUS_FADING |
|
|
289 | pix_colors_unfocused = new rxvt_color [TOTAL_COLORS]; |
|
|
290 | #endif |
|
|
291 | |
|
|
292 | |
287 | |
293 | MEvent.time = CurrentTime; |
288 | MEvent.time = CurrentTime; |
294 | MEvent.button = AnyButton; |
289 | MEvent.button = AnyButton; |
295 | want_refresh = 1; |
290 | want_refresh = 1; |
296 | priv_modes = SavedModes = PrivMode_Default; |
291 | priv_modes = SavedModes = PrivMode_Default; |
… | |
… | |
298 | nrow = 24; |
293 | nrow = 24; |
299 | int_bwidth = INTERNALBORDERWIDTH; |
294 | int_bwidth = INTERNALBORDERWIDTH; |
300 | ext_bwidth = EXTERNALBORDERWIDTH; |
295 | ext_bwidth = EXTERNALBORDERWIDTH; |
301 | lineSpace = LINESPACE; |
296 | lineSpace = LINESPACE; |
302 | saveLines = SAVELINES; |
297 | saveLines = SAVELINES; |
303 | numpix_colors = TOTAL_COLORS; |
|
|
304 | |
298 | |
305 | refresh_type = SLOW_REFRESH; |
299 | refresh_type = SLOW_REFRESH; |
306 | |
300 | |
307 | oldcursor.row = oldcursor.col = -1; |
301 | oldcursor.row = oldcursor.col = -1; |
308 | last_bot = last_state = -1; |
|
|
309 | |
302 | |
310 | set_option (Opt_scrollBar); |
303 | set_option (Opt_scrollBar); |
311 | set_option (Opt_scrollTtyOutput); |
304 | set_option (Opt_scrollTtyOutput); |
312 | set_option (Opt_jumpScroll); |
305 | set_option (Opt_jumpScroll); |
313 | set_option (Opt_skipScroll); |
306 | set_option (Opt_skipScroll); |
… | |
… | |
414 | if (rs[Rs_depth]) |
407 | if (rs[Rs_depth]) |
415 | select_visual (strtol (rs[Rs_depth], 0, 0)); |
408 | select_visual (strtol (rs[Rs_depth], 0, 0)); |
416 | #endif |
409 | #endif |
417 | |
410 | |
418 | #ifdef HAVE_AFTERIMAGE |
411 | #ifdef HAVE_AFTERIMAGE |
|
|
412 | set_application_name ((char*)rs[Rs_name]); |
|
|
413 | set_output_threshold (OUTPUT_LEVEL_WARNING); |
419 | asv = create_asvisual_for_id (dpy, display->screen, depth, XVisualIDFromVisual (visual), cmap, NULL); |
414 | asv = create_asvisual_for_id (dpy, display->screen, depth, XVisualIDFromVisual (visual), cmap, NULL); |
420 | #endif |
415 | #endif |
421 | free (r_argv); |
416 | free (r_argv); |
422 | |
417 | |
423 | for (int i = NUM_RESOURCES; i--; ) |
418 | for (int i = NUM_RESOURCES; i--; ) |
… | |
… | |
1118 | GCForeground | GCBackground | GCGraphicsExposures, |
1113 | GCForeground | GCBackground | GCGraphicsExposures, |
1119 | &gcvalue); |
1114 | &gcvalue); |
1120 | |
1115 | |
1121 | drawable = new rxvt_drawable (this, vt); |
1116 | drawable = new rxvt_drawable (this, vt); |
1122 | |
1117 | |
1123 | #ifdef RXVT_SCROLLBAR |
|
|
1124 | gcvalue.foreground = pix_colors[Color_topShadow]; |
|
|
1125 | topShadowGC = XCreateGC (dpy, vt, GCForeground, &gcvalue); |
|
|
1126 | gcvalue.foreground = pix_colors[Color_bottomShadow]; |
|
|
1127 | botShadowGC = XCreateGC (dpy, vt, GCForeground, &gcvalue); |
|
|
1128 | gcvalue.foreground = pix_colors[ (depth <= 2 ? Color_fg : Color_scroll)]; |
|
|
1129 | scrollbarGC = XCreateGC (dpy, vt, GCForeground, &gcvalue); |
|
|
1130 | #endif |
|
|
1131 | |
|
|
1132 | #ifdef OFF_FOCUS_FADING |
1118 | #ifdef OFF_FOCUS_FADING |
1133 | // initially we are in unfocused state |
1119 | // initially we are in unfocused state |
1134 | if (rs[Rs_fade]) |
1120 | if (rs[Rs_fade]) |
1135 | pix_colors = pix_colors_unfocused; |
1121 | pix_colors = pix_colors_unfocused; |
1136 | #endif |
1122 | #endif |
… | |
… | |
1141 | |
1127 | |
1142 | /* ------------------------------------------------------------------------- * |
1128 | /* ------------------------------------------------------------------------- * |
1143 | * GET TTY CURRENT STATE * |
1129 | * GET TTY CURRENT STATE * |
1144 | * ------------------------------------------------------------------------- */ |
1130 | * ------------------------------------------------------------------------- */ |
1145 | void |
1131 | void |
1146 | rxvt_get_ttymode (ttymode_t *tio, int erase) |
1132 | rxvt_get_ttymode (struct termios *tio, int erase) |
1147 | { |
1133 | { |
1148 | /* |
1134 | /* |
1149 | * standard System V termios interface |
1135 | * standard System V termios interface |
1150 | */ |
1136 | */ |
1151 | if (GET_TERMIOS (STDIN_FILENO, tio) < 0) |
1137 | if (tcgetattr (STDIN_FILENO, tio) < 0) |
1152 | { |
1138 | { |
1153 | // return error - use system defaults, |
1139 | // return error - use system defaults, |
1154 | // where possible, and zero elsewhere |
1140 | // where possible, and zero elsewhere |
1155 | memset (tio, 0, sizeof (ttymode_t)); |
1141 | memset (tio, 0, sizeof (struct termios)); |
1156 | |
1142 | |
1157 | tio->c_cc[VINTR] = CINTR; |
1143 | tio->c_cc[VINTR] = CINTR; |
1158 | tio->c_cc[VQUIT] = CQUIT; |
1144 | tio->c_cc[VQUIT] = CQUIT; |
1159 | tio->c_cc[VERASE] = CERASE; |
1145 | tio->c_cc[VERASE] = CERASE; |
1160 | #ifdef VERASE2 |
1146 | #ifdef VERASE2 |
… | |
… | |
1339 | else |
1325 | else |
1340 | #endif |
1326 | #endif |
1341 | er = -1; |
1327 | er = -1; |
1342 | |
1328 | |
1343 | rxvt_get_ttymode (&tio, er); |
1329 | rxvt_get_ttymode (&tio, er); |
1344 | SET_TERMIOS (pty->tty, &tio); /* init terminal attributes */ |
1330 | /* init terminal attributes */ |
|
|
1331 | cfsetospeed (&tio, BAUDRATE); |
|
|
1332 | cfsetispeed (&tio, BAUDRATE); |
|
|
1333 | tcsetattr (pty->tty, TCSANOW, &tio); |
1345 | pty->set_utf8_mode (enc_utf8); |
1334 | pty->set_utf8_mode (enc_utf8); |
1346 | |
1335 | |
1347 | /* set initial window size */ |
1336 | /* set initial window size */ |
1348 | tt_winch (); |
1337 | tt_winch (); |
1349 | |
1338 | |