--- rxvt-unicode/src/main.C 2006/02/12 05:15:43 1.221 +++ rxvt-unicode/src/main.C 2007/06/09 13:04:27 1.234 @@ -1,4 +1,4 @@ -/*--------------------------------*-C-*---------------------------------* +/*----------------------------------------------------------------------* * File: main.C *----------------------------------------------------------------------* * @@ -58,10 +58,15 @@ bool rxvt_set_locale (const char *locale) NOTHROW { - if (!locale || !strncmp (locale, curlocale, 128)) + int size = strlen (locale) + 1; + + if (size > sizeof (curlocale)) + rxvt_fatal ("locale string too long, aborting.\n"); + + if (!locale || !memcmp (locale, curlocale, size)) return false; - strncpy (curlocale, locale, 128); + memcpy (curlocale, locale, size); setlocale (LC_CTYPE, curlocale); return true; } @@ -145,8 +150,9 @@ rxvt_term::rxvt_term () : -#if TRANSPARENT +#if TRANSPARENT || ENABLE_PERL rootwin_ev (this, &rxvt_term::rootwin_cb), + check_our_parents_ev(this, &rxvt_term::check_our_parents_cb), #endif #ifdef HAVE_SCROLLBARS scrollbar_ev (this, &rxvt_term::x_cb), @@ -200,6 +206,7 @@ if (cmd_pid) kill (-cmd_pid, SIGHUP); + pty_ev.stop (); delete pty; pty = 0; } @@ -266,9 +273,9 @@ clear (); } - delete pix_colors_focused; + delete [] pix_colors_focused; #if OFF_FOCUS_FADING - delete pix_colors_unfocused; + delete [] pix_colors_unfocused; #endif displays.put (display); @@ -303,7 +310,7 @@ cmd_pid = 0; - if (!OPTION (Opt_hold)) + if (!option (Opt_hold)) destroy (); } @@ -327,7 +334,7 @@ #if HAVE_SCROLLBARS scrollbar_ev.stop (display); #endif -#if TRANSPARENT +#if TRANSPARENT || ENABLE_PERL rootwin_ev.stop (display); #endif incr_ev.stop (); @@ -477,7 +484,7 @@ #endif #ifdef HAVE_SCROLLBARS - if (OPTION (Opt_scrollBar)) + if (option (Opt_scrollBar)) scrollBar.setIdle (); /* set existence for size calculations */ #endif @@ -494,17 +501,20 @@ #endif #ifdef HAVE_SCROLLBARS - if (OPTION (Opt_scrollBar)) + if (option (Opt_scrollBar)) resize_scrollbar (); /* create and map scrollbar */ #endif #ifdef TRANSPARENT - if (OPTION (Opt_transparent)) + if (option (Opt_transparent)) { XSelectInput (dpy, display->root, PropertyChangeMask); check_our_parents (); rootwin_ev.start (display, display->root); } #endif +#if ENABLE_PERL + rootwin_ev.start (display, display->root); +#endif set_colorfgbg (); @@ -702,7 +712,7 @@ sb_w = scrollbar_TotalWidth (); szHint.base_width += sb_w; - if (!OPTION (Opt_scrollBar_right)) + if (!option (Opt_scrollBar_right)) window_vt_x += sb_w; } @@ -733,7 +743,7 @@ szHint.height = szHint.base_height + height; } - if (scrollBar.state && OPTION (Opt_scrollBar_right)) + if (scrollBar.state && option (Opt_scrollBar_right)) window_sb_x = szHint.width - sb_w; if (recalc_x) @@ -805,7 +815,8 @@ prop = (*fs)[1]->properties (); prop.height += lineSpace; - fs->set_prop (prop); + + fs->set_prop (prop, false); fwidth = prop.width; fheight = prop.height; @@ -824,17 +835,20 @@ rxvt_fontprop prop2 = prop; if (res) - prop2.weight = prop2.slant = rxvt_fontprop::unset; + { + fs->populate (res); + fs->set_prop (prop2, false); + } else { - res = fontset[0]->fontdesc; + fs->populate (fontset[0]->fontdesc); if (SET_STYLE (0, style) & RS_Bold) prop2.weight = rxvt_fontprop::bold; if (SET_STYLE (0, style) & RS_Italic) prop2.slant = rxvt_fontprop::italic; + + fs->set_prop (prop2, true); } - fs->populate (res); - fs->set_prop (prop2); } #else fontset[style] = fontset[0]; @@ -937,18 +951,9 @@ /* XSetWindowAttributes attr; */ /* Cursor cursor; */ done: - -#if OFF_FOCUS_FADING - if (rs[Rs_fade]) - { - rgba c; - pix_colors [Color_fade].get (c); - pix_colors_focused [idx].fade (this, atoi (rs[Rs_fade]), pix_colors_unfocused [idx], c); - } -#endif - /*TODO: handle Color_BD, scrollbar background, etc. */ + update_fade_color (idx); recolour_cursor (); scr_recolour (); } @@ -1623,7 +1628,7 @@ || !IMisRunning ()) return; - if (input_style & XIMPreeditArea) + if (input_style & XIMPreeditPosition) { im_set_size (preedit_rect); preedit_attr = XVaCreateNestedList (0, XNArea, &preedit_rect, NULL);