… | |
… | |
267 | NULL, // Color_underline |
267 | NULL, // Color_underline |
268 | #endif |
268 | #endif |
269 | #ifdef OPTION_HC |
269 | #ifdef OPTION_HC |
270 | NULL, |
270 | NULL, |
271 | #endif |
271 | #endif |
272 | #ifdef HAVE_SCROLLBARS |
|
|
273 | COLOR_SCROLLBAR, |
272 | COLOR_SCROLLBAR, |
274 | #endif |
|
|
275 | #ifdef RXVT_SCROLLBAR |
273 | #ifdef RXVT_SCROLLBAR |
276 | COLOR_SCROLLTROUGH, |
274 | COLOR_SCROLLTROUGH, |
277 | #endif |
275 | #endif |
278 | #if ENABLE_TRANSPARENCY |
276 | #if ENABLE_TRANSPARENCY |
279 | NULL, |
277 | NULL, |
… | |
… | |
394 | #if XFT |
392 | #if XFT |
395 | if (rs[Rs_depth]) |
393 | if (rs[Rs_depth]) |
396 | select_visual (strtol (rs[Rs_depth], 0, 0)); |
394 | select_visual (strtol (rs[Rs_depth], 0, 0)); |
397 | #endif |
395 | #endif |
398 | |
396 | |
399 | #ifdef HAVE_AFTERIMAGE |
|
|
400 | set_application_name ((char*)rs[Rs_name]); |
|
|
401 | set_output_threshold (OUTPUT_LEVEL_WARNING); |
|
|
402 | asv = create_asvisual_for_id (dpy, display->screen, depth, XVisualIDFromVisual (visual), cmap, NULL); |
|
|
403 | #endif |
|
|
404 | free (r_argv); |
397 | free (r_argv); |
405 | |
398 | |
406 | for (int i = NUM_RESOURCES; i--; ) |
399 | for (int i = NUM_RESOURCES; i--; ) |
407 | if (rs [i] == resval_undef) |
400 | if (rs [i] == resval_undef) |
408 | rs [i] = 0; |
401 | rs [i] = 0; |
|
|
402 | |
|
|
403 | #ifdef HAVE_AFTERIMAGE |
|
|
404 | set_application_name ((char *)rs[Rs_name]); |
|
|
405 | set_output_threshold (OUTPUT_LEVEL_WARNING); |
|
|
406 | #endif |
409 | |
407 | |
410 | #if ENABLE_PERL |
408 | #if ENABLE_PERL |
411 | if (!rs[Rs_perl_ext_1]) |
409 | if (!rs[Rs_perl_ext_1]) |
412 | rs[Rs_perl_ext_1] = "default"; |
410 | rs[Rs_perl_ext_1] = "default"; |
413 | |
411 | |
… | |
… | |
425 | */ |
423 | */ |
426 | if (cmd_argv && cmd_argv[0]) |
424 | if (cmd_argv && cmd_argv[0]) |
427 | { |
425 | { |
428 | if (!rs[Rs_title]) |
426 | if (!rs[Rs_title]) |
429 | rs[Rs_title] = rxvt_basename (cmd_argv[0]); |
427 | rs[Rs_title] = rxvt_basename (cmd_argv[0]); |
|
|
428 | |
430 | if (!rs[Rs_iconName]) |
429 | if (!rs[Rs_iconName]) |
431 | rs[Rs_iconName] = rs[Rs_title]; |
430 | rs[Rs_iconName] = rs[Rs_title]; |
432 | } |
431 | } |
433 | else |
432 | else |
434 | { |
433 | { |
435 | if (!rs[Rs_title]) |
434 | if (!rs[Rs_title]) |
436 | rs[Rs_title] = rs[Rs_name]; |
435 | rs[Rs_title] = rs[Rs_name]; |
|
|
436 | |
437 | if (!rs[Rs_iconName]) |
437 | if (!rs[Rs_iconName]) |
438 | rs[Rs_iconName] = rs[Rs_name]; |
438 | rs[Rs_iconName] = rs[Rs_name]; |
439 | } |
439 | } |
440 | |
440 | |
441 | if (rs[Rs_saveLines] && (i = atoi (rs[Rs_saveLines])) >= 0) |
441 | if (rs[Rs_saveLines] && (i = atoi (rs[Rs_saveLines])) >= 0) |
… | |
… | |
460 | #endif |
460 | #endif |
461 | |
461 | |
462 | /* no point having a scrollbar without having any scrollback! */ |
462 | /* no point having a scrollbar without having any scrollback! */ |
463 | if (!saveLines) |
463 | if (!saveLines) |
464 | set_option (Opt_scrollBar, 0); |
464 | set_option (Opt_scrollBar, 0); |
465 | |
|
|
466 | #ifdef PRINTPIPE |
|
|
467 | if (!rs[Rs_print_pipe]) |
|
|
468 | rs[Rs_print_pipe] = PRINTPIPE; |
|
|
469 | #endif |
|
|
470 | |
465 | |
471 | if (!rs[Rs_cutchars]) |
466 | if (!rs[Rs_cutchars]) |
472 | rs[Rs_cutchars] = CUTCHARS; |
467 | rs[Rs_cutchars] = CUTCHARS; |
473 | |
468 | |
474 | #ifndef NO_BACKSPACE_KEY |
469 | #ifndef NO_BACKSPACE_KEY |
… | |
… | |
487 | # else |
482 | # else |
488 | rs[Rs_delete_key] = "\033[3~"; |
483 | rs[Rs_delete_key] = "\033[3~"; |
489 | # endif |
484 | # endif |
490 | #endif |
485 | #endif |
491 | |
486 | |
492 | #ifdef HAVE_SCROLLBARS |
487 | scrollBar.setup (this); |
493 | setup_scrollbar (rs[Rs_scrollBar_align], rs[Rs_scrollstyle], rs[Rs_scrollBar_thickness]); |
|
|
494 | #endif |
|
|
495 | |
488 | |
496 | #ifdef XTERM_REVERSE_VIDEO |
489 | #ifdef XTERM_REVERSE_VIDEO |
497 | /* this is how xterm implements reverseVideo */ |
490 | /* this is how xterm implements reverseVideo */ |
498 | if (option (Opt_reverseVideo)) |
491 | if (option (Opt_reverseVideo)) |
499 | { |
492 | { |
… | |
… | |
543 | { |
536 | { |
544 | this->envv = envv; |
537 | this->envv = envv; |
545 | |
538 | |
546 | SET_R (this); |
539 | SET_R (this); |
547 | set_locale (""); |
540 | set_locale (""); |
548 | set_environ (envv); // few things in X do not call setlocale :( |
541 | set_environ (envv); // a few things in X do not call setlocale :( |
549 | |
542 | |
550 | init_vars (); |
543 | init_vars (); |
551 | |
544 | |
552 | init_secondary (); |
545 | init_secondary (); |
553 | |
546 | |
… | |
… | |
555 | |
548 | |
556 | #ifdef KEYSYM_RESOURCE |
549 | #ifdef KEYSYM_RESOURCE |
557 | keyboard->register_done (); |
550 | keyboard->register_done (); |
558 | #endif |
551 | #endif |
559 | |
552 | |
560 | #ifdef HAVE_SCROLLBARS |
553 | if (const char *path = rs[Rs_chdir]) |
|
|
554 | if (*path) // ignored if empty |
|
|
555 | { |
|
|
556 | if (*path != '/') |
|
|
557 | rxvt_fatal ("specified shell working directory must start with a slash, aborting.\n"); |
|
|
558 | |
|
|
559 | if (chdir (path)) |
|
|
560 | rxvt_fatal ("unable to change into specified shell working directory, aborting.\n"); |
|
|
561 | } |
|
|
562 | |
561 | if (option (Opt_scrollBar)) |
563 | if (option (Opt_scrollBar)) |
562 | scrollBar.setIdle (); /* set existence for size calculations */ |
564 | scrollBar.state = STATE_IDLE; /* set existence for size calculations */ |
563 | #endif |
|
|
564 | |
565 | |
565 | pty = ptytty::create (); |
566 | pty = ptytty::create (); |
566 | |
567 | |
567 | create_windows (argc, argv); |
568 | create_windows (argc, argv); |
568 | |
569 | |
569 | init_xlocale (); |
570 | init_xlocale (); |
570 | |
571 | |
571 | scr_reset (); // initialize screen |
572 | scr_poweron (); // initialize screen |
572 | |
573 | |
573 | #if 0 |
574 | #if 0 |
574 | XSynchronize (dpy, True); |
575 | XSynchronize (dpy, True); |
575 | #endif |
576 | #endif |
576 | |
577 | |
577 | #ifdef HAVE_SCROLLBARS |
|
|
578 | if (option (Opt_scrollBar)) |
578 | if (option (Opt_scrollBar)) |
579 | resize_scrollbar (); /* create and map scrollbar */ |
579 | scrollBar.resize (); /* create and map scrollbar */ |
580 | #endif |
|
|
581 | #ifdef HAVE_BG_PIXMAP |
580 | #ifdef HAVE_BG_PIXMAP |
582 | { |
581 | { |
583 | bgPixmap.set_target (this); |
582 | bgPixmap.set_target (this); |
584 | bgPixmap.invalidate (); |
583 | bgPixmap.invalidate (); |
585 | |
584 | |
… | |
… | |
840 | run_command (argv); |
839 | run_command (argv); |
841 | } |
840 | } |
842 | |
841 | |
843 | /*----------------------------------------------------------------------*/ |
842 | /*----------------------------------------------------------------------*/ |
844 | void |
843 | void |
845 | rxvt_term::Get_Colours () |
844 | rxvt_term::get_colours () |
846 | { |
845 | { |
847 | int i; |
846 | int i; |
848 | |
847 | |
849 | #ifdef OFF_FOCUS_FADING |
848 | #ifdef OFF_FOCUS_FADING |
850 | pix_colors = pix_colors_focused; |
849 | pix_colors = pix_colors_focused; |
… | |
… | |
1067 | Window top, parent; |
1066 | Window top, parent; |
1068 | |
1067 | |
1069 | dLocal (Display *, dpy); |
1068 | dLocal (Display *, dpy); |
1070 | |
1069 | |
1071 | /* grab colors before netscape does */ |
1070 | /* grab colors before netscape does */ |
1072 | Get_Colours (); |
1071 | get_colours (); |
1073 | |
1072 | |
1074 | if (!set_fonts ()) |
1073 | if (!set_fonts ()) |
1075 | rxvt_fatal ("unable to load base fontset, please specify a valid one using -fn, aborting.\n"); |
1074 | rxvt_fatal ("unable to load base fontset, please specify a valid one using -fn, aborting.\n"); |
1076 | |
1075 | |
1077 | parent = display->root; |
1076 | parent = display->root; |
… | |
… | |
1125 | this->parent[0] = top; |
1124 | this->parent[0] = top; |
1126 | |
1125 | |
1127 | old_width = szHint.width; |
1126 | old_width = szHint.width; |
1128 | old_height = szHint.height; |
1127 | old_height = szHint.height; |
1129 | |
1128 | |
1130 | process_xterm_seq (XTerm_title, rs[Rs_title], CHAR_ST); |
1129 | set_title (rs [Rs_title]); |
1131 | process_xterm_seq (XTerm_iconName, rs[Rs_iconName], CHAR_ST); |
1130 | set_icon_name (rs [Rs_iconName]); |
1132 | |
1131 | |
1133 | classHint.res_name = (char *)rs[Rs_name]; |
1132 | classHint.res_name = (char *)rs[Rs_name]; |
1134 | classHint.res_class = (char *)RESCLASS; |
1133 | classHint.res_class = (char *)RESCLASS; |
1135 | |
1134 | |
1136 | wmHint.flags = InputHint | StateHint | WindowGroupHint; |
1135 | wmHint.flags = InputHint | StateHint | WindowGroupHint; |
… | |
… | |
1138 | wmHint.initial_state = option (Opt_iconic) ? IconicState : NormalState; |
1137 | wmHint.initial_state = option (Opt_iconic) ? IconicState : NormalState; |
1139 | wmHint.window_group = top; |
1138 | wmHint.window_group = top; |
1140 | |
1139 | |
1141 | XmbSetWMProperties (dpy, top, NULL, NULL, (char **)argv, argc, |
1140 | XmbSetWMProperties (dpy, top, NULL, NULL, (char **)argv, argc, |
1142 | &szHint, &wmHint, &classHint); |
1141 | &szHint, &wmHint, &classHint); |
|
|
1142 | #if ENABLE_EWMH |
|
|
1143 | # ifdef HAVE_AFTERIMAGE |
|
|
1144 | /* |
|
|
1145 | * set up icon hint |
|
|
1146 | * rs [Rs_iconfile] is path to icon, asv has been created in init_resources |
|
|
1147 | */ |
|
|
1148 | |
|
|
1149 | if (rs [Rs_iconfile]) |
|
|
1150 | { |
|
|
1151 | init_asv (); |
|
|
1152 | |
|
|
1153 | ASImage *im = file2ASImage (rs [Rs_iconfile], 0xFFFFFFFF, SCREEN_GAMMA, 0, NULL); |
|
|
1154 | if (asv && im) |
|
|
1155 | { |
|
|
1156 | int w = im->width; |
|
|
1157 | int h = im->height; |
|
|
1158 | long* buffer = (long *)malloc ((2 + w * h) * sizeof (long)); |
|
|
1159 | ASImage *result = scale_asimage (asv, im, |
|
|
1160 | w, h, ASA_ARGB32, |
|
|
1161 | 100, ASIMAGE_QUALITY_DEFAULT); |
|
|
1162 | destroy_asimage (&im); |
|
|
1163 | |
|
|
1164 | if (buffer && result) |
|
|
1165 | { |
|
|
1166 | ARGB32 *asbuf = result->alt.argb32; |
|
|
1167 | buffer [0] = w; |
|
|
1168 | buffer [1] = h; |
|
|
1169 | |
|
|
1170 | for (unsigned int i = 0; i < w * h; ++i) |
|
|
1171 | buffer [i + 2] = asbuf [i]; |
|
|
1172 | |
|
|
1173 | destroy_asimage (&result); |
|
|
1174 | XChangeProperty (dpy, top, xa[XA_NET_WM_ICON], XA_CARDINAL, 32, |
|
|
1175 | PropModeReplace, (const unsigned char*) buffer, 2 + w * h); |
|
|
1176 | free (buffer); |
|
|
1177 | } |
|
|
1178 | else |
|
|
1179 | { |
|
|
1180 | if (!buffer) |
|
|
1181 | rxvt_warn ("Memory allocation for icon hint failed, continuing without.\n"); |
|
|
1182 | |
|
|
1183 | if (!result) |
|
|
1184 | rxvt_warn ("Icon image transformation to ARGB failed, continuing without.\n"); |
|
|
1185 | } |
|
|
1186 | } |
|
|
1187 | else |
|
|
1188 | rxvt_warn ("Loading image icon failed, continuing without.\n"); |
|
|
1189 | } |
|
|
1190 | # endif |
|
|
1191 | #endif |
1143 | |
1192 | |
1144 | #if ENABLE_FRILLS |
1193 | #if ENABLE_FRILLS |
1145 | if (mwmhints.flags) |
1194 | if (mwmhints.flags) |
1146 | XChangeProperty (dpy, top, xa[XA_MOTIF_WM_HINTS], xa[XA_MOTIF_WM_HINTS], 32, |
1195 | XChangeProperty (dpy, top, xa[XA_MOTIF_WM_HINTS], xa[XA_MOTIF_WM_HINTS], 32, |
1147 | PropModeReplace, (unsigned char *)&mwmhints, PROP_MWM_HINTS_ELEMENTS); |
1196 | PropModeReplace, (unsigned char *)&mwmhints, PROP_MWM_HINTS_ELEMENTS); |
… | |
… | |
1532 | signal (SIGTSTP, SIG_IGN); |
1581 | signal (SIGTSTP, SIG_IGN); |
1533 | signal (SIGTTIN, SIG_IGN); |
1582 | signal (SIGTTIN, SIG_IGN); |
1534 | signal (SIGTTOU, SIG_IGN); |
1583 | signal (SIGTTOU, SIG_IGN); |
1535 | #endif /* SIGTSTP */ |
1584 | #endif /* SIGTSTP */ |
1536 | |
1585 | |
1537 | // unblock signals (signals are blocked by iom.C |
|
|
1538 | sigset_t ss; |
|
|
1539 | sigemptyset (&ss); |
|
|
1540 | sigprocmask (SIG_SETMASK, &ss, 0); |
|
|
1541 | |
|
|
1542 | /* command interpreter path */ |
1586 | /* command interpreter path */ |
1543 | if (argv) |
1587 | if (argv) |
1544 | { |
1588 | { |
1545 | # ifdef DEBUG_CMD |
1589 | # ifdef DEBUG_CMD |
1546 | int i; |
1590 | int i; |