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.178 by root, Mon Jan 16 08:29:57 2006 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines