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.168 by root, Sun Jan 8 08:49:20 2006 UTC vs.
Revision 1.175 by root, Thu Jan 12 00:35:39 2006 UTC

76 strncpy (curlocale, locale, 128); 76 strncpy (curlocale, locale, 128);
77 setlocale (LC_CTYPE, curlocale); 77 setlocale (LC_CTYPE, curlocale);
78 return true; 78 return true;
79} 79}
80 80
81bool 81void
82rxvt_push_locale (const char *locale) 82rxvt_push_locale (const char *locale)
83{ 83{
84 strcpy (savelocale, curlocale); 84 strcpy (savelocale, curlocale);
85 rxvt_set_locale (locale); 85 rxvt_set_locale (locale);
86} 86}
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 ();
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);
483 TEMP_ENV; // few things in X do not call setlocale :(
487 484
488 set_locale (""); 485 set_locale ("");
489 486
490 if (!init_vars ()) 487 if (!init_vars ())
491 return false; 488 return false;
526 rs[Rs_perl_eval] = 0; 523 rs[Rs_perl_eval] = 0;
527 } 524 }
528 } 525 }
529#endif 526#endif
530 rxvt_perl.init (); 527 rxvt_perl.init ();
528 setlocale (LC_CTYPE, curlocale); // perl init destroys this info
531 HOOK_INVOKE ((this, HOOK_INIT, DT_END)); 529 HOOK_INVOKE ((this, HOOK_INIT, DT_END));
532 } 530 }
533#endif 531#endif
534 532
535 create_windows (argc, argv); 533 create_windows (argc, argv);
536 534
537 dDisp; 535 dDisp;
538 536
539 init_xlocale (); 537 init_xlocale ();
540 538
541 scr_reset (); /* initialize screen */ 539 scr_reset (); // initialize screen
542 540
543#if 0 541#if 0
544 XSynchronize (disp, True); 542 XSynchronize (disp, True);
545#endif 543#endif
546 544
618 sw_int (this, &sig_handlers::sig_term) 616 sw_int (this, &sig_handlers::sig_term)
619 { 617 {
620 } 618 }
621} sig_handlers; 619} sig_handlers;
622 620
621char **rxvt_environ; // startup environment
622
623void 623void
624rxvt_init () 624rxvt_init ()
625{ 625{
626 rxvt_environ = environ;
627
626 /* 628 /*
627 * Save and then give up any super-user privileges 629 * Save and then give up any super-user privileges
628 * If we need privileges in any area then we must specifically request it. 630 * If we need privileges in any area then we must specifically request it.
629 * We should only need to be root in these cases: 631 * We should only need to be root in these cases:
630 * 1. write utmp entries on some systems 632 * 1. write utmp entries on some systems
645 647
646 old_xerror_handler = XSetErrorHandler ((XErrorHandler) rxvt_xerror_handler); 648 old_xerror_handler = XSetErrorHandler ((XErrorHandler) rxvt_xerror_handler);
647 // TODO: handle this with exceptions and tolerate the memory loss 649 // TODO: handle this with exceptions and tolerate the memory loss
648 XSetIOErrorHandler (rxvt_xioerror_handler); 650 XSetIOErrorHandler (rxvt_xioerror_handler);
649 651
650#ifdef USE_XGETDEFAULT
651 XrmInitialize (); 652 XrmInitialize ();
652#endif
653} 653}
654 654
655/* ------------------------------------------------------------------------- * 655/* ------------------------------------------------------------------------- *
656 * MEMORY ALLOCATION WRAPPERS * 656 * MEMORY ALLOCATION WRAPPERS *
657 * ------------------------------------------------------------------------- */ 657 * ------------------------------------------------------------------------- */
708 case IGNORE: 708 case IGNORE:
709 /* 709 /*
710 * change effective uid/gid - not real uid/gid - so we can switch 710 * change effective uid/gid - not real uid/gid - so we can switch
711 * back to root later, as required 711 * back to root later, as required
712 */ 712 */
713 setegid (getgid ());
713 seteuid (getuid ()); 714 seteuid (getuid ());
714 setegid (getgid ());
715 break; 715 break;
716 case SAVE: 716 case SAVE:
717 saved_egid = getegid ();
717 saved_euid = geteuid (); 718 saved_euid = geteuid ();
718 saved_egid = getegid ();
719 break; 719 break;
720 case RESTORE: 720 case RESTORE:
721 setegid (saved_egid);
721 seteuid (saved_euid); 722 seteuid (saved_euid);
722 setegid (saved_egid);
723 break; 723 break;
724 } 724 }
725# else 725# else
726 switch (action) 726 switch (action)
727 { 727 {
728 case IGNORE: 728 case IGNORE:
729 setgid (getgid ());
729 setuid (getuid ()); 730 setuid (getuid ());
730 setgid (getgid ());
731 /* FALLTHROUGH */ 731 /* FALLTHROUGH */
732 case SAVE: 732 case SAVE:
733 /* FALLTHROUGH */ 733 /* FALLTHROUGH */
734 case RESTORE: 734 case RESTORE:
735 break; 735 break;
1451 unsigned long fg, bg; 1451 unsigned long fg, bg;
1452 const char *p; 1452 const char *p;
1453 char **s; 1453 char **s;
1454 XIMStyles *xim_styles; 1454 XIMStyles *xim_styles;
1455 1455
1456 TEMP_ENV;
1457
1456 if (! ((p = XSetLocaleModifiers (modifiers)) && *p)) 1458 if (! ((p = XSetLocaleModifiers (modifiers)) && *p))
1457 return false; 1459 return false;
1458 1460
1459 D_MAIN ((stderr, "rxvt_IM_get_IC ()")); 1461 D_MAIN ((stderr, "rxvt_IM_get_IC ()"));
1460 input_method = display->get_xim (locale, modifiers); 1462 input_method = display->get_xim (locale, modifiers);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines