*** empty log message ***
authorroot <root>
Thu, 11 Aug 2005 02:05:06 +0000 (02:05 +0000)
committerroot <root>
Thu, 11 Aug 2005 02:05:06 +0000 (02:05 +0000)
Changes
doc/rxvt.1.pod
src/command.C
src/init.C
src/main.C
src/rxvt.h
src/rxvttoolkit.C
src/rxvttoolkit.h
src/version.h
src/xdefaults.C

diff --git a/Changes b/Changes
index 10df2c8..938f553 100644 (file)
--- 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
index c44b0f4..5cb95c1 100644 (file)
@@ -114,14 +114,21 @@ B<-tr>; resource B<inheritPixmap>.
 
 =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>
 
@@ -550,11 +557,17 @@ pixmap.
 
 =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>
 
index 29c7ff9..e9bde5e 100644 (file)
@@ -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;
index a77482e..4efea3d 100644 (file)
@@ -171,6 +171,9 @@ const char *const def_colorName[] =
 #if TINTING
     NULL,
 #endif
+#if OFF_FOCUS_FADING
+    "black",
+#endif
   };
 
 const char *const xa_names[] =
@@ -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];
index e09cfaa..1e7b167 100644 (file)
@@ -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. */
index 6cb4799..f210eca 100644 (file)
@@ -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
  */
@@ -555,6 +553,9 @@ enum colour_list {
 #if TINTING
   Color_tint,
 #endif
+#if OFF_FOCUS_FADING
+  Color_fade,
+#endif
   NRS_COLORS,                 /* */
 #ifdef KEEP_SCROLLCOLOR
   Color_topShadow = NRS_COLORS,
index 37af2f8..53bd4a8 100644 (file)
@@ -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;
 }
index 3203915..90b47f3 100644 (file)
@@ -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);
 };
index 2a530e4..fa7a987 100644 (file)
@@ -1,3 +1,3 @@
 // VERSION _must_ be \d.\d+
-#define VERSION "5.7"
+#define VERSION "5.8"
 #define DATE   "2005-07-13"
index a81f45b..11510ae 100644 (file)
@@ -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"),