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.171 by root, Wed Jan 11 03:13:26 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{
284 if (parent[0]) 292 if (parent[0])
285 XDestroyWindow (disp, parent[0]); 293 XDestroyWindow (disp, parent[0]);
286 } 294 }
287 295
288 // TODO: free pixcolours, colours should become part of rxvt_display 296 // TODO: free pixcolours, colours should become part of rxvt_display
289
290 delete pix_colors_focused; 297 delete pix_colors_focused;
291#if OFF_FOCUS_FADING 298#if OFF_FOCUS_FADING
292 delete pix_colors_unfocused; 299 delete pix_colors_unfocused;
293#endif 300#endif
294 301
378} 385}
379 386
380void 387void
381rxvt_term::destroy_cb (time_watcher &w) 388rxvt_term::destroy_cb (time_watcher &w)
382{ 389{
383 SET_R (this); 390 make_current ();
384 391
385 delete this; 392 delete this;
386} 393}
387 394
388/*----------------------------------------------------------------------*/ 395/*----------------------------------------------------------------------*/
479/*----------------------------------------------------------------------*/ 486/*----------------------------------------------------------------------*/
480bool 487bool
481rxvt_term::init (int argc, const char *const *argv) 488rxvt_term::init (int argc, const char *const *argv)
482{ 489{
483 SET_R (this); 490 SET_R (this);
484 TEMP_ENV; // few things in X do not call setlocale :(
485
486 set_locale (""); 491 set_locale ("");
492 set_environ (envv); // few things in X do not call setlocale :(
487 493
488 if (!init_vars ()) 494 if (!init_vars ())
489 return false; 495 return false;
490 496
491 init_secondary (); 497 init_secondary ();
524 rs[Rs_perl_eval] = 0; 530 rs[Rs_perl_eval] = 0;
525 } 531 }
526 } 532 }
527#endif 533#endif
528 rxvt_perl.init (); 534 rxvt_perl.init ();
535 setlocale (LC_CTYPE, curlocale); // perl init destroys current locale
529 HOOK_INVOKE ((this, HOOK_INIT, DT_END)); 536 HOOK_INVOKE ((this, HOOK_INIT, DT_END));
530 } 537 }
531#endif 538#endif
532 539
533 create_windows (argc, argv); 540 create_windows (argc, argv);
616 sw_int (this, &sig_handlers::sig_term) 623 sw_int (this, &sig_handlers::sig_term)
617 { 624 {
618 } 625 }
619} sig_handlers; 626} sig_handlers;
620 627
628char **rxvt_environ; // startup environment
629
621void 630void
622rxvt_init () 631rxvt_init ()
623{ 632{
633 rxvt_environ = environ;
634
624 /* 635 /*
625 * Save and then give up any super-user privileges 636 * Save and then give up any super-user privileges
626 * 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.
627 * We should only need to be root in these cases: 638 * We should only need to be root in these cases:
628 * 1. write utmp entries on some systems 639 * 1. write utmp entries on some systems
704 case IGNORE: 715 case IGNORE:
705 /* 716 /*
706 * change effective uid/gid - not real uid/gid - so we can switch 717 * change effective uid/gid - not real uid/gid - so we can switch
707 * back to root later, as required 718 * back to root later, as required
708 */ 719 */
720 setegid (getgid ());
709 seteuid (getuid ()); 721 seteuid (getuid ());
710 setegid (getgid ());
711 break; 722 break;
712 case SAVE: 723 case SAVE:
724 saved_egid = getegid ();
713 saved_euid = geteuid (); 725 saved_euid = geteuid ();
714 saved_egid = getegid ();
715 break; 726 break;
716 case RESTORE: 727 case RESTORE:
728 setegid (saved_egid);
717 seteuid (saved_euid); 729 seteuid (saved_euid);
718 setegid (saved_egid);
719 break; 730 break;
720 } 731 }
721# else 732# else
722 switch (action) 733 switch (action)
723 { 734 {
724 case IGNORE: 735 case IGNORE:
736 setgid (getgid ());
725 setuid (getuid ()); 737 setuid (getuid ());
726 setgid (getgid ());
727 /* FALLTHROUGH */ 738 /* FALLTHROUGH */
728 case SAVE: 739 case SAVE:
729 /* FALLTHROUGH */ 740 /* FALLTHROUGH */
730 case RESTORE: 741 case RESTORE:
731 break; 742 break;
1447 unsigned long fg, bg; 1458 unsigned long fg, bg;
1448 const char *p; 1459 const char *p;
1449 char **s; 1460 char **s;
1450 XIMStyles *xim_styles; 1461 XIMStyles *xim_styles;
1451 1462
1452 TEMP_ENV; 1463 set_environ (envv);
1453 1464
1454 if (! ((p = XSetLocaleModifiers (modifiers)) && *p)) 1465 if (! ((p = XSetLocaleModifiers (modifiers)) && *p))
1455 return false; 1466 return false;
1456 1467
1457 D_MAIN ((stderr, "rxvt_IM_get_IC ()")); 1468 D_MAIN ((stderr, "rxvt_IM_get_IC ()"));
1623 int i; 1634 int i;
1624 const char *p; 1635 const char *p;
1625 char **s; 1636 char **s;
1626 char buf[IMBUFSIZ]; 1637 char buf[IMBUFSIZ];
1627 1638
1628 SET_R (this); 1639 make_current ();
1629 1640
1630 im_destroy (); 1641 im_destroy ();
1631 1642
1632 D_MAIN ((stderr, "rxvt_IMInstantiateCallback ()")); 1643 D_MAIN ((stderr, "rxvt_IMInstantiateCallback ()"));
1633 if (Input_Context) 1644 if (Input_Context)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines