--- rxvt-unicode/src/init.C 2004/05/09 18:19:49 1.51 +++ rxvt-unicode/src/init.C 2004/07/30 16:13:46 1.65 @@ -326,14 +326,13 @@ #ifdef OPTION_HC NULL, #endif -#if TINTING - NULL, -#endif #ifdef KEEP_SCROLLCOLOR COLOR_SCROLLBAR, COLOR_SCROLLTROUGH, #endif /* KEEP_SCROLLCOLOR */ - +#if TINTING + NULL, +#endif }; const char *const xa_names[NUM_XA] = @@ -360,7 +359,12 @@ bool rxvt_term::init_vars () { - PixColors = new rxvt_color [TOTAL_COLORS]; + PixColorsFocused = new rxvt_color [TOTAL_COLORS]; +#ifdef OFF_FOCUS_FADING + PixColorsUnFocused = new rxvt_color [TOTAL_COLORS]; +#endif + PixColors = PixColorsFocused; + if (PixColors == NULL) return false; @@ -755,7 +759,16 @@ { #if HAVE_XSETLOCALE || HAVE_SETLOCALE free (this->locale); - this->locale = rxvt_strdup (setlocale (LC_CTYPE, locale)); + this->locale = setlocale (LC_CTYPE, locale); + + if (!this->locale) + { + rxvt_warn ("unable to set locale \"%s\", using default locale instead.\n", locale); + setlocale (LC_CTYPE, ""); + this->locale = ""; + } + + this->locale = rxvt_strdup (this->locale); SET_LOCALE (this->locale); mbstate.reset (); #endif @@ -828,11 +841,11 @@ get_ourmods (); - if (! (Options & Opt_scrollTtyOutput)) + if (!(Options & Opt_scrollTtyOutput)) PrivateModes |= PrivMode_TtyOutputInh; if (Options & Opt_scrollTtyKeypress) PrivateModes |= PrivMode_Keypress; - if (! (Options & Opt_jumpScroll)) + if (!(Options & Opt_jumpScroll)) PrivateModes |= PrivMode_smoothScroll; #ifndef NO_BACKSPACE_KEY @@ -867,6 +880,10 @@ { int i; +#ifdef OFF_FOCUS_FADING + PixColors = PixColorsFocused; +#endif + for (i = 0; i < (XDEPTH <= 2 ? 2 : NRS_COLORS); i++) { rxvt_color xcol; @@ -912,6 +929,10 @@ } PixColors[i] = xcol; +#ifdef OFF_FOCUS_FADING + if (rs[Rs_fade]) + PixColorsUnFocused[i] = xcol.fade (display, atoi (rs[Rs_fade])); +#endif SET_PIXCOLOR (i); } @@ -932,35 +953,26 @@ if (XDEPTH <= 2) { /* Monochrome */ - PixColors[Color_scroll] = PixColors[Color_fg]; - PixColors[Color_topShadow] = PixColors[Color_bg]; + PixColors[Color_scroll] = PixColors[Color_fg]; + PixColors[Color_topShadow] = PixColors[Color_bg]; PixColors[Color_bottomShadow] = PixColors[Color_bg]; } else { - rxvt_color xcol[3]; + rxvt_color xcol[2]; /* xcol[0] == white * xcol[1] == top shadow * xcol[2] == bot shadow */ xcol[1] = PixColors[Color_scroll]; -# ifdef PREFER_24BIT xcol[0].set (display, 65535, 65535, 65535); - /* XFreeColors (display->display, XCMAP, & (xcol[0].pixel), 1, ~0); */ -# else - xcol[0].set (display, WhitePixel (display->display, display->screen)); -# endif unsigned short pr1, pg1, pb1, pr0, pg0, pb0; xcol[0].get (display, pr0, pg0, pb0); xcol[1].get (display, pr1, pg1, pb1); - /* bottomShadowColor */ - if (!xcol[2].set (display, pr1 / 2, pg1 / 2, pb1 / 2)) - xcol[2] = PixColors[Color_Black]; - - PixColors[Color_bottomShadow] = xcol[2]; + PixColors[Color_bottomShadow] = xcol[1].fade (display, 50); /* topShadowColor */ if (!xcol[1].set (display, @@ -1145,12 +1157,12 @@ #endif XSelectInput (display->display, TermWin.parent[0], - KeyPressMask + KeyPressMask #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) - | KeyReleaseMask + | KeyReleaseMask #endif - | FocusChangeMask | VisibilityChangeMask - | StructureNotifyMask); + | FocusChangeMask | VisibilityChangeMask + | StructureNotifyMask); termwin_ev.start (display, TermWin.parent[0]); /* vt cursor: Black-on-White is standard, but this is more popular */ @@ -1176,13 +1188,13 @@ /* the vt window */ TermWin.vt = XCreateSimpleWindow (display->display, TermWin.parent[0], - window_vt_x, window_vt_y, + window_vt_x, + window_vt_y, TermWin_TotalWidth (), TermWin_TotalHeight (), 0, PixColors[Color_fg], PixColors[Color_bg]); - #ifdef DEBUG_X XStoreName (display->display, TermWin.vt, "vt window"); #endif @@ -1192,9 +1204,9 @@ vt_emask = ExposureMask | ButtonPressMask | ButtonReleaseMask | PropertyChangeMask; -#ifdef POINTER_BLANK pointer_unblank (); +#ifdef POINTER_BLANK if (Options & Opt_pointerBlank) vt_emask |= PointerMotionMask; else @@ -1235,7 +1247,7 @@ if (rs[Rs_backgroundPixmap] != NULL && ! (Options & Opt_transparent)) { - const char *p = rs[Rs_backgroundPixmap]; + const char *p = rs[Rs_backgroundPixmap]; if ((p = STRCHR (p, ';')) != NULL) { @@ -1265,6 +1277,12 @@ gcvalue.foreground = PixColors[ (XDEPTH <= 2 ? Color_fg : Color_scroll)]; scrollbarGC = XCreateGC (display->display, TermWin.vt, GCForeground, &gcvalue); #endif + +#ifdef OFF_FOCUS_FADING + // initially we are in unfocused state + if (rs[Rs_fade]) + PixColors = PixColorsUnFocused; +#endif } /*----------------------------------------------------------------------*/