… | |
… | |
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--; ) |
… | |
… | |
1080 | termwin_ev.start (display, top); |
1075 | termwin_ev.start (display, top); |
1081 | |
1076 | |
1082 | /* vt cursor: Black-on-White is standard, but this is more popular */ |
1077 | /* vt cursor: Black-on-White is standard, but this is more popular */ |
1083 | TermWin_cursor = XCreateFontCursor (dpy, XC_xterm); |
1078 | TermWin_cursor = XCreateFontCursor (dpy, XC_xterm); |
1084 | |
1079 | |
1085 | #ifdef HAVE_SCROLLBARS |
|
|
1086 | /* cursor scrollBar: Black-on-White */ |
|
|
1087 | leftptr_cursor = XCreateFontCursor (dpy, XC_left_ptr); |
|
|
1088 | #endif |
|
|
1089 | |
|
|
1090 | /* the vt window */ |
1080 | /* the vt window */ |
1091 | vt = XCreateSimpleWindow (dpy, top, |
1081 | vt = XCreateSimpleWindow (dpy, top, |
1092 | window_vt_x, window_vt_y, |
1082 | window_vt_x, window_vt_y, |
1093 | width, height, |
1083 | width, height, |
1094 | 0, |
1084 | 0, |
… | |
… | |
1118 | GCForeground | GCBackground | GCGraphicsExposures, |
1108 | GCForeground | GCBackground | GCGraphicsExposures, |
1119 | &gcvalue); |
1109 | &gcvalue); |
1120 | |
1110 | |
1121 | drawable = new rxvt_drawable (this, vt); |
1111 | drawable = new rxvt_drawable (this, vt); |
1122 | |
1112 | |
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 |
1113 | #ifdef OFF_FOCUS_FADING |
1133 | // initially we are in unfocused state |
1114 | // initially we are in unfocused state |
1134 | if (rs[Rs_fade]) |
1115 | if (rs[Rs_fade]) |
1135 | pix_colors = pix_colors_unfocused; |
1116 | pix_colors = pix_colors_unfocused; |
1136 | #endif |
1117 | #endif |
… | |
… | |
1141 | |
1122 | |
1142 | /* ------------------------------------------------------------------------- * |
1123 | /* ------------------------------------------------------------------------- * |
1143 | * GET TTY CURRENT STATE * |
1124 | * GET TTY CURRENT STATE * |
1144 | * ------------------------------------------------------------------------- */ |
1125 | * ------------------------------------------------------------------------- */ |
1145 | void |
1126 | void |
1146 | rxvt_get_ttymode (ttymode_t *tio, int erase) |
1127 | rxvt_get_ttymode (struct termios *tio, int erase) |
1147 | { |
1128 | { |
1148 | /* |
1129 | /* |
1149 | * standard System V termios interface |
1130 | * standard System V termios interface |
1150 | */ |
1131 | */ |
1151 | if (GET_TERMIOS (STDIN_FILENO, tio) < 0) |
1132 | if (tcgetattr (STDIN_FILENO, tio) < 0) |
1152 | { |
1133 | { |
1153 | // return error - use system defaults, |
1134 | // return error - use system defaults, |
1154 | // where possible, and zero elsewhere |
1135 | // where possible, and zero elsewhere |
1155 | memset (tio, 0, sizeof (ttymode_t)); |
1136 | memset (tio, 0, sizeof (struct termios)); |
1156 | |
1137 | |
1157 | tio->c_cc[VINTR] = CINTR; |
1138 | tio->c_cc[VINTR] = CINTR; |
1158 | tio->c_cc[VQUIT] = CQUIT; |
1139 | tio->c_cc[VQUIT] = CQUIT; |
1159 | tio->c_cc[VERASE] = CERASE; |
1140 | tio->c_cc[VERASE] = CERASE; |
1160 | #ifdef VERASE2 |
1141 | #ifdef VERASE2 |
… | |
… | |
1339 | else |
1320 | else |
1340 | #endif |
1321 | #endif |
1341 | er = -1; |
1322 | er = -1; |
1342 | |
1323 | |
1343 | rxvt_get_ttymode (&tio, er); |
1324 | rxvt_get_ttymode (&tio, er); |
1344 | SET_TERMIOS (pty->tty, &tio); /* init terminal attributes */ |
1325 | /* init terminal attributes */ |
|
|
1326 | cfsetospeed (&tio, BAUDRATE); |
|
|
1327 | cfsetispeed (&tio, BAUDRATE); |
|
|
1328 | tcsetattr (pty->tty, TCSANOW, &tio); |
1345 | pty->set_utf8_mode (enc_utf8); |
1329 | pty->set_utf8_mode (enc_utf8); |
1346 | |
1330 | |
1347 | /* set initial window size */ |
1331 | /* set initial window size */ |
1348 | tt_winch (); |
1332 | tt_winch (); |
1349 | |
1333 | |