ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/main.C
(Generate patch)

Comparing rxvt-unicode/src/main.C (file contents):
Revision 1.174 by root, Thu Jan 12 00:11:13 2006 UTC vs.
Revision 1.177 by root, Mon Jan 16 06:37:52 2006 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines