*** empty log message ***
authorroot <root>
Tue, 31 Jan 2006 19:53:30 +0000 (19:53 +0000)
committerroot <root>
Tue, 31 Jan 2006 19:53:30 +0000 (19:53 +0000)
src/init.C
src/xdefaults.C

index ec436b9..9140de2 100644 (file)
@@ -299,6 +299,7 @@ rxvt_term::init_resources (int argc, const char *const *argv)
   if (!(display = displays.get (rs[Rs_display_name])))
     rxvt_fatal ("can't open display %s, aborting.\n", rs[Rs_display_name]);
 
+  // using a local pointer decreases code size a lot
   xa = display->xa;
 
 #if XFT
@@ -310,6 +311,10 @@ rxvt_term::init_resources (int argc, const char *const *argv)
 
   extract_resources ();
 
+  for (int i = NUM_RESOURCES; i--; )
+    if (rs [i] == resval_undef)
+      rs [i] = 0;
+
   free (r_argv);
 
 #if ENABLE_PERL
@@ -710,7 +715,7 @@ rxvt_term::Get_Colours ()
     for (i = 0; i < (depth <= 2 ? 2 : NRS_COLORS); i++)
       {
         rgba c;
-        pix_colors[Color_fade].get (this, c);
+        pix_colors[Color_fade].get (c);
         pix_colors_focused[i].fade (this, atoi (rs[Rs_fade]), pix_colors_unfocused[i],c);
       }
 #endif
@@ -749,8 +754,8 @@ rxvt_term::Get_Colours ()
 
       rgba c0, c1;
 
-      xcol[0].get (this, c0);
-      xcol[1].get (this, c1);
+      xcol[0].get (c0);
+      xcol[1].get (c1);
 
       xcol[1].fade (this, 50, pix_colors[Color_bottomShadow]);
 
index 36fe7c1..d06eead 100644 (file)
@@ -23,8 +23,8 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *----------------------------------------------------------------------*/
 
-#include "../config.h"         /* NECESSARY */
-#include "rxvt.h"              /* NECESSARY */
+#include "../config.h"
+#include "rxvt.h"
 #include "version.h"
 
 #ifdef KEYSYM_RESOURCE
@@ -388,6 +388,10 @@ static const char optionsstring[] = "options: "
 
 #define INDENT 18
 
+const char rxvt_term::resval_undef [] = "<undef>";
+const char rxvt_term::resval_on []    = "on";
+const char rxvt_term::resval_off []   = "off";
+
 /*{{{ usage: */
 /*----------------------------------------------------------------------*/
 static void
@@ -405,7 +409,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))
                 {
@@ -483,7 +487,6 @@ void
 rxvt_term::get_options (int argc, const char *const *argv)
 {
   int             i, bad_option = 0;
-  static const char On[3] = "ON", Off[4] = "OFF";
 
   for (i = 1; i < argc; i++)
     {
@@ -494,13 +497,15 @@ rxvt_term::get_options (int argc, const char *const *argv)
 
       if (*opt == '-')
         {
-          flag = On;
+          flag = resval_on;
+
           if (*++opt == '-')
             longopt = *opt++;  /* long option */
         }
       else if (*opt == '+')
         {
-          flag = Off;
+          flag = resval_off;
+
           if (*++opt == '+')
             longopt = *opt++;  /* long option */
         }
@@ -513,6 +518,7 @@ rxvt_term::get_options (int argc, const char *const *argv)
 
       if (!strcmp (opt, "help"))
         rxvt_usage (longopt ? 2 : 1);
+
       if (!strcmp (opt, "h"))
         rxvt_usage (0);
 
@@ -526,7 +532,7 @@ rxvt_term::get_options (int argc, const char *const *argv)
       if (entry < optList_size)
         {
           if (optList_isReverse (entry))
-            flag = flag == On ? Off : On;
+            flag = flag == resval_on ? resval_off : resval_on;
 
           if (optList_strlen (entry))
             {
@@ -537,12 +543,12 @@ rxvt_term::get_options (int argc, const char *const *argv)
                */
 
               if (optList[entry].doff != -1)
-                rs[optList[entry].doff] = flag == On && argv[i+1]
-                                          ? argv[++i] : 0;
+                rs[optList[entry].doff] = flag == resval_on && argv[i+1]
+                                          ? argv[++i] : resval_undef;
             }
           else
             {          /* boolean value */
-              set_option (optList[entry].flag & Optflag_mask, flag == On);
+              set_option (optList[entry].flag & Optflag_mask, flag == resval_on);
 
               if (optList[entry].doff != -1)
                 rs[optList[entry].doff] = flag;