--- rxvt-unicode/src/main.C 2005/12/18 00:59:42 1.149 +++ rxvt-unicode/src/main.C 2006/01/03 18:11:34 1.157 @@ -32,6 +32,10 @@ #include "../config.h" /* NECESSARY */ #include "rxvt.h" /* NECESSARY */ +#include "keyboard.h" +#include "rxvtperl.h" + +#include #include #include @@ -44,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) @@ -63,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; @@ -195,6 +208,8 @@ rxvt_term::~rxvt_term () { + PERL_INVOKE ((this, HOOK_DESTROY, DT_END)); + termlist.erase (find (termlist.begin (), termlist.end(), this)); emergency_cleanup (); @@ -289,6 +304,15 @@ } void +rxvt_term::child_exit () +{ + cmd_pid = 0; + + if (!OPTION (Opt_hold)) + destroy (); +} + +void rxvt_term::destroy () { if (destroy_ev.active) @@ -460,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; @@ -477,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) @@ -485,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 (); @@ -506,6 +538,8 @@ check_ev.start (); + PERL_INVOKE ((this, HOOK_START, DT_END)); + return true; } @@ -522,7 +556,7 @@ for (rxvt_term **t = rxvt_term::termlist.begin (); t < rxvt_term::termlist.end (); t++) if (pid == (*t)->cmd_pid) { - (*t)->destroy (); + (*t)->child_exit (); break; } } @@ -672,7 +706,7 @@ void rxvt_term::privileged_utmp (rxvt_privaction action) { - if ((options & Opt_utmpInhibit) + if (OPTION (Opt_utmpInhibit) || !pty.name || !*pty.name) return; @@ -720,13 +754,13 @@ if (flags & WidthValue) { - ncol = BOUND_POSITIVE_INT16 (w); + ncol = clamp (w, 0, std::numeric_limits::max ()); szHint.flags |= USSize; } if (flags & HeightValue) { - nrow = BOUND_POSITIVE_INT16 (h); + nrow = clamp (h, 0, std::numeric_limits::max ()); szHint.flags |= USSize; } @@ -774,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; } @@ -797,7 +831,7 @@ } else { - MIN_IT (width, max_width); + min_it (width, max_width); szHint.width = szHint.base_width + width; } @@ -808,11 +842,11 @@ } else { - MIN_IT (height, max_height); + min_it (height, max_height); 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) @@ -891,8 +925,6 @@ fwidth = prop.width; fheight = prop.height; - fweight = prop.weight; - fslant = prop.slant; fbase = (*fs)[1]->ascent; for (int style = 1; style < 4; style++) @@ -937,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)); @@ -945,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);