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.170 by root, Wed Jan 11 00:59:58 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
485 set_locale (""); 483 set_locale ("");
484 set_environ (envv); // few things in X do not call setlocale :(
486 485
487 if (!init_vars ()) 486 if (!init_vars ())
488 return false; 487 return false;
489 488
490 init_secondary (); 489 init_secondary ();
523 rs[Rs_perl_eval] = 0; 522 rs[Rs_perl_eval] = 0;
524 } 523 }
525 } 524 }
526#endif 525#endif
527 rxvt_perl.init (); 526 rxvt_perl.init ();
527 setlocale (LC_CTYPE, curlocale); // perl init destroys current locale
528 HOOK_INVOKE ((this, HOOK_INIT, DT_END)); 528 HOOK_INVOKE ((this, HOOK_INIT, DT_END));
529 } 529 }
530#endif 530#endif
531 531
532 create_windows (argc, argv); 532 create_windows (argc, argv);
533 533
534 dDisp; 534 dDisp;
535 535
536 init_xlocale (); 536 init_xlocale ();
537 537
538 scr_reset (); /* initialize screen */ 538 scr_reset (); // initialize screen
539 539
540#if 0 540#if 0
541 XSynchronize (disp, True); 541 XSynchronize (disp, True);
542#endif 542#endif
543 543
615 sw_int (this, &sig_handlers::sig_term) 615 sw_int (this, &sig_handlers::sig_term)
616 { 616 {
617 } 617 }
618} sig_handlers; 618} sig_handlers;
619 619
620char **rxvt_environ; // startup environment
621
620void 622void
621rxvt_init () 623rxvt_init ()
622{ 624{
625 rxvt_environ = environ;
626
623 /* 627 /*
624 * Save and then give up any super-user privileges 628 * Save and then give up any super-user privileges
625 * 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.
626 * We should only need to be root in these cases: 630 * We should only need to be root in these cases:
627 * 1. write utmp entries on some systems 631 * 1. write utmp entries on some systems
703 case IGNORE: 707 case IGNORE:
704 /* 708 /*
705 * 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
706 * back to root later, as required 710 * back to root later, as required
707 */ 711 */
712 setegid (getgid ());
708 seteuid (getuid ()); 713 seteuid (getuid ());
709 setegid (getgid ());
710 break; 714 break;
711 case SAVE: 715 case SAVE:
716 saved_egid = getegid ();
712 saved_euid = geteuid (); 717 saved_euid = geteuid ();
713 saved_egid = getegid ();
714 break; 718 break;
715 case RESTORE: 719 case RESTORE:
720 setegid (saved_egid);
716 seteuid (saved_euid); 721 seteuid (saved_euid);
717 setegid (saved_egid);
718 break; 722 break;
719 } 723 }
720# else 724# else
721 switch (action) 725 switch (action)
722 { 726 {
723 case IGNORE: 727 case IGNORE:
728 setgid (getgid ());
724 setuid (getuid ()); 729 setuid (getuid ());
725 setgid (getgid ());
726 /* FALLTHROUGH */ 730 /* FALLTHROUGH */
727 case SAVE: 731 case SAVE:
728 /* FALLTHROUGH */ 732 /* FALLTHROUGH */
729 case RESTORE: 733 case RESTORE:
730 break; 734 break;
1446 unsigned long fg, bg; 1450 unsigned long fg, bg;
1447 const char *p; 1451 const char *p;
1448 char **s; 1452 char **s;
1449 XIMStyles *xim_styles; 1453 XIMStyles *xim_styles;
1450 1454
1455 set_environ (envv);
1456
1451 if (! ((p = XSetLocaleModifiers (modifiers)) && *p)) 1457 if (! ((p = XSetLocaleModifiers (modifiers)) && *p))
1452 return false; 1458 return false;
1453 1459
1454 D_MAIN ((stderr, "rxvt_IM_get_IC ()")); 1460 D_MAIN ((stderr, "rxvt_IM_get_IC ()"));
1455 input_method = display->get_xim (locale, modifiers); 1461 input_method = display->get_xim (locale, modifiers);
1620 int i; 1626 int i;
1621 const char *p; 1627 const char *p;
1622 char **s; 1628 char **s;
1623 char buf[IMBUFSIZ]; 1629 char buf[IMBUFSIZ];
1624 1630
1625 SET_R (this); 1631 make_current ();
1626 1632
1627 im_destroy (); 1633 im_destroy ();
1628 1634
1629 D_MAIN ((stderr, "rxvt_IMInstantiateCallback ()")); 1635 D_MAIN ((stderr, "rxvt_IMInstantiateCallback ()"));
1630 if (Input_Context) 1636 if (Input_Context)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines