*** empty log message ***
authorroot <root>
Wed, 1 Feb 2006 21:15:33 +0000 (21:15 +0000)
committerroot <root>
Wed, 1 Feb 2006 21:15:33 +0000 (21:15 +0000)
Changes
src/init.C
src/main.C
src/rsinc.h
src/rxvt.h
src/xdefaults.C

diff --git a/Changes b/Changes
index 706c337..a871bc3 100644 (file)
--- a/Changes
+++ b/Changes
@@ -15,7 +15,6 @@ DUMB: support tex fonts
 THINK: struct passwd *userinfo; /* defined in pwd.h + if ((userinfo = getpwuid(getuid())) != NULL) + shell = strdup(userinfo->pw_shell); /* retrieve current shell */ 
 
 TODO: xim "how to" faq entry
-TODO: rxvt -bg #comment
 
        - changed interpretation of [alpha] colour prefix.
         - +option now really sets the option to default, instead of using the
@@ -27,6 +26,8 @@ TODO: rxvt -bg #comment
           the colour components.
         - plain scrollbar works better with -sr.
         - fixed half-shadow scrollbar look.
+        - more colour rtt optimisations.
+        - properly(?) free colours on window close.
         - reorganised the FAQ into multiple sections.
 
 7.5  Tue Jan 31 15:15:43 CET 2006
index 2ee0016..0a6ef23 100644 (file)
@@ -696,11 +696,11 @@ rxvt_term::Get_Colours ()
 #endif
                   case Color_pointer_fg:
                     name = rs[Rs_color + Color_fg];
-                    xcol = pix_colors[Color_fg];
+                    xcol.set (this, name);
                     break;
                   default:
                     name = rs[Rs_color + Color_bg];
-                    xcol = pix_colors[Color_bg];
+                    xcol.set (this, name);
                     break;
                 }
             }
@@ -710,21 +710,11 @@ rxvt_term::Get_Colours ()
       rs[Rs_color + i] = name;
     }
 
-#ifdef OFF_FOCUS_FADING
-  if (rs[Rs_fade])
-    for (i = 0; i < (depth <= 2 ? 2 : NRS_COLORS); i++)
-      {
-        rgba c;
-        pix_colors[Color_fade].get (c);
-        pix_colors_focused[i].fade (this, atoi (rs[Rs_fade]), pix_colors_unfocused[i],c);
-      }
-#endif
-
   if (depth <= 2)
     {
-      if (!rs[Rs_color + Color_pointer_fg]) pix_colors[Color_pointer_fg] = pix_colors[Color_fg];
-      if (!rs[Rs_color + Color_pointer_bg]) pix_colors[Color_pointer_bg] = pix_colors[Color_bg];
-      if (!rs[Rs_color + Color_border]    ) pix_colors[Color_border]     = pix_colors[Color_fg];
+      if (!rs[Rs_color + Color_pointer_fg]) alias_color (Color_pointer_fg, Color_fg);
+      if (!rs[Rs_color + Color_pointer_bg]) alias_color (Color_pointer_bg, Color_bg);
+      if (!rs[Rs_color + Color_border]    ) alias_color (Color_border,     Color_fg);
     }
 
   /*
@@ -734,44 +724,41 @@ rxvt_term::Get_Colours ()
    * from the fvwm window manager.
    */
 #ifdef KEEP_SCROLLCOLOR
-
   if (depth <= 2)
     {
       /* Monochrome */
-      pix_colors[Color_scroll]       = pix_colors[Color_fg];
-      pix_colors[Color_topShadow]    = pix_colors[Color_bg];
-      pix_colors[Color_bottomShadow] = pix_colors[Color_bg];
+      alias_color (Color_scroll,       Color_fg);
+      alias_color (Color_topShadow,    Color_bg);
+      alias_color (Color_bottomShadow, Color_bg);
     }
   else
     {
-      rxvt_color xcol[2];
-      /* xcol[0] == white
-       * xcol[1] == top shadow
-       * xcol[2] == bot shadow */
-
-      xcol[1] = pix_colors[Color_scroll];
-      xcol[0].set (this, rgba (rgba::MAX_CC, rgba::MAX_CC, rgba::MAX_CC));
+      pix_colors [Color_scroll].fade (this, 50, pix_colors [Color_bottomShadow]);
 
-      rgba c0, c1;
-
-      xcol[0].get (c0);
-      xcol[1].get (c1);
-
-      xcol[1].fade (this, 50, pix_colors[Color_bottomShadow]);
+      rgba cscroll;
+      pix_colors [Color_scroll].get (cscroll);
 
       /* topShadowColor */
-      if (!xcol[1].set (this,
-                        rgba (
-                          min (c0.r, max (c1.r / 5, c1.r) * 7 / 5),
-                          min (c0.g, max (c1.g / 5, c1.g) * 7 / 5),
-                          min (c0.b, max (c1.b / 5, c1.b) * 7 / 5),
-                          c1.a) // pa1 vs. pa0: arbitrary
-                        ));
-        xcol[1] = pix_colors[Color_White];
-
-      pix_colors[Color_topShadow] = xcol[1];
+      if (!pix_colors[Color_topShadow].set (this,
+                       rgba (
+                         min ((int)rgba::MAX_CC, max (cscroll.r / 5, cscroll.r) * 7 / 5),
+                         min ((int)rgba::MAX_CC, max (cscroll.g / 5, cscroll.g) * 7 / 5),
+                         min ((int)rgba::MAX_CC, max (cscroll.b / 5, cscroll.b) * 7 / 5),
+                         cscroll.a)
+                       ))
+        alias_color (Color_topShadow, Color_White);
     }
 #endif                          /* KEEP_SCROLLCOLOR */
