… | |
… | |
377 | } |
377 | } |
378 | |
378 | |
379 | void |
379 | void |
380 | rxvt_term::destroy_cb (time_watcher &w) |
380 | rxvt_term::destroy_cb (time_watcher &w) |
381 | { |
381 | { |
382 | SET_R (this); |
382 | make_current (); |
383 | |
383 | |
384 | delete this; |
384 | delete this; |
385 | } |
385 | } |
386 | |
386 | |
387 | /*----------------------------------------------------------------------*/ |
387 | /*----------------------------------------------------------------------*/ |
… | |
… | |
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 :( |
|
|
488 | |
|
|
489 | set_locale (""); |
483 | set_locale (""); |
|
|
484 | set_environ (envv); // few things in X do not call setlocale :( |
490 | |
485 | |
491 | if (!init_vars ()) |
486 | if (!init_vars ()) |
492 | return false; |
487 | return false; |
493 | |
488 | |
494 | init_secondary (); |
489 | init_secondary (); |
495 | |
490 | |
496 | cmd_argv = init_resources (argc, argv); |
491 | const char **cmd_argv = init_resources (argc, argv); |
497 | |
492 | |
498 | #ifdef KEYSYM_RESOURCE |
493 | #ifdef KEYSYM_RESOURCE |
499 | keyboard->register_done (); |
494 | keyboard->register_done (); |
500 | #endif |
495 | #endif |
501 | |
496 | |
502 | #if MENUBAR_MAX |
497 | #if MENUBAR_MAX |
503 | menubar_read (rs[Rs_menu]); |
498 | menubar_read (rs[Rs_menu]); |
504 | #endif |
499 | #endif |
505 | #ifdef HAVE_SCROLLBARS |
500 | #ifdef HAVE_SCROLLBARS |
506 | if (OPTION (Opt_scrollBar)) |
501 | if (OPTION (Opt_scrollBar)) |
507 | scrollBar.setIdle (); /* set existence for size calculations */ |
502 | scrollBar.setIdle (); /* set existence for size calculations */ |
508 | #endif |
503 | #endif |
509 | } |
|
|
510 | |
504 | |
511 | #if ENABLE_PERL |
505 | #if ENABLE_PERL |
512 | if (!rs[Rs_perl_ext_1]) |
506 | if (!rs[Rs_perl_ext_1]) |
513 | rs[Rs_perl_ext_1] = "default"; |
507 | rs[Rs_perl_ext_1] = "default"; |
514 | |
508 | |
… | |
… | |
528 | rs[Rs_perl_eval] = 0; |
522 | rs[Rs_perl_eval] = 0; |
529 | } |
523 | } |
530 | } |
524 | } |
531 | #endif |
525 | #endif |
532 | rxvt_perl.init (); |
526 | rxvt_perl.init (); |
533 | setlocale (LC_CTYPE, curlocale); // perl destroys this info |
527 | setlocale (LC_CTYPE, curlocale); // perl init destroys current locale |
534 | HOOK_INVOKE ((this, HOOK_INIT, DT_END)); |
528 | HOOK_INVOKE ((this, HOOK_INIT, DT_END)); |
535 | } |
529 | } |
536 | #endif |
530 | #endif |
537 | |
531 | |
538 | { |
|
|
539 | TEMP_ENV; |
|
|
540 | |
|
|
541 | create_windows (argc, argv); |
532 | create_windows (argc, argv); |
542 | |
533 | |
543 | dDisp; |
534 | dDisp; |
544 | |
535 | |
545 | init_xlocale (); |
536 | init_xlocale (); |
546 | |
537 | |
547 | scr_reset (); // initialize screen |
538 | scr_reset (); // initialize screen |
548 | |
539 | |
549 | #if 0 |
540 | #if 0 |
550 | XSynchronize (disp, True); |
541 | XSynchronize (disp, True); |
551 | #endif |
542 | #endif |
552 | |
543 | |
553 | #ifdef HAVE_SCROLLBARS |
544 | #ifdef HAVE_SCROLLBARS |
554 | if (OPTION (Opt_scrollBar)) |
545 | if (OPTION (Opt_scrollBar)) |
555 | resize_scrollbar (); /* create and map scrollbar */ |
546 | resize_scrollbar (); /* create and map scrollbar */ |
556 | #endif |
547 | #endif |
557 | #if (MENUBAR_MAX) |
548 | #if (MENUBAR_MAX) |
558 | if (menubar_visible ()) |
549 | if (menubar_visible ()) |
559 | XMapWindow (disp, menuBar.win); |
550 | XMapWindow (disp, menuBar.win); |
560 | #endif |
551 | #endif |
561 | #ifdef TRANSPARENT |
552 | #ifdef TRANSPARENT |
562 | if (OPTION (Opt_transparent)) |
553 | if (OPTION (Opt_transparent)) |
563 | { |
554 | { |
564 | XSelectInput (disp, display->root, PropertyChangeMask); |
555 | XSelectInput (disp, display->root, PropertyChangeMask); |
565 | check_our_parents (); |
556 | check_our_parents (); |
566 | rootwin_ev.start (display, display->root); |
557 | rootwin_ev.start (display, display->root); |
567 | } |
558 | } |
568 | #endif |
559 | #endif |
569 | |
560 | |
570 | XMapWindow (disp, vt); |
561 | XMapWindow (disp, vt); |
571 | XMapWindow (disp, parent[0]); |
562 | XMapWindow (disp, parent[0]); |
572 | |
563 | |
573 | set_colorfgbg (); |
564 | set_colorfgbg (); |
574 | |
565 | |
575 | init_command (cmd_argv); |
566 | init_command (cmd_argv); |
576 | |
567 | |
577 | free (cmd_argv); |
568 | free (cmd_argv); |
578 | |
569 | |
579 | if (pty.pty >= 0) |
570 | if (pty.pty >= 0) |
580 | pty_ev.start (pty.pty, EVENT_READ); |
571 | pty_ev.start (pty.pty, EVENT_READ); |
581 | |
572 | |
582 | check_ev.start (); |
573 | check_ev.start (); |
583 | |
574 | |
584 | HOOK_INVOKE ((this, HOOK_START, DT_END)); |
575 | HOOK_INVOKE ((this, HOOK_START, DT_END)); |
585 | } |
|
|
586 | |
576 | |
587 | return true; |
577 | return true; |
588 | } |
578 | } |
589 | |
579 | |
590 | static struct sig_handlers |
580 | static struct sig_handlers |
… | |
… | |
625 | sw_int (this, &sig_handlers::sig_term) |
615 | sw_int (this, &sig_handlers::sig_term) |
626 | { |
616 | { |
627 | } |
617 | } |
628 | } sig_handlers; |
618 | } sig_handlers; |
629 | |
619 | |
|
|
620 | char **rxvt_environ; // startup environment |
|
|
621 | |
630 | void |
622 | void |
631 | rxvt_init () |
623 | rxvt_init () |
632 | { |
624 | { |
|
|
625 | rxvt_environ = environ; |
|
|
626 | |
633 | /* |
627 | /* |
634 | * Save and then give up any super-user privileges |
628 | * Save and then give up any super-user privileges |
635 | * If we need privileges in any area then we must specifically request it. |
629 | * If we need privileges in any area then we must specifically request it. |
636 | * We should only need to be root in these cases: |
630 | * We should only need to be root in these cases: |
637 | * 1. write utmp entries on some systems |
631 | * 1. write utmp entries on some systems |
… | |
… | |
1456 | unsigned long fg, bg; |
1450 | unsigned long fg, bg; |
1457 | const char *p; |
1451 | const char *p; |
1458 | char **s; |
1452 | char **s; |
1459 | XIMStyles *xim_styles; |
1453 | XIMStyles *xim_styles; |
1460 | |
1454 | |
1461 | TEMP_ENV; |
1455 | set_environ (envv); |
1462 | |
1456 | |
1463 | if (! ((p = XSetLocaleModifiers (modifiers)) && *p)) |
1457 | if (! ((p = XSetLocaleModifiers (modifiers)) && *p)) |
1464 | return false; |
1458 | return false; |
1465 | |
1459 | |
1466 | D_MAIN ((stderr, "rxvt_IM_get_IC ()")); |
1460 | D_MAIN ((stderr, "rxvt_IM_get_IC ()")); |
… | |
… | |
1632 | int i; |
1626 | int i; |
1633 | const char *p; |
1627 | const char *p; |
1634 | char **s; |
1628 | char **s; |
1635 | char buf[IMBUFSIZ]; |
1629 | char buf[IMBUFSIZ]; |
1636 | |
1630 | |
1637 | SET_R (this); |
1631 | make_current (); |
1638 | |
1632 | |
1639 | im_destroy (); |
1633 | im_destroy (); |
1640 | |
1634 | |
1641 | D_MAIN ((stderr, "rxvt_IMInstantiateCallback ()")); |
1635 | D_MAIN ((stderr, "rxvt_IMInstantiateCallback ()")); |
1642 | if (Input_Context) |
1636 | if (Input_Context) |