From: root Date: Thu, 11 Aug 2005 02:05:06 +0000 (+0000) Subject: *** empty log message *** X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=74745e31f578cf9f1f9dc8905ef8f9a6b1c5b03d;p=dana%2Furxvt.git *** empty log message *** --- diff --git a/Changes b/Changes index 10df2c83..938f5535 100644 --- a/Changes +++ b/Changes @@ -15,6 +15,10 @@ WISH: OnTheSpot editing, or maybe switch to miiiiiiif WISH: tabbed windows (hey, just use screen...) WISH: just for fun, do shade and tint with XRender. + - INCOMPATIBLE CHANGE: -fade changed it's meaning to comply with + the documentation and common sense: when upgrading, replace your + percentage by 100-percentage. + - integrated "fade to specific colour" patch by Martin Parm. - slow down the internal visual bell (delay by 20ms) and update the terminfo flash code to use the same delay. This is synchronous, so many bells might inhibit screen updates in other diff --git a/doc/rxvt.1.pod b/doc/rxvt.1.pod index c44b0f49..5cb95c1d 100644 --- a/doc/rxvt.1.pod +++ b/doc/rxvt.1.pod @@ -114,14 +114,21 @@ B<-tr>; resource B. =item B<-fade> I -Fade the text by the given percentage when focus is lost. resource B. +Fade the text by the given percentage when focus is lost. Small values +fade a little only, 100 completely replaces all colours by the fade +colour; resource B. + +=item B<-fadecolor> I + +Fade to this colour when fading is used (see B<-fade>). The default colour +is black. resource B. =item B<-tint> I Tint the transparent background pixmap with the given colour when transparency is enabled with B<-tr> or B<-ip>. See also the B<-sh> option that can be used to brighten or darken the image in addition to -tinting it. +tinting it; resource I. =item B<-sh> @@ -550,11 +557,17 @@ pixmap. =item B I -Fade the text by the given percentage when focus is lost. +Fade the text by the given percentage when focus is lost; option B<-fade>. + +=item B I + +Fade to this colour, when fading is used (see B). The default +colour is black; option B<-fadecolor>. =item B I -Tint the transparent background pixmap with the given colour. +Tint the transparent background pixmap with the given colour; option +B<-tint>. =item B I diff --git a/src/command.C b/src/command.C index 29c7ff9c..e9bde5ef 100644 --- a/src/command.C +++ b/src/command.C @@ -1654,18 +1654,18 @@ rxvt_term::focus_in () { TermWin.focus = 1; want_refresh = 1; -#ifdef USE_XIM +#if USE_XIM if (Input_Context != NULL) { IMSetStatusPosition (); XSetICFocus (Input_Context); } #endif -#ifdef CURSOR_BLINK +#if CURSOR_BLINK if (options & Opt_cursorBlink) cursor_blink_ev.start (NOW + BLINK_INTERVAL); #endif -#ifdef OFF_FOCUS_FADING +#if OFF_FOCUS_FADING if (rs[Rs_fade]) { pix_colors = pix_colors_focused; @@ -1689,16 +1689,16 @@ rxvt_term::focus_out () #if ENABLE_OVERLAY scr_overlay_off (); #endif -#ifdef USE_XIM +#if USE_XIM if (Input_Context != NULL) XUnsetICFocus (Input_Context); #endif -#ifdef CURSOR_BLINK +#if CURSOR_BLINK if (options & Opt_cursorBlink) cursor_blink_ev.stop (); hidden_cursor = 0; #endif -#ifdef OFF_FOCUS_FADING +#if OFF_FOCUS_FADING if (rs[Rs_fade]) { pix_colors = pix_colors_unfocused; diff --git a/src/init.C b/src/init.C index a77482ed..4efea3d7 100644 --- a/src/init.C +++ b/src/init.C @@ -170,6 +170,9 @@ const char *const def_colorName[] = #endif /* KEEP_SCROLLCOLOR */ #if TINTING NULL, +#endif +#if OFF_FOCUS_FADING + "black", #endif }; @@ -739,13 +742,15 @@ rxvt_term::Get_Colours () } pix_colors[i] = xcol; -#ifdef OFF_FOCUS_FADING - if (rs[Rs_fade]) - pix_colors_unfocused[i] = xcol.fade (display, atoi (rs[Rs_fade])); -#endif SET_PIXCOLOR (i); } +#ifdef OFF_FOCUS_FADING + if (rs[Rs_fade]) + for (i = 0; i < (display->depth <= 2 ? 2 : NRS_COLORS); i++) + pix_colors_unfocused[i] = pix_colors_focused[i].fade (display, atoi (rs[Rs_fade]), pix_colors[Color_fade]); +#endif + if (display->depth <= 2) { if (!rs[Rs_color + Color_pointer_fg]) pix_colors[Color_pointer_fg] = pix_colors[Color_fg]; diff --git a/src/main.C b/src/main.C index e09cfaae..1e7b1670 100644 --- a/src/main.C +++ b/src/main.C @@ -261,7 +261,7 @@ rxvt_term::~rxvt_term () // TODO: free pixcolours, colours should become part of rxvt_display delete pix_colors_focused; -#ifdef OFF_FOCUS_FADING +#if OFF_FOCUS_FADING delete pix_colors_unfocused; #endif @@ -992,7 +992,7 @@ rxvt_term::set_window_color (int idx, const char *color) # ifndef NO_BRIGHTCOLOR pix_colors_focused[idx] = pix_colors_focused[minBrightCOLOR + i]; SET_PIXCOLOR (idx); - goto Done; + goto done; # endif } @@ -1000,7 +1000,7 @@ rxvt_term::set_window_color (int idx, const char *color) { /* normal colors */ pix_colors_focused[idx] = pix_colors_focused[minCOLOR + i]; SET_PIXCOLOR (idx); - goto Done; + goto done; } } @@ -1030,10 +1030,11 @@ rxvt_term::set_window_color (int idx, const char *color) /* XSetWindowAttributes attr; */ /* Cursor cursor; */ -Done: -#ifdef OFF_FOCUS_FADING +done: + +#if OFF_FOCUS_FADING if (rs[Rs_fade]) - pix_colors_unfocused[idx] = pix_colors_focused[idx].fade (display, atoi (rs[Rs_fade])); + pix_colors_unfocused[idx] = pix_colors_focused[idx].fade (display, atoi (rs[Rs_fade]), pix_colors[Color_fade]); #endif /*TODO: handle Color_BD, scrollbar background, etc. */ diff --git a/src/rxvt.h b/src/rxvt.h index 6cb4799d..f210eca1 100644 --- a/src/rxvt.h +++ b/src/rxvt.h @@ -493,9 +493,7 @@ enum { /* Words starting with `Color_' are colours. Others are counts */ /* - * The following comment is mostly obsolete since pixcolor_set was expanded: - * We're currently upto 29 colours. Only 3 more available. The - * PixColor and rendition colour usage should probably be decoupled + * The PixColor and rendition colour usage should probably be decoupled * on the unnecessary items, e.g. Color_pointer, but won't bother * until we need to. Also, be aware of usage in pixcolor_set */ @@ -554,6 +552,9 @@ enum colour_list { #endif #if TINTING Color_tint, +#endif +#if OFF_FOCUS_FADING + Color_fade, #endif NRS_COLORS, /* */ #ifdef KEEP_SCROLLCOLOR diff --git a/src/rxvttoolkit.C b/src/rxvttoolkit.C index 37af2f8c..53bd4a8b 100644 --- a/src/rxvttoolkit.C +++ b/src/rxvttoolkit.C @@ -476,14 +476,43 @@ rxvt_color::free (rxvt_display *display) rxvt_color rxvt_color::fade (rxvt_display *display, int percent) { + percent = 100 - percent; + unsigned short cr, cg, cb; rxvt_color faded; get (display, cr, cg, cb); - faded.set (display, - cr * percent / 100, - cg * percent / 100, - cb * percent / 100); + + faded.set ( + display, + cr * percent / 100, + cg * percent / 100, + cb * percent / 100 + ); + + return faded; +} + +#define LERP(a,b,p) (a * p / 100 + b * (100 - p) / 100) + +rxvt_color +rxvt_color::fade (rxvt_display *display, int percent, rxvt_color &fadeto) +{ + percent = 100 - percent; + + unsigned short cr, cg, cb; + unsigned short fcr, fcg, fcb; + rxvt_color faded; + + get (display, cr, cg, cb); + fadeto.get(display, fcr, fcg, fcb); + + faded.set ( + display, + LERP (cr, fcr, percent), + LERP (cg, fcg, percent), + LERP (cb, fcb, percent) + ); return faded; } diff --git a/src/rxvttoolkit.h b/src/rxvttoolkit.h index 32039158..90b47f37 100644 --- a/src/rxvttoolkit.h +++ b/src/rxvttoolkit.h @@ -173,7 +173,8 @@ struct rxvt_color { bool set (rxvt_display *display, const char *name); bool set (rxvt_display *display, unsigned short cr, unsigned short cg, unsigned short cb); - rxvt_color fade (rxvt_display *, int percent); + rxvt_color fade (rxvt_display *, int percent); // fades to black + rxvt_color fade (rxvt_display *, int percent, rxvt_color &fadeto); void free (rxvt_display *display); }; diff --git a/src/version.h b/src/version.h index 2a530e46..fa7a9878 100644 --- a/src/version.h +++ b/src/version.h @@ -1,3 +1,3 @@ // VERSION _must_ be \d.\d+ -#define VERSION "5.7" +#define VERSION "5.8" #define DATE "2005-07-13" diff --git a/src/xdefaults.C b/src/xdefaults.C index a81f45b0..11510ae1 100644 --- a/src/xdefaults.C +++ b/src/xdefaults.C @@ -98,7 +98,7 @@ optList[] = { BOOL (Rs_loginShell, "loginShell", "ls", Opt_loginShell, "login shell"), BOOL (Rs_jumpScroll, "jumpScroll", "j", Opt_jumpScroll, "jump scrolling"), BOOL (Rs_pastableTabs, "pastableTabs", "ptab", Opt_pastableTabs, "tab characters are pastable"), -#ifdef HAVE_SCROLLBARS +#if HAVE_SCROLLBARS RSTRG (Rs_scrollstyle, "scrollstyle", "mode"), BOOL (Rs_scrollBar, "scrollBar", "sb", Opt_scrollBar, "scrollbar"), BOOL (Rs_scrollBar_right, "scrollBar_right", "sr", Opt_scrollBar_right, "scrollbar right"), @@ -110,18 +110,19 @@ optList[] = { BOOL (Rs_scrollTtyOutput, NULL, "si", Opt_Reverse | Opt_scrollTtyOutput, "scroll-on-tty-output inhibit"), BOOL (Rs_scrollTtyKeypress, "scrollTtyKeypress", "sk", Opt_scrollTtyKeypress, "scroll-on-keypress"), BOOL (Rs_scrollWithBuffer, "scrollWithBuffer", "sw", Opt_scrollWithBuffer, "scroll-with-buffer"), -#ifdef TRANSPARENT +#if TRANSPARENT BOOL (Rs_transparent, "inheritPixmap", "ip", Opt_transparent, "inherit parent pixmap"), BOOL (Rs_transparent_all, "inheritPixmapforce", "ipf", Opt_transparent_all, "forcefully inherit root pixmap"), SWCH ("tr", Opt_transparent, NULL), -#if TINTING +# if TINTING STRG (Rs_color + Color_tint, "tintColor", "tint", "color", "tint color"), +# endif #endif +#if OFF_FOCUS_FADING + STRG (Rs_fade, "fading", "fade", "%", "fade colors x% percent when rxvt-unicode is losing focus"), + STRG (Rs_color + Color_fade, "fadeColor", "fadecolor", "color", "target color for off-focus fading"), #endif -#ifdef OFF_FOCUS_FADING - STRG (Rs_fade, "fading", "fade", "%", "make colors x% darker when rxvt-unicode is losing focus."), -#endif -#ifdef TINTING +#if TINTING STRG (Rs_shade, "shading", "sh", "%", "shade background by x% when tinting."), #endif BOOL (Rs_utmpInhibit, "utmpInhibit", "ut", Opt_utmpInhibit, "utmp inhibit"),