+
+#ifdef OFF_FOCUS_FADING
+  if (rs[Rs_fade])
+    for (i = 0; i < (depth <= 2 ? 2 : NRS_COLORS); i++)
+      {
+        rgba c;
+        pix_colors [Color_fade].get (c);
+        pix_colors_focused [i].fade (this, atoi (rs[Rs_fade]), pix_colors_unfocused[i],c);
+      }
+#endif
 }
 
 /*----------------------------------------------------------------------*/
index 2274dff..f5d2837 100644 (file)
@@ -254,10 +254,18 @@ rxvt_term::~rxvt_term ()
       if (parent[0])
         XDestroyWindow (xdisp, parent[0]);
 
+      for (int i = 0; i < TOTAL_COLORS; i++)
+        if (ISSET_PIXCOLOR (i))
+          {
+            pix_colors_focused   [i].free (this);
+#if OFF_FOCUS_FADING
+            pix_colors_unfocused [i].free (this);
+#endif
+          }
+
       clear ();
     }
 
-  // TODO: free pixcolours, colours should become part of rxvt_display
   delete pix_colors_focused;
 #if OFF_FOCUS_FADING
   delete pix_colors_unfocused;
@@ -1010,6 +1018,12 @@ rxvt_term::set_color (rxvt_color &color, const char *name)
   return false;
 }
 
+void
+rxvt_term::alias_color (int dst, int src)
+{
+  pix_colors[dst].set (this, rs[Rs_color + dst] = rs[Rs_color + src]);
+}
+
 /* -------------------------------------------------------------------- *
  * -                         WINDOW RESIZING                          - *
  * -------------------------------------------------------------------- */
@@ -1141,8 +1155,8 @@ rxvt_term::set_widthheight (unsigned int newwidth, unsigned int newheight)
 void
 rxvt_term::im_set_color (unsigned long &fg, unsigned long &bg)
 {
-  fg = pix_colors[Color_fg];
-  bg = pix_colors[Color_bg];
+  fg = pix_colors [Color_fg];
+  bg = pix_colors [Color_bg];
 }
 
 void
index 2ecec02..e1125d0 100644 (file)
@@ -6,7 +6,7 @@
   def (geometry)
   def (reverseVideo)
   def (color)
-  reserve (color, NRS_COLORS)
+  reserve (color, TOTAL_COLORS)
   def (font)
 #if ENABLE_STYLES
   def (boldFont)
index 35747b5..48244d3 100644 (file)
@@ -1260,6 +1260,7 @@ struct rxvt_term : zero_initialized, rxvt_vars, rxvt_screen {
   void set_window_color (int idx, const char *color);
   void set_colorfgbg ();
   bool set_color (rxvt_color &color, const char *name);
+  void alias_color (int dst, int src);
   void set_widthheight (unsigned int newwidth, unsigned int newheight);
 
   // screen.C
index cdccf28..0e5c542 100644 (file)
@@ -28,7 +28,7 @@
 #include "version.h"
 
 #ifdef KEYSYM_RESOURCE
-#include "keyboard.h"
+# include "keyboard.h"
 #endif
 
 /* place holders used for parsing command-line options */
@@ -36,7 +36,7 @@
 #define Optflag_Boolean              0x80000000UL
 #define Optflag_mask                 0x3fffffffUL
 
-/*{{{ monolithic option/resource structure: */
+/* monolithic option/resource structure: */
 /*
  * `string' options MUST have a usage argument
  * `switch' and `boolean' options have no argument
@@ -268,7 +268,6 @@ optList[] = {
 #undef RSTRG
 #undef SWCH
 #undef BOOL
-/*}}} */
 
 static const char releasestring[] = "rxvt-unicode (" RXVTNAME ") v" VERSION " - released: " DATE "\n";
 static const char optionsstring[] = "options: "
@@ -409,7 +408,7 @@ rxvt_usage (int type)
         for (col = 1, i = 0; i < optList_size; i++)
           if (optList[i].desc != NULL)
             {
-              int             len = 0;
+              int len = 0;
 
               if (!optList_isBool (i))
                 {
@@ -486,7 +485,7 @@ rxvt_usage (int type)
 void
 rxvt_term::get_options (int argc, const char *const *argv)
 {
-  int             i, bad_option = 0;
+  int i, bad_option = 0;
 
   for (i = 1; i < argc; i++)
     {
@@ -543,8 +542,12 @@ rxvt_term::get_options (int argc, const char *const *argv)
                */
 
               if (optList[entry].doff != -1)
-                rs[optList[entry].doff] = flag == resval_on && argv[i+1]
-                                          ? argv[++i] : resval_undef;
+                {
+                  if (flag == resval_on && !argv [i+1])
+                    rxvt_fatal ("option '%s' needs an argument, aborting.\n", argv [i]);
+
+                  rs[optList[entry].doff] = flag == resval_on ? argv[++i] : resval_undef;
+                }
             }
           else
             {          /* boolean value */