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
=item B<-fade> I<number>
-Fade the text by the given percentage when focus is lost. resource B<fading>.
+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<fading>.
+
+=item B<-fadecolor> I<colour>
+
+Fade to this colour when fading is used (see B<-fade>). The default colour
+is black. resource B<fadeColor>.
=item B<-tint> I<colour>
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<tintColor>.
=item B<-sh>
=item B<fading:> I<number>
-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<fadeColor:> I<colour>
+
+Fade to this colour, when fading is used (see B<fading:>). The default
+colour is black; option B<-fadecolor>.
=item B<tintColor:> I<colour>
-Tint the transparent background pixmap with the given colour.
+Tint the transparent background pixmap with the given colour; option
+B<-tint>.
=item B<shading:> I<number>
{
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;
#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;
#if TINTING
NULL,
#endif
+#if OFF_FOCUS_FADING
+ "black",
+#endif
};
const char *const xa_names[] =
}
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];
// 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
# ifndef NO_BRIGHTCOLOR
pix_colors_focused[idx] = pix_colors_focused[minBrightCOLOR + i];
SET_PIXCOLOR (idx);
- goto Done;
+ goto done;
# endif
}
{ /* normal colors */
pix_colors_focused[idx] = pix_colors_focused[minCOLOR + i];
SET_PIXCOLOR (idx);
- goto Done;
+ goto done;
}
}
/* 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. */
/* 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
*/
#if TINTING
Color_tint,
#endif
+#if OFF_FOCUS_FADING
+ Color_fade,
+#endif
NRS_COLORS, /* */
#ifdef KEEP_SCROLLCOLOR
Color_topShadow = NRS_COLORS,
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;
}
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);
};
// VERSION _must_ be \d.\d+
-#define VERSION "5.7"
+#define VERSION "5.8"
#define DATE "2005-07-13"
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"),
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"),