Enlightenment CVS committal

Author  : mej
Project : eterm
Module  : Eterm

Dir     : eterm/Eterm/src


Modified Files:
        options.c screen.c screen.h term.c term.h windows.c 


Log Message:
Mon Apr 18 18:00:17 2005                        Michael Jennings (mej)

Applied a patch from Fredrik Svensson <[EMAIL PROTECTED]> for 256-color
support (a la xterm).  I also renamed and imported a couple of his
test scripts into utils/, and in playing around with them, I found and
fixed an X server resource leak.  Use Etpalette to view the 256-color
palette.
----------------------------------------------------------------------

===================================================================
RCS file: /cvsroot/enlightenment/eterm/Eterm/src/options.c,v
retrieving revision 1.136
retrieving revision 1.137
diff -u -3 -r1.136 -r1.137
--- options.c   15 Mar 2005 21:48:02 -0000      1.136
+++ options.c   18 Apr 2005 22:03:33 -0000      1.137
@@ -21,7 +21,7 @@
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
-static const char cvs_ident[] = "$Id: options.c,v 1.136 2005/03/15 21:48:02 
mej Exp $";
+static const char cvs_ident[] = "$Id: options.c,v 1.137 2005/04/18 22:03:33 
mej Exp $";
 
 #include "config.h"
 #include "feature.h"
@@ -2516,6 +2516,7 @@
     rs_path = NULL;
 #endif
     colorfgbg = DEFAULT_RSTYLE;
+    MEMSET(PixColors, 0, sizeof(PixColors));
 
     /* Font stuff. */
     MEMSET(rs_font, 0, sizeof(char *) * NFONTS);
===================================================================
RCS file: /cvsroot/enlightenment/eterm/Eterm/src/screen.c,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -3 -r1.82 -r1.83
--- screen.c    15 Mar 2005 21:48:06 -0000      1.82
+++ screen.c    18 Apr 2005 22:03:39 -0000      1.83
@@ -3,7 +3,7 @@
  *
  */
 
-static const char cvs_ident[] = "$Id: screen.c,v 1.82 2005/03/15 21:48:06 mej 
Exp $";
+static const char cvs_ident[] = "$Id: screen.c,v 1.83 2005/04/18 22:03:39 mej 
Exp $";
 
 #include "config.h"
 #include "feature.h"
@@ -491,7 +491,7 @@
                   break;
             }
         } else {
-            if ((rstyle & Intensity) && color >= minColor && color <= 
maxColor) {
+            if ((rstyle & Intensity) && (color >= minColor) && (color <= 
maxColor)) {
                 switch (Intensity) {
                     case RS_Bold:
                         if (BITFIELD_IS_SET(vt_options, 
VT_OPTIONS_BOLD_BRIGHTENS_FOREGROUND)) {
===================================================================
RCS file: /cvsroot/enlightenment/eterm/Eterm/src/screen.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -3 -r1.32 -r1.33
--- screen.h    20 Dec 2004 19:37:04 -0000      1.32
+++ screen.h    18 Apr 2005 22:03:41 -0000      1.33
@@ -118,11 +118,11 @@
 #define RS_multi2              (RS_multi0|RS_multi1)   /* multibyte 2nd byte */
 #define RS_multiMask           (RS_multi0|RS_multi1)   /* multibyte mask */
 #endif
-#define RS_fgMask              0x00001F00u     /* 32 colors */
-#define RS_Overscore           0x00002000u     /* overscore */
-#define RS_Italic              0x00004000u     /* italic */
-#define RS_Bold                        0x00008000u     /* bold */
-#define RS_bgMask              0x001F0000u     /* 32 colors */
+#define RS_fgMask              0x0003FE00u     /* 512 colors */
+#define RS_bgMask              0x000001FFu     /* 512 colors */
+#define RS_Overscore           0x00040000u     /* overscore */
+#define RS_Italic              0x00080000u     /* italic */
+#define RS_Bold                        0x00100000u     /* bold */
 #define RS_Dim                 0x00200000u     /* dim (apply alpha) */
 #define RS_Conceal             0x00400000u     /* conceal */
 #define RS_Blink               0x00800000u     /* blink */
@@ -130,15 +130,15 @@
 #define RS_attrMask            
(0xFF000000u|RS_Overscore|RS_Italic|RS_Bold|RS_Dim|RS_Conceal|RS_Blink)
 
 /* how to build & extract colors and attributes */
-#define GET_FGCOLOR(r) (((r) & RS_fgMask)>>8)
-#define GET_BGCOLOR(r) (((r) & RS_bgMask)>>16)
+#define GET_FGCOLOR(r) (((r) & RS_fgMask)>>9)
+#define GET_BGCOLOR(r) (((r) & RS_bgMask))
 #define GET_ATTR(r)    (((r) & RS_attrMask))
 #define GET_BGATTR(r)  (((r) & (RS_attrMask | RS_bgMask)))
 
-#define SET_FGCOLOR(r,fg)      (((r) & ~RS_fgMask)  | ((fg)<<8))
-#define SET_BGCOLOR(r,bg)      (((r) & ~RS_bgMask)  | ((bg)<<16))
+#define SET_FGCOLOR(r,fg)      (((r) & ~RS_fgMask)  | ((fg)<<9))
+#define SET_BGCOLOR(r,bg)      (((r) & ~RS_bgMask)  | (bg))
 #define SET_ATTR(r,a)          (((r) & ~RS_attrMask)| (a))
-#define DEFAULT_RSTYLE         (RS_None | (fgColor<<8) | (bgColor<<16))
+#define DEFAULT_RSTYLE         (RS_None | (fgColor<<9) | (bgColor))
 
 /* screen_t flags */
 #define Screen_Relative                (1<<0)  /* relative origin mode flag    
     */
===================================================================
RCS file: /cvsroot/enlightenment/eterm/Eterm/src/term.c,v
retrieving revision 1.105
retrieving revision 1.106
diff -u -3 -r1.105 -r1.106
--- term.c      14 Dec 2004 23:24:32 -0000      1.105
+++ term.c      18 Apr 2005 22:03:41 -0000      1.106
@@ -21,7 +21,7 @@
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
-static const char cvs_ident[] = "$Id: term.c,v 1.105 2004/12/14 23:24:32 mej 
Exp $";
+static const char cvs_ident[] = "$Id: term.c,v 1.106 2005/04/18 22:03:41 mej 
Exp $";
 
 #include "config.h"
 #include "feature.h"
@@ -58,7 +58,6 @@
 unsigned long PrivateModes = PrivMode_Default;
 unsigned long SavedModes = PrivMode_Default;
 char *def_colorName[] = {
-    "rgb:aa/aa/aa", "rgb:0/0/0",        /* fg/bg */
     "rgb:0/0/0",                /* 0: black             (#000000) */
     /* low-intensity colors */
     "rgb:cc/00/00",             /* 1: red     */
@@ -77,6 +76,254 @@
     "rgb:ff/00/ff",             /* 5/13: bright magenta */
     "rgb:00/ff/ff",             /* 6/14: bright cyan    */
     "rgb:ff/ff/ff",             /* 7/15: bright white   */
+
+    /* 6x6x6 color cube generated with color-cube-gen.pl */
+    "rgb:00/00/00",
+    "rgb:00/00/2a",
+    "rgb:00/00/55",
+    "rgb:00/00/7f",
+    "rgb:00/00/aa",
+    "rgb:00/00/d4",
+    "rgb:00/2a/00",
+    "rgb:00/2a/2a",
+    "rgb:00/2a/55",
+    "rgb:00/2a/7f",
+    "rgb:00/2a/aa",
+    "rgb:00/2a/d4",
+    "rgb:00/55/00",
+    "rgb:00/55/2a",
+    "rgb:00/55/55",
+    "rgb:00/55/7f",
+    "rgb:00/55/aa",
+    "rgb:00/55/d4",
+    "rgb:00/7f/00",
+    "rgb:00/7f/2a",
+    "rgb:00/7f/55",
+    "rgb:00/7f/7f",
+    "rgb:00/7f/aa",
+    "rgb:00/7f/d4",
+    "rgb:00/aa/00",
+    "rgb:00/aa/2a",
+    "rgb:00/aa/55",
+    "rgb:00/aa/7f",
+    "rgb:00/aa/aa",
+    "rgb:00/aa/d4",
+    "rgb:00/d4/00",
+    "rgb:00/d4/2a",
+    "rgb:00/d4/55",
+    "rgb:00/d4/7f",
+    "rgb:00/d4/aa",
+    "rgb:00/d4/d4",
+    "rgb:2a/00/00",
+    "rgb:2a/00/2a",
+    "rgb:2a/00/55",
+    "rgb:2a/00/7f",
+    "rgb:2a/00/aa",
+    "rgb:2a/00/d4",
+    "rgb:2a/2a/00",
+    "rgb:2a/2a/2a",
+    "rgb:2a/2a/55",
+    "rgb:2a/2a/7f",
+    "rgb:2a/2a/aa",
+    "rgb:2a/2a/d4",
+    "rgb:2a/55/00",
+    "rgb:2a/55/2a",
+    "rgb:2a/55/55",
+    "rgb:2a/55/7f",
+    "rgb:2a/55/aa",
+    "rgb:2a/55/d4",
+    "rgb:2a/7f/00",
+    "rgb:2a/7f/2a",
+    "rgb:2a/7f/55",
+    "rgb:2a/7f/7f",
+    "rgb:2a/7f/aa",
+    "rgb:2a/7f/d4",
+    "rgb:2a/aa/00",
+    "rgb:2a/aa/2a",
+    "rgb:2a/aa/55",
+    "rgb:2a/aa/7f",
+    "rgb:2a/aa/aa",
+    "rgb:2a/aa/d4",
+    "rgb:2a/d4/00",
+    "rgb:2a/d4/2a",
+    "rgb:2a/d4/55",
+    "rgb:2a/d4/7f",
+    "rgb:2a/d4/aa",
+    "rgb:2a/d4/d4",
+    "rgb:55/00/00",
+    "rgb:55/00/2a",
+    "rgb:55/00/55",
+    "rgb:55/00/7f",
+    "rgb:55/00/aa",
+    "rgb:55/00/d4",
+    "rgb:55/2a/00",
+    "rgb:55/2a/2a",
+    "rgb:55/2a/55",
+    "rgb:55/2a/7f",
+    "rgb:55/2a/aa",
+    "rgb:55/2a/d4",
+    "rgb:55/55/00",
+    "rgb:55/55/2a",
+    "rgb:55/55/55",
+    "rgb:55/55/7f",
+    "rgb:55/55/aa",
+    "rgb:55/55/d4",
+    "rgb:55/7f/00",
+    "rgb:55/7f/2a",
+    "rgb:55/7f/55",
+    "rgb:55/7f/7f",
+    "rgb:55/7f/aa",
+    "rgb:55/7f/d4",
+    "rgb:55/aa/00",
+    "rgb:55/aa/2a",
+    "rgb:55/aa/55",
+    "rgb:55/aa/7f",
+    "rgb:55/aa/aa",
+    "rgb:55/aa/d4",
+    "rgb:55/d4/00",
+    "rgb:55/d4/2a",
+    "rgb:55/d4/55",
+    "rgb:55/d4/7f",
+    "rgb:55/d4/aa",
+    "rgb:55/d4/d4",
+    "rgb:7f/00/00",
+    "rgb:7f/00/2a",
+    "rgb:7f/00/55",
+    "rgb:7f/00/7f",
+    "rgb:7f/00/aa",
+    "rgb:7f/00/d4",
+    "rgb:7f/2a/00",
+    "rgb:7f/2a/2a",
+    "rgb:7f/2a/55",
+    "rgb:7f/2a/7f",
+    "rgb:7f/2a/aa",
+    "rgb:7f/2a/d4",
+    "rgb:7f/55/00",
+    "rgb:7f/55/2a",
+    "rgb:7f/55/55",
+    "rgb:7f/55/7f",
+    "rgb:7f/55/aa",
+    "rgb:7f/55/d4",
+    "rgb:7f/7f/00",
+    "rgb:7f/7f/2a",
+    "rgb:7f/7f/55",
+    "rgb:7f/7f/7f",
+    "rgb:7f/7f/aa",
+    "rgb:7f/7f/d4",
+    "rgb:7f/aa/00",
+    "rgb:7f/aa/2a",
+    "rgb:7f/aa/55",
+    "rgb:7f/aa/7f",
+    "rgb:7f/aa/aa",
+    "rgb:7f/aa/d4",
+    "rgb:7f/d4/00",
+    "rgb:7f/d4/2a",
+    "rgb:7f/d4/55",
+    "rgb:7f/d4/7f",
+    "rgb:7f/d4/aa",
+    "rgb:7f/d4/d4",
+    "rgb:aa/00/00",
+    "rgb:aa/00/2a",
+    "rgb:aa/00/55",
+    "rgb:aa/00/7f",
+    "rgb:aa/00/aa",
+    "rgb:aa/00/d4",
+    "rgb:aa/2a/00",
+    "rgb:aa/2a/2a",
+    "rgb:aa/2a/55",
+    "rgb:aa/2a/7f",
+    "rgb:aa/2a/aa",
+    "rgb:aa/2a/d4",
+    "rgb:aa/55/00",
+    "rgb:aa/55/2a",
+    "rgb:aa/55/55",
+    "rgb:aa/55/7f",
+    "rgb:aa/55/aa",
+    "rgb:aa/55/d4",
+    "rgb:aa/7f/00",
+    "rgb:aa/7f/2a",
+    "rgb:aa/7f/55",
+    "rgb:aa/7f/7f",
+    "rgb:aa/7f/aa",
+    "rgb:aa/7f/d4",
+    "rgb:aa/aa/00",
+    "rgb:aa/aa/2a",
+    "rgb:aa/aa/55",
+    "rgb:aa/aa/7f",
+    "rgb:aa/aa/aa",
+    "rgb:aa/aa/d4",
+    "rgb:aa/d4/00",
+    "rgb:aa/d4/2a",
+    "rgb:aa/d4/55",
+    "rgb:aa/d4/7f",
+    "rgb:aa/d4/aa",
+    "rgb:aa/d4/d4",
+    "rgb:d4/00/00",
+    "rgb:d4/00/2a",
+    "rgb:d4/00/55",
+    "rgb:d4/00/7f",
+    "rgb:d4/00/aa",
+    "rgb:d4/00/d4",
+    "rgb:d4/2a/00",
+    "rgb:d4/2a/2a",
+    "rgb:d4/2a/55",
+    "rgb:d4/2a/7f",
+    "rgb:d4/2a/aa",
+    "rgb:d4/2a/d4",
+    "rgb:d4/55/00",
+    "rgb:d4/55/2a",
+    "rgb:d4/55/55",
+    "rgb:d4/55/7f",
+    "rgb:d4/55/aa",
+    "rgb:d4/55/d4",
+    "rgb:d4/7f/00",
+    "rgb:d4/7f/2a",
+    "rgb:d4/7f/55",
+    "rgb:d4/7f/7f",
+    "rgb:d4/7f/aa",
+    "rgb:d4/7f/d4",
+    "rgb:d4/aa/00",
+    "rgb:d4/aa/2a",
+    "rgb:d4/aa/55",
+    "rgb:d4/aa/7f",
+    "rgb:d4/aa/aa",
+    "rgb:d4/aa/d4",
+    "rgb:d4/d4/00",
+    "rgb:d4/d4/2a",
+    "rgb:d4/d4/55",
+    "rgb:d4/d4/7f",
+    "rgb:d4/d4/aa",
+    "rgb:d4/d4/d4",
+
+    /* grayscale */
+    "rgb:08/08/08",
+    "rgb:12/12/12",
+    "rgb:1c/1c/1c",
+    "rgb:26/26/26",
+    "rgb:30/30/30",
+    "rgb:3a/3a/3a",
+    "rgb:44/44/44",
+    "rgb:4e/4e/4e",
+    "rgb:58/58/58",
+    "rgb:62/62/62",
+    "rgb:6c/6c/6c",
+    "rgb:76/76/76",
+    "rgb:80/80/80",
+    "rgb:8a/8a/8a",
+    "rgb:94/94/94",
+    "rgb:9e/9e/9e",
+    "rgb:a8/a8/a8",
+    "rgb:b2/b2/b2",
+    "rgb:bc/bc/bc",
+    "rgb:c6/c6/c6",
+    "rgb:d0/d0/d0",
+    "rgb:da/da/da",
+    "rgb:e4/e4/e4",
+    "rgb:ee/ee/ee",
+
+    /* fg/bg */
+    "rgb:aa/aa/aa", "rgb:0/0/0",
+
 #ifndef NO_CURSORCOLOR
     NULL, NULL,                 /* cursorColor, cursorColor2 */
 #endif                          /* NO_CURSORCOLOR */
@@ -1268,9 +1515,11 @@
             if (ch) {
                 if (ch == '\t')
                     ch = ' ';   /* translate '\t' to space */
-                else if (ch < ' ')
+                else if (ch < ' ') {
+                   if (ch == 27 && (ch = cmd_getc()) == '\\')  /* ESC \ (ST) 
is String Terminator in Xterm */
+                       break;
                     return;     /* control character - exit */
-
+               }
                 if (n < sizeof(string) - 1)
                     string[n++] = ch;
             }
@@ -1652,6 +1901,13 @@
           case 37:
               scr_color(minColor + (arg[i] - 30), RS_Bold);
               break;
+          case 38:
+             if (arg[i+1] == 5) {
+                 i += 2;
+                  if (arg[i] >= 0 && arg[i] < 256)
+                     scr_color(arg[i], RS_Bold);                 
+             }
+             break;
           /* default fg */
           case 39:
               scr_color(restoreFG, RS_Bold);
@@ -1668,6 +1924,13 @@
           case 47:
               scr_color(minColor + (arg[i] - 40), RS_Blink);
               break;
+          case 48:
+             if (arg[i+1] == 5) {
+                 i += 2;
+                  if (arg[i] >= 0 && arg[i] < 256) 
+                     scr_color(arg[i], RS_Blink);                
+             }
+             break;
           /* default bg */
           case 49:
               scr_color(restoreBG, RS_Blink);
@@ -1843,6 +2106,7 @@
  *       1 = change icon name
  *       2 = change title
  *       3 = set text property on window
+ *       4 = set any of 256 colors 
  *      46 = change logfile (not implemented)
  *      50 = change font
  *
@@ -1861,6 +2125,7 @@
     XColor xcol;
     char *nstr, *tnstr, *valptr;
     unsigned char eterm_seq_op;
+    unsigned int i;
     XWMHints *wm_hints;
 
 #ifdef PIXMAP_SUPPORT
@@ -1894,6 +2159,17 @@
           }
           set_text_property(TermWin.parent, nstr, valptr);
           break;
+      case ESCSEQ_XTERM_CHANGE_COLOR:  /* Changing existing colors 256 */
+          while ((nstr = (char *) strsep(&tnstr, ";")) != NULL) {
+              i = (unsigned int) strtoul(nstr, (char **) NULL, 0);
+              nstr = (char *) strsep(&tnstr, ";");
+              if ((i < 256) && (nstr != NULL)) {
+                  D_COLORS(("Changing color : [%d] -> %s\n", i, nstr));
+                  set_window_color(i, nstr);
+              }
+          } 
+          break;
+
       case ESCSEQ_XTERM_TAKEOVER: /* 5 */
           XSetInputFocus(Xdisplay, TermWin.parent, RevertToParent, 
CurrentTime);
           XRaiseWindow(Xdisplay, TermWin.parent);
===================================================================
RCS file: /cvsroot/enlightenment/eterm/Eterm/src/term.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -3 -r1.27 -r1.28
--- term.h      11 Jan 2004 22:10:29 -0000      1.27
+++ term.h      18 Apr 2005 22:04:04 -0000      1.28
@@ -63,6 +63,7 @@
 # define ESCSEQ_XTERM_ICONNAME       1
 # define ESCSEQ_XTERM_TITLE          2
 # define ESCSEQ_XTERM_PROP           3
+# define ESCSEQ_XTERM_CHANGE_COLOR   4
 # define ESCSEQ_XTERM_FGCOLOR       10
 # define ESCSEQ_XTERM_BGCOLOR       11
 # define ESCSEQ_XTERM_CURSOR_COLOR  12
@@ -84,13 +85,11 @@
 # define ESCSEQ_XTERM_RESTOREFG   39     /* change default fg color */
 # define ESCSEQ_XTERM_RESTOREBG   49     /* change default bg color */
 
-# define restoreFG  39  /* restore default fg color */
-# define restoreBG  49  /* restore default bg color */
+# define restoreFG  512  /* restore default fg color */
+# define restoreBG  513  /* restore default bg color */
 
-enum color_list {
-    fgColor,
-    bgColor,
-    minColor,                          /* 2 */
+enum ansi_color_list {
+    minColor,                          /* 0 */
     BlackColor = minColor,
     Red3Color,
     Green3Color,
@@ -110,6 +109,11 @@
     CyanColor,
     maxBright,                         /* minBright + 7 */
     WhiteColor = maxBright,
+};
+
+enum color_list {  /* Extra colors */
+    fgColor = 256,
+    bgColor,
 # ifndef NO_CURSORCOLOR
     cursorColor,
     cursorColor2,
===================================================================
RCS file: /cvsroot/enlightenment/eterm/Eterm/src/windows.c,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -3 -r1.69 -r1.70
--- windows.c   15 Mar 2005 21:48:12 -0000      1.69
+++ windows.c   18 Apr 2005 22:04:04 -0000      1.70
@@ -21,7 +21,7 @@
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
-static const char cvs_ident[] = "$Id: windows.c,v 1.69 2005/03/15 21:48:12 mej 
Exp $";
+static const char cvs_ident[] = "$Id: windows.c,v 1.70 2005/04/18 22:04:04 mej 
Exp $";
 
 #include "config.h"
 #include "feature.h"
@@ -261,6 +261,7 @@
     Pixel pixel;
 
     for (i = 0; i < NRS_COLORS; i++) {
+        D_COLORS(("Adding color %d of %d 
(%s)\n",i,NRS_COLORS,def_colorName[i]));
         if ((Xdepth <= 2) || ((pixel = get_color_by_name(rs_color[i], 
def_colorName[i])) == (Pixel) (-1))) {
             switch (i) {
               case fgColor:
@@ -304,6 +305,7 @@
                   break;
             }
         }
+        D_COLORS(("Pixel : %x\n",pixel));
         PixColors[i] = pixel;
     }
 
@@ -677,7 +679,7 @@
 {
     static Pixel default_colors[NRS_COLORS + EXTRA_COLORS];
     static unsigned char stored = 0;
-    unsigned char i;
+    unsigned int i;
 
     if (op == SAVE) {
         for (i = 0; i < NRS_COLORS; i++) {
@@ -719,6 +721,9 @@
             print_warning("Unable to allocate \"%s\" in the color map.\n", 
color);
             return;
         }
+        if ((idx > maxBright) && (idx < 256) && (PixColors[idx])) {
+            XFreeColors(Xdisplay, cmap, (unsigned long *) &(PixColors[idx]), 
1, 0);
+        }
         PixColors[idx] = xcol.pixel;
     } else {
         print_warning("Unable to resolve \"%s\" as a color name.\n", color);




-------------------------------------------------------
This SF.Net email is sponsored by: New Crystal Reports XI.
Version 11 adds new functionality designed to reduce time involved in
creating, integrating, and deploying reporting solutions. Free runtime info,
new features, or free trial, at: http://www.businessobjects.com/devxi/728
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to