… | |
… | |
478 | /*----------------------------------------------------------------------*/ |
478 | /*----------------------------------------------------------------------*/ |
479 | bool |
479 | bool |
480 | rxvt_term::init (int argc, const char *const *argv) |
480 | rxvt_term::init (int argc, const char *const *argv) |
481 | { |
481 | { |
482 | SET_R (this); |
482 | SET_R (this); |
483 | |
|
|
484 | const char **cmd_argv; |
|
|
485 | |
|
|
486 | { |
|
|
487 | TEMP_ENV; // few things in X do not call setlocale :( |
483 | TEMP_ENV; // few things in X do not call setlocale :( |
488 | |
484 | |
489 | set_locale (""); |
485 | set_locale (""); |
490 | |
486 | |
491 | if (!init_vars ()) |
487 | if (!init_vars ()) |
492 | return false; |
488 | return false; |
493 | |
489 | |
494 | init_secondary (); |
490 | init_secondary (); |
495 | |
491 | |
496 | cmd_argv = init_resources (argc, argv); |
492 | const char **cmd_argv = init_resources (argc, argv); |
497 | |
493 | |
498 | #ifdef KEYSYM_RESOURCE |
494 | #ifdef KEYSYM_RESOURCE |
499 | keyboard->register_done (); |
495 | keyboard->register_done (); |
500 | #endif |
496 | #endif |
501 | |
497 | |
502 | #if MENUBAR_MAX |
498 | #if MENUBAR_MAX |
503 | menubar_read (rs[Rs_menu]); |
499 | menubar_read (rs[Rs_menu]); |
504 | #endif |
500 | #endif |
505 | #ifdef HAVE_SCROLLBARS |
501 | #ifdef HAVE_SCROLLBARS |
506 | if (OPTION (Opt_scrollBar)) |
502 | if (OPTION (Opt_scrollBar)) |
507 | scrollBar.setIdle (); /* set existence for size calculations */ |
503 | scrollBar.setIdle (); /* set existence for size calculations */ |
508 | #endif |
504 | #endif |
509 | } |
|
|
510 | |
505 | |
511 | #if ENABLE_PERL |
506 | #if ENABLE_PERL |
512 | if (!rs[Rs_perl_ext_1]) |
507 | if (!rs[Rs_perl_ext_1]) |
513 | rs[Rs_perl_ext_1] = "default"; |
508 | rs[Rs_perl_ext_1] = "default"; |
514 | |
509 | |
… | |
… | |
528 | rs[Rs_perl_eval] = 0; |
523 | rs[Rs_perl_eval] = 0; |
529 | } |
524 | } |
530 | } |
525 | } |
531 | #endif |
526 | #endif |
532 | rxvt_perl.init (); |
527 | rxvt_perl.init (); |
533 | setlocale (LC_CTYPE, curlocale); // perl destroys this info |
528 | setlocale (LC_CTYPE, curlocale); // perl init destroys this info |
534 | HOOK_INVOKE ((this, HOOK_INIT, DT_END)); |
529 | HOOK_INVOKE ((this, HOOK_INIT, DT_END)); |
535 | } |
530 | } |
536 | #endif |
531 | #endif |
537 | |
532 | |
538 | { |
|
|
539 | TEMP_ENV; |
|
|
540 | |
|
|
541 | create_windows (argc, argv); |
533 | create_windows (argc, argv); |
542 | |
534 | |
543 | dDisp; |
535 | dDisp; |
544 | |
536 | |
545 | init_xlocale (); |
537 | init_xlocale (); |
546 | |
538 | |
547 | scr_reset (); // initialize screen |
539 | scr_reset (); // initialize screen |
548 | |
540 | |
549 | #if 0 |
541 | #if 0 |
550 | XSynchronize (disp, True); |
542 | XSynchronize (disp, True); |
551 | #endif |
543 | #endif |
552 | |
544 | |
553 | #ifdef HAVE_SCROLLBARS |
545 | #ifdef HAVE_SCROLLBARS |
554 | if (OPTION (Opt_scrollBar)) |
546 | if (OPTION (Opt_scrollBar)) |
555 | resize_scrollbar (); /* create and map scrollbar */ |
547 | resize_scrollbar (); /* create and map scrollbar */ |
556 | #endif |
548 | #endif |
557 | #if (MENUBAR_MAX) |
549 | #if (MENUBAR_MAX) |
558 | if (menubar_visible ()) |
550 | if (menubar_visible ()) |
559 | XMapWindow (disp, menuBar.win); |
551 | XMapWindow (disp, menuBar.win); |
560 | #endif |
552 | #endif |
561 | #ifdef TRANSPARENT |
553 | #ifdef TRANSPARENT |
562 | if (OPTION (Opt_transparent)) |
554 | if (OPTION (Opt_transparent)) |
563 | { |
555 | { |
564 | XSelectInput (disp, display->root, PropertyChangeMask); |
556 | XSelectInput (disp, display->root, PropertyChangeMask); |
565 | check_our_parents (); |
557 | check_our_parents (); |
566 | rootwin_ev.start (display, display->root); |
558 | rootwin_ev.start (display, display->root); |
567 | } |
559 | } |
568 | #endif |
560 | #endif |
569 | |
561 | |
570 | XMapWindow (disp, vt); |
562 | XMapWindow (disp, vt); |
571 | XMapWindow (disp, parent[0]); |
563 | XMapWindow (disp, parent[0]); |
572 | |
564 | |
573 | set_colorfgbg (); |
565 | set_colorfgbg (); |
574 | |
566 | |
575 | init_command (cmd_argv); |
567 | init_command (cmd_argv); |
576 | |
568 | |
577 | free (cmd_argv); |
569 | free (cmd_argv); |
578 | |
570 | |
579 | if (pty.pty >= 0) |
571 | if (pty.pty >= 0) |
580 | pty_ev.start (pty.pty, EVENT_READ); |
572 | pty_ev.start (pty.pty, EVENT_READ); |
581 | |
573 | |
582 | check_ev.start (); |
574 | check_ev.start (); |
583 | |
575 | |
584 | HOOK_INVOKE ((this, HOOK_START, DT_END)); |
576 | HOOK_INVOKE ((this, HOOK_START, DT_END)); |
585 | } |
|
|
586 | |
577 | |
587 | return true; |
578 | return true; |
588 | } |
579 | } |
589 | |
580 | |
590 | static struct sig_handlers |
581 | static struct sig_handlers |
… | |
… | |
625 | sw_int (this, &sig_handlers::sig_term) |
616 | sw_int (this, &sig_handlers::sig_term) |
626 | { |
617 | { |
627 | } |
618 | } |
628 | } sig_handlers; |
619 | } sig_handlers; |
629 | |
620 | |
|
|
621 | char **rxvt_environ; // startup environment |
|
|
622 | |
630 | void |
623 | void |
631 | rxvt_init () |
624 | rxvt_init () |
632 | { |
625 | { |
|
|
626 | rxvt_environ = environ; |
|
|
627 | |
633 | /* |
628 | /* |
634 | * Save and then give up any super-user privileges |
629 | * Save and then give up any super-user privileges |
635 | * If we need privileges in any area then we must specifically request it. |
630 | * If we need privileges in any area then we must specifically request it. |
636 | * We should only need to be root in these cases: |
631 | * We should only need to be root in these cases: |
637 | * 1. write utmp entries on some systems |
632 | * 1. write utmp entries on some systems |