--- rxvt-unicode/src/main.C 2005/12/22 16:44:10 1.152 +++ rxvt-unicode/src/main.C 2006/01/03 23:40:58 1.158 @@ -32,6 +32,8 @@ #include "../config.h" /* NECESSARY */ #include "rxvt.h" /* NECESSARY */ +#include "keyboard.h" +#include "rxvtperl.h" #include @@ -46,13 +48,9 @@ # include #endif -#ifdef KEYSYM_RESOURCE -# include "keyboard.h" -#endif - vector rxvt_term::termlist; -static char curlocale[128]; +static char curlocale[128], savelocale[128]; bool rxvt_set_locale (const char *locale) @@ -65,6 +63,19 @@ return true; } +bool +rxvt_push_locale (const char *locale) +{ + strcpy (savelocale, curlocale); + rxvt_set_locale (locale); +} + +void +rxvt_pop_locale () +{ + rxvt_set_locale (savelocale); +} + #if ENABLE_COMBINING class rxvt_composite_vec rxvt_composite; @@ -197,6 +208,8 @@ rxvt_term::~rxvt_term () { + PERL_INVOKE ((this, HOOK_DESTROY, DT_END)); + termlist.erase (find (termlist.begin (), termlist.end(), this)); emergency_cleanup (); @@ -295,7 +308,7 @@ { cmd_pid = 0; - if (!(options & Opt_hold)) + if (!OPTION (Opt_hold)) destroy (); } @@ -471,10 +484,18 @@ menubar_read (rs[Rs_menu]); #endif #ifdef HAVE_SCROLLBARS - if (options & Opt_scrollBar) + if (OPTION (Opt_scrollBar)) scrollBar.setIdle (); /* set existence for size calculations */ #endif +#if ENABLE_PERL + if (rs[Rs_perl_ext] && *rs[Rs_perl_ext]) + { + rxvt_perl.init (); + PERL_INVOKE ((this, HOOK_INIT, DT_END)); + } +#endif + create_windows (argc, argv); dDisp; @@ -488,7 +509,7 @@ #endif #ifdef HAVE_SCROLLBARS - if (options & Opt_scrollBar) + if (OPTION (Opt_scrollBar)) resize_scrollbar (); /* create and map scrollbar */ #endif #if (MENUBAR_MAX) @@ -496,7 +517,7 @@ XMapWindow (disp, menuBar.win); #endif #ifdef TRANSPARENT - if (options & Opt_transparent) + if (OPTION (Opt_transparent)) { XSelectInput (disp, display->root, PropertyChangeMask); check_our_parents (); @@ -517,6 +538,8 @@ check_ev.start (); + PERL_INVOKE ((this, HOOK_START, DT_END)); + return true; } @@ -683,7 +706,7 @@ void rxvt_term::privileged_utmp (rxvt_privaction action) { - if ((options & Opt_utmpInhibit) + if (OPTION (Opt_utmpInhibit) || !pty.name || !*pty.name) return; @@ -785,7 +808,7 @@ { sb_w = scrollbar_TotalWidth (); szHint.base_width += sb_w; - if (!(options & Opt_scrollBar_right)) + if (!OPTION (Opt_scrollBar_right)) window_vt_x += sb_w; } @@ -823,7 +846,7 @@ szHint.height = szHint.base_height + height; } - if (scrollbar_visible () && (options & Opt_scrollBar_right)) + if (scrollbar_visible () && OPTION (Opt_scrollBar_right)) window_sb_x = szHint.width - sb_w; if (recalc_x) @@ -902,7 +925,7 @@ fwidth = prop.width; fheight = prop.height; - fbase = (*fs)[1]->ascent; + fbase = prop.ascent; for (int style = 1; style < 4; style++) { @@ -946,7 +969,6 @@ void rxvt_term::set_string_property (Atom prop, const char *str, int len) { - // TODO: SMART_WINDOW_TITLE XChangeProperty (display->display, parent[0], prop, XA_STRING, 8, PropModeReplace, (const unsigned char *)str, len >= 0 ? len : strlen (str)); @@ -954,7 +976,6 @@ void rxvt_term::set_utf8_property (Atom prop, const char *str, int len) { - // TODO: SMART_WINDOW_TITLE wchar_t *ws = rxvt_mbstowcs (str, len); char *s = rxvt_wcstoutf8 (ws);