-- Leo's gemini proxy

-- Connecting to git.thebackupbox.net:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

repo: rxvt-unicode-sixel
action: commit
revision:
path_from:
revision_from: 821804be30e6bcde7735765e2e6d00f938c8c4d2:
path_to:
revision_to:

git.thebackupbox.net

rxvt-unicode-sixel

git://git.thebackupbox.net/rxvt-unicode-sixel

commit 821804be30e6bcde7735765e2e6d00f938c8c4d2
Author: Marc Lehmann <schmorp@schmorp.de>
Date:   Thu Aug 11 02:05:07 2005 +0000

    *** empty log message ***

diff --git a/Changes b/Changes

index 10df2c83a9bd7c243fec018e1769068c84d7d2ef..

index ..938f55351e12b80468ad72ec68e0787f13cbd71d 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 c44b0f49c9fabea6bbb2e9696e5c72cadca67ca8..

index ..5cb95c1de6279f1ba8a1946ebe55e00e42b8b28b 100644

--- a/doc/rxvt.1.pod
+++ b/doc/rxvt.1.pod
@@ -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>

diff --git a/src/command.C b/src/command.C

index 29c7ff9ca83e8a3939bc839a26f041a88419c7a4..

index ..e9bde5efccd3f78393a77556a2a2c0611047a1e4 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 a77482ed04c585dc02f46c1b5e7712c485bf1d9d..

index ..4efea3d78399e02a969787580303bda5e84f30f6 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 e09cfaae6a7983396603a9da401295ad3042b26f..

index ..1e7b167077c3306ce64cbc5175929a482972fb08 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 6cb4799d71e9eb2dd762a6c322fd9c6233dc9810..

index ..f210eca11106f169f0e72830d2b736d302a0231c 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 37af2f8c07c6bc84764f73d27d1878214731621e..

index ..53bd4a8b1c161fa7801d5704c1cf5751648e11db 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 3203915820c9410082757f3707899ea8ae4f3b8a..

index ..90b47f370ee1619470604893b300bf0a8c2c37e9 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/xdefaults.C b/src/xdefaults.C

index a81f45b0ec82fd47621870c9122ef5a27836d48c..

index ..11510ae1332555e830bf61a5abe2b2bad161c148 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"),

-----END OF PAGE-----

-- Response ended

-- Page fetched on Sun Jun 2 11:50:08 2024