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.169 by root, Tue Jan 10 18:09:22 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
294#if USE_XGETDEFAULT
295 XrmDestroyDatabase (xrmdatabase);
296#endif 292#endif
297 293
298 displays.put (display); 294 displays.put (display);
299 295
300 scr_release (); 296 scr_release ();
381} 377}
382 378
383void 379void
384rxvt_term::destroy_cb (time_watcher &w) 380rxvt_term::destroy_cb (time_watcher &w)
385{ 381{
386 SET_R (this); 382 make_current ();
387 383
388 delete this; 384 delete this;
389} 385}
390 386
391/*----------------------------------------------------------------------*/ 387/*----------------------------------------------------------------------*/
482/*----------------------------------------------------------------------*/ 478/*----------------------------------------------------------------------*/
483bool 479bool
484rxvt_term::init (int argc, const char *const *argv) 480rxvt_term::init (int argc, const char *const *argv)
485{ 481{
486 SET_R (this); 482 SET_R (this);
487
488 set_locale (""); 483 set_locale ("");
484 set_environ (envv); // few things in X do not call setlocale :(
489 485
490 if (!init_vars ()) 486 if (!init_vars ())
491 return false; 487 return false;
492 488
493 init_secondary (); 489 init_secondary ();
526 rs[Rs_perl_eval] = 0; 522 rs[Rs_perl_eval] = 0;
527 } 523 }
528 } 524 }
529#endif 525#endif
530 rxvt_perl.init (); 526 rxvt_perl.init ();
527 setlocale (LC_CTYPE, curlocale); // perl init destroys current locale
531 HOOK_INVOKE ((this, HOOK_INIT, DT_END)); 528 HOOK_INVOKE ((this, HOOK_INIT, DT_END));
532 } 529 }
533#endif 530#endif
534 531
535 create_windows (argc, argv); 532 create_windows (argc, argv);
536 533
537 dDisp; 534 dDisp;
538 535
539 init_xlocale (); 536 init_xlocale ();
540 537
541 scr_reset (); /* initialize screen */ 538 scr_reset (); // initialize screen
542 539
543#if 0 540#if 0
544 XSynchronize (disp, True); 541 XSynchronize (disp, True);
545#endif 542#endif
546 543
618 sw_int (this, &sig_handlers::sig_term) 615 sw_int (this, &sig_handlers::sig_term)
619 { 616 {
620 } 617 }
621} sig_handlers; 618} sig_handlers;
622 619
620char **rxvt_environ; // startup environment
621
623void 622void
624rxvt_init () 623rxvt_init ()
625{ 624{
625 rxvt_environ = environ;
626
626 /* 627 /*
627 * Save and then give up any super-user privileges 628 * Save and then give up any super-user privileges
628 * 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.
629 * We should only need to be root in these cases: 630 * We should only need to be root in these cases:
630 * 1. write utmp entries on some systems 631 * 1. write utmp entries on some systems
645 646
646 old_xerror_handler = XSetErrorHandler ((XErrorHandler) rxvt_xerror_handler); 647 old_xerror_handler = XSetErrorHandler ((XErrorHandler) rxvt_xerror_handler);
647 // TODO: handle this with exceptions and tolerate the memory loss 648 // TODO: handle this with exceptions and tolerate the memory loss
648 XSetIOErrorHandler (rxvt_xioerror_handler); 649 XSetIOErrorHandler (rxvt_xioerror_handler);
649 650
650#ifdef USE_XGETDEFAULT
651 XrmInitialize (); 651 XrmInitialize ();
652#endif
653} 652}
654 653
655/* ------------------------------------------------------------------------- * 654/* ------------------------------------------------------------------------- *
656 * MEMORY ALLOCATION WRAPPERS * 655 * MEMORY ALLOCATION WRAPPERS *
657 * ------------------------------------------------------------------------- */ 656 * ------------------------------------------------------------------------- */
708 case IGNORE: 707 case IGNORE:
709 /* 708 /*
710 * 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
711 * back to root later, as required 710 * back to root later, as required
712 */ 711 */
712 setegid (getgid ());
713 seteuid (getuid ()); 713 seteuid (getuid ());
714 setegid (getgid ());
715 break; 714 break;
716 case SAVE: 715 case SAVE:
716 saved_egid = getegid ();
717 saved_euid = geteuid (); 717 saved_euid = geteuid ();
718 saved_egid = getegid ();
719 break; 718 break;
720 case RESTORE: 719 case RESTORE:
720 setegid (saved_egid);
721 seteuid (saved_euid); 721 seteuid (saved_euid);
722 setegid (saved_egid);
723 break; 722 break;
724 } 723 }
725# else 724# else
726 switch (action) 725 switch (action)
727 { 726 {
728 case IGNORE: 727 case IGNORE:
728 setgid (getgid ());
729 setuid (getuid ()); 729 setuid (getuid ());
730 setgid (getgid ());
731 /* FALLTHROUGH */ 730 /* FALLTHROUGH */
732 case SAVE: 731 case SAVE:
733 /* FALLTHROUGH */ 732 /* FALLTHROUGH */
734 case RESTORE: 733 case RESTORE:
735 break; 734 break;
1451 unsigned long fg, bg; 1450 unsigned long fg, bg;
1452 const char *p; 1451 const char *p;
1453 char **s; 1452 char **s;
1454 XIMStyles *xim_styles; 1453 XIMStyles *xim_styles;
1455 1454
1455 set_environ (envv);
1456
1456 if (! ((p = XSetLocaleModifiers (modifiers)) && *p)) 1457 if (! ((p = XSetLocaleModifiers (modifiers)) && *p))
1457 return false; 1458 return false;
1458 1459
1459 D_MAIN ((stderr, "rxvt_IM_get_IC ()")); 1460 D_MAIN ((stderr, "rxvt_IM_get_IC ()"));
1460 input_method = display->get_xim (locale, modifiers); 1461 input_method = display->get_xim (locale, modifiers);
1625 int i; 1626 int i;
1626 const char *p; 1627 const char *p;
1627 char **s; 1628 char **s;
1628 char buf[IMBUFSIZ]; 1629 char buf[IMBUFSIZ];
1629 1630
1630 SET_R (this); 1631 make_current ();
1631 1632
1632 im_destroy (); 1633 im_destroy ();
1633 1634
1634 D_MAIN ((stderr, "rxvt_IMInstantiateCallback ()")); 1635 D_MAIN ((stderr, "rxvt_IMInstantiateCallback ()"));
1635 if (Input_Context) 1636 if (Input_Context)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines