repo: rxvt-unicode-sixel
action: commit
revision: 
path_from: 
revision_from: a9b307ce9992324db262e137c1806dc67897d34b:
path_to: 
revision_to: 
git.thebackupbox.net
rxvt-unicode-sixel
git clone git://git.thebackupbox.net/rxvt-unicode-sixel
commit a9b307ce9992324db262e137c1806dc67897d34b
Author: Marc Lehmann 
Date:   Wed Aug 25 03:47:20 2004 +0000

    *** empty log message ***

diff --git a/doc/rxvt.7.pod b/doc/rxvt.7.pod
index 266ed679b57f74d4ded1a964551389b55e6b08e3..
index ..58bad112fc6c184b19cd0159cc23df66d5894142 100644
--- a/doc/rxvt.7.pod
+++ b/doc/rxvt.7.pod
@@ -1,3 +1,25 @@
+=head1 NAME
+
+RXVT TECHNICAL REFERENCE - command sequences and background information
+
+=head1 SYNOPSIS
+
+   # set a new font set
+   printf '\33]50;%s\007' 9x15,xft:Kochi" Mincho"
+
+   # change the locale and tell rxvt-unicode about it
+   export LC_CTYPE=ja_JP.EUC-JP; printf "\33]701;$LC_CTYPE\007"
+
+   # set window title
+   printf '\33]2;%s\007' "new window title"
+
+=head1 DESCRIPTION
+
+The rest of this document describes various technical aspects of
+B. First the description of supported command sequences,
+followed by menu and pixmap support and last by a description of all
+features selectable at C time.
+
 =head1 RXVT TECHNICAL REFERENCE

 =head1 Definitions
@@ -151,11 +173,11 @@ Invoke the G2 Character Set (LS2)

 Invoke the G3 Character Set (LS3)

-=item B<< C(C >>
+=item B<< C ( C> >>

 Designate G0 Character Set (ISO 2022), see below for values of C.

-=item B<< C)C >>
+=item B<< C ) C> >>

 Designate G1 Character Set (ISO 2022), see below for values of C.

@@ -332,21 +354,22 @@ Tab Clear (TBC)

 =end table

+=item B<< C >>
+
+Set Mode (SM). See B<< C >> sequence for description of C.
+
 =item B<< C >>

-Printing
+Printing. See also the C resource.

 =begin table

+	B<< C >>	print screen (MC0)
 	B<< C >>	disable transparent print mode (MC4)
-	B<< C >>	enable transparent print mode (MC5) I
+	B<< C >>	enable transparent print mode (MC5)

 =end table

-=item B<< C >>
-
-Set Mode (SM). See next sequence for description of C.
-
 =item B<< C >>

 Reset Mode (RM)
@@ -381,12 +404,12 @@ Character Attributes (SGR)

 	B<< C >>	Normal (default)
 	B<< C >>	On / Off Bold (bright fg)
-	B<< C >>	On / Off Italic (NYI)
+	B<< C >>	On / Off Italic
 	B<< C >>	On / Off Underline
 	B<< C >>	On / Off Slow Blink (bright bg)
 	B<< C >>	On / Off Rapid Blink (bright bg)
-	B<< C >>	On / Off Invisible (NYI)
-	B<< C >>	On / Off Inverse
+	B<< C >>	On / Off Inverse
+	B<< C >>	On / Off Invisible (NYI)
 	B<< C >>	fg/bg Black
 	B<< C >>	fg/bg Red
 	B<< C >>	fg/bg Green
@@ -394,6 +417,7 @@ Character Attributes (SGR)
 	B<< C >>	fg/bg Blue
 	B<< C >>	fg/bg Magenta
 	B<< C >>	fg/bg Cyan
+	B<< C >>	set fg/bg to color #m (ISO 8613-6)
 	B<< C >>	fg/bg White
 	B<< C >>	fg/bg Default
 	B<< C >>	fg/bg Bright Black
@@ -747,8 +771,13 @@ B can be escaped by prefixing it with SYN (0x16, ^V).
 	B<< C >>	Set fontset to B<< C >>, with the following special values of B<< C >> (B) B<< C<#+n> >> change up B<< C >> B<< C<#-n> >> change down B<< C >> if B<< C >> is missing of 0, a value of 1 is used I change to font0 B<< C >> change to font B<< C >>
 	B<< C >>	Log all scrollback buffer and all of screen to B<< C >>
 	B<< C >>	Change current locale to B<< C >>, or, if B<< C >> is B<< C >>, return the current locale (@@RXVT_NAME@@ extension)
-	B<< C >>	find font for character, used for debugging (@@RXVT_NAME@@ extension)
-	B<< C >>	menubar command B<< C >> I (@@RXVT_NAME@@ extension)
+	B<< C >>	Menubar command B<< C >> I (rxvt-unicode extension)
+	B<< C >>	Change colour of italic characters to B<< C >>
+	B<< C >>	Change background pixmap tint colour to B<< C >>
+	B<< C >>	Set normal fontset to B<< C >>. Same as C.
+	B<< C >>	Set bold fontset to B<< C >>. Similar to C.
+	B<< C >>	Set italic fontset to B<< C >>. Similar to C.
+	B<< C >>	Set bold-italic fontset to B<< C >>. Similar to C.

 =end table

@@ -1435,13 +1464,19 @@ Add support for Xft (anti-aliases, among others) fonts. Xft fonts are
 slower and require lots of memory, but as long as you don't use them, you
 don't pay for them.

+=item --enable-font-styles
+
+Add support for B, I and B<< I >> font
+styles. The fonts can be set manually or automatically.
+
 =item --with-codesets=NAME,...

-Compile in support for additional codeset (encoding) groups. These codeset
-tables are currently only used for driving X11 core fonts, they are not
-required for Xft fonts. Compiling them in will make your binary bigger
-(together about 700kB), but it doesn't increase memory usage unless you
-use an X11 font requiring one of these encodings.
+Compile in support for additional codeset (encoding) groups (eu, vn are
+always compiled in, which includes most 8-bit character sets). These
+codeset tables are currently only used for driving X11 core fonts, they
+are not required for Xft fonts. Compiling them in will make your binary
+bigger (together about 700kB), but it doesn't increase memory usage unless
+you use an X11 font requiring one of these encodings.

 =begin table

@@ -1662,13 +1697,6 @@ Add smart growth/shrink behaviour when changing font size via from hot
 keys. This should keep in a fixed position the rxvt corner which is
 closest to a corner of the screen.

-=item --enable-256-color
-
-Add support for 256 colours rather than the base 16 colours.
-
-This option will likely go away in the future. Speak up if you don't want
-this.
-
 =item --enable-cursor-blink

 Add support for a blinking cursor.
diff --git a/src/command.C b/src/command.C
index 3cd507767ddc7f65a226f61cd2cc6021fe39134a..
index ..338e81222e0546befc1ed6d6712f2d8f4ca0b4a3 100644
--- a/src/command.C
+++ b/src/command.C
@@ -135,7 +135,8 @@ rxvt_term::iso14755_54 (int x, int y)

       if (t != NOCHAR || !x)
         {
-          iso14755_51 (screen.text[y + TermWin.saveLines - TermWin.view_start][x]);
+          iso14755_51 (screen.text[y + TermWin.saveLines - TermWin.view_start][x],
+                       screen.rend[y + TermWin.saveLines - TermWin.view_start][x]);
           iso14755buf = ISO_14755_54;
           break;
         }
@@ -148,9 +149,11 @@ rxvt_term::iso14755_54 (int x, int y)

 #if ENABLE_OVERLAY
 void
-rxvt_term::iso14755_51 (wchar_t ch)
+rxvt_term::iso14755_51 (unicode_t ch, rend_t r)
 {
-  wchar_t *chr, *alloc;
+  rxvt_fontset *fs = FONTSET (r);
+  rxvt_font *f = (*fs)[fs->find_font (ch)];
+  wchar_t *chr, *alloc, ch2;
   int len;

 #if ENABLE_COMBINING
@@ -163,12 +166,18 @@ rxvt_term::iso14755_51 (wchar_t ch)
   else
 #endif
     {
+      ch2 = ch;
+
       alloc = 0;
-      chr = &ch;
+      chr = &ch2;
       len = 1;
     }

-  scr_overlay_new (0, -1, 8 + 5, len);
+  int width = strlen (f->name);
+
+  scr_overlay_new (0, -1, width < 8+5 ? 8+5 : width, len + 1);
+
+  r = SET_STYLE (OVERLAY_RSTYLE, GET_STYLE (r));

   for (int y = 0; y < len; y++)
     {
@@ -183,10 +192,12 @@ rxvt_term::iso14755_51 (wchar_t ch)
       if (ch >= 0x10000)
         ch = 0xfffd;
 #endif
-      scr_overlay_set (11, y, ch);
-      scr_overlay_set (12, y, NOCHAR);
+      scr_overlay_set (11, y, ch, r);
+      scr_overlay_set (12, y, NOCHAR, r);
     }

+  scr_overlay_set (0, len, f->name);
+
 #if ENABLE_COMBINING
   if (alloc)
     delete [] alloc;
@@ -1139,10 +1150,9 @@ rxvt_term::mouse_report (XButtonEvent &ev)
 #ifdef MOUSE_REPORT_DOUBLECLICK
       key_state += ((MEvent.clicks > 1) ? 32 : 0);
 #endif
-
     }

-#ifdef DEBUG_MOUSEREPORT
+#if DEBUG_MOUSEREPORT
   fprintf (stderr, "Mouse [");
   if (key_state & 16)
     fputc ('C', stderr);
@@ -1156,12 +1166,12 @@ rxvt_term::mouse_report (XButtonEvent &ev)
           button_number,
           x + 1,
           y + 1);
-#else
+#endif
+
   tt_printf ("\033[M%c%c%c",
             (32 + button_number + key_state),
             (32 + x + 1),
             (32 + y + 1));
-#endif
 }

 #ifdef USING_W11LIB
@@ -1229,7 +1239,7 @@ rxvt_term::x_cb (XEvent &ev)

       case KeyRelease:
         {
-#if (defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING)) || defined (ENABLE_FRILLS)
+#if (MOUSE_WHEEL && MOUSE_SLIP_WHEELING) || ISO_14755
           KeySym ks;

           ks = XLookupKeysym (&ev.xkey, ev.xkey.state & ShiftMask ? 1 : 0); // sorry, only shift supported :/
@@ -1390,9 +1400,7 @@ rxvt_term::x_cb (XEvent &ev)
             if (rs[Rs_fade])
               {
                 pix_colors = pix_colors_focused;
-                set_colorfgbg ();
-                scr_clear ();
-                scr_touch (true);
+                scr_recolour ();
               }
 #endif

@@ -1404,6 +1412,13 @@ rxvt_term::x_cb (XEvent &ev)
           {
             TermWin.focus = 0;
             want_refresh = 1;
+
+#if ENABLE_FRILLS || ISO_14755
+            iso14755buf = 0;
+#endif
+#if ENABLE_OVERLAY
+            scr_overlay_off ();
+#endif
 #ifdef USE_XIM
             if (Input_Context != NULL)
               XUnsetICFocus (Input_Context);
@@ -1417,12 +1432,9 @@ rxvt_term::x_cb (XEvent &ev)
             if (rs[Rs_fade])
               {
                 pix_colors = pix_colors_unfocused;
-                set_colorfgbg ();
-                scr_clear ();
-                scr_touch (true);
+                scr_recolour ();
               }
 #endif
-
           }
         break;

@@ -1440,7 +1452,10 @@ rxvt_term::x_cb (XEvent &ev)
             while (XCheckTypedWindowEvent (display->display, ev.xconfigure.window, ConfigureNotify, &ev));

             if (szHint.width != width || szHint.height != height)
-              resize_all_windows (width, height, 1);
+              {
+                seen_resize = 1;
+                resize_all_windows (width, height, 1);
+              }

 #ifdef TRANSPARENT		/* XXX: maybe not needed - leave in for now */
             if (options & Opt_transparent)
@@ -2517,11 +2532,9 @@ rxvt_term::check_our_parents ()
         TermWin.parent[i] = None;
     }

-  // this is experimental
   if (scrollBar.win)
     {
       XSetWindowBackgroundPixmap (display->display, scrollBar.win, ParentRelative);
-      XClearWindow (display->display, scrollBar.win);
       scrollBar.setIdle ();
       scrollbar_show (0);
     }
@@ -2559,7 +2572,11 @@ rxvt_term::cmd_parse ()
               // they first read the screensize and then install a SIGWINCH handler.
               // some window managers resize the window early, and these programs
               // then sometimes get the size wrong.
-              kill (-cmd_pid, SIGWINCH);
+              // unfortunately other programs are even more buggy and dislike
+              // being sent SIGWINCH, so only do it when we were in fact being
+              // resized.
+              if (seen_resize)
+                kill (-cmd_pid, SIGWINCH);
             }

           /* Read a text string from the input buffer */
@@ -3489,36 +3506,40 @@ rxvt_term::process_window_ops (const int *args, unsigned int nargs)
 unsigned char *
 rxvt_term::get_to_st (unicode_t &ends_how)
 {
-  unicode_t prev = 0, ch;
+  unicode_t seen_esc = 0, ch;
   unsigned int n = 0;
   unsigned char *s;
   unsigned char string[STRING_MAX];

   while ((ch = cmd_getc ()) != NOCHAR)
     {
-      if (prev == C0_ESC)
+      if (seen_esc)
         {
           if (ch == 0x5c)	/* 7bit ST */
             break;
           else
             return NULL;
         }
+      else if (ch == C0_ESC)
+        {
+          seen_esc = 1;
+          continue;
+        }
       else if (ch == C0_BEL || ch == CHAR_ST)
         break;
       else if (ch < 0x20)
         return NULL;	/* other control character - exit */

+      seen_esc = 0;
+
       if (n >= sizeof (string) - 1)
         // stop at some sane length
         return NULL;

       if (ch == C0_SYN)
-        {
-          string[n++] = cmd_get8 ();
-          prev = 0;
-        }
+        string[n++] = cmd_get8 ();
       else
-        string[n++] = prev = ch;
+        string[n++] = ch;
     }

   string[n++] = '\0';
@@ -3622,6 +3643,7 @@ rxvt_term::process_xterm_seq (int op, const char *str, unsigned char resp)
   int color;
   char *buf, *name;
   bool query = str[0] == '?' && !str[1];
+  int saveop = op;

   assert (str != NULL);
   switch (op)
@@ -3723,6 +3745,9 @@ rxvt_term::process_xterm_seq (int op, const char *str, unsigned char resp)
       case XTerm_Color_BD:
         process_color_seq (XTerm_Color_BD, Color_BD, str, resp);
         break;
+      case XTerm_Color_IT:
+        process_color_seq (XTerm_Color_IT, Color_IT, str, resp);
+        break;
       case XTerm_Color_UL:
         process_color_seq (XTerm_Color_UL, Color_UL, str, resp);
         break;
@@ -3730,6 +3755,14 @@ rxvt_term::process_xterm_seq (int op, const char *str, unsigned char resp)
         process_color_seq (XTerm_Color_RV, Color_RV, str, resp);
         break;
 #endif
+#if TRANSPARENT || TINTING
+      case XTerm_Color_tint:
+        process_color_seq (XTerm_Color_tint, Color_tint, str, resp);
+        check_our_parents ();
+        if (am_transparent)
+          want_full_refresh = want_refresh = 1;
+        break;
+#endif

       case XTerm_Pixmap:
         if (*str != ';')
@@ -3769,13 +3802,26 @@ rxvt_term::process_xterm_seq (int op, const char *str, unsigned char resp)
         break;

       case XTerm_font:
+        op = URxvt_font;
+      case URxvt_font:
+#if ENABLE_STYLES
+      case URxvt_boldFont:
+      case URxvt_italicFont:
+      case URxvt_boldItalicFont:
+#endif
         if (query)
-          tt_printf ("\33]%d;%-.250s%c", XTerm_font,
-                     (options & Opt_insecure) && TermWin.fontset->fontdesc
-                       ? TermWin.fontset->fontdesc : "",
+          tt_printf ("\33]%d;%-.250s%c", saveop,
+                     (options & Opt_insecure) && TermWin.fontset[op - URxvt_font]->fontdesc
+                       ? TermWin.fontset[op - URxvt_font]->fontdesc : "",
                      resp);
         else
-          change_font (str);
+          {
+            const char *&res = rs[Rs_font + (op - URxvt_font)];
+
+            res = strdup (str);
+            allocated.push_back ((void *)res);
+            set_fonts ();
+          }
         break;

 #if ENABLE_FRILLS
@@ -3790,16 +3836,6 @@ rxvt_term::process_xterm_seq (int op, const char *str, unsigned char resp)
 # endif
           }
         break;
-
-      case XTerm_findfont:
-        {
-          int fid = TermWin.fontset->find_font (atoi (str));
-          tt_printf ("\33]%d;%d;%-.250s%c", XTerm_findfont,
-                     fid,
-                     (options & Opt_insecure) ? (*TermWin.fontset)[fid]->name : "",
-                     resp);
-        }
-        break;
 #endif

 #ifdef MENUBAR
@@ -3937,6 +3973,7 @@ rxvt_term::process_terminal_mode (int mode, int priv __attribute__ ((unused)), u
       switch (arg[i])
         {
           case 1048:		/* alternative cursor save */
+          case 1049:
             if (options & Opt_secondaryScreen)
               if (mode == 0)
                 scr_cursor (RESTORE);
@@ -4071,8 +4108,10 @@ rxvt_term::process_sgr_mode (unsigned int nargs, const int *arg)
           case 1:
             rendset = 1, rendstyle = RS_Bold;
             break;
-          //case 2: // faint or second colour
-          //case 3: // italic
+          //case 2: // low intensity
+          case 3:
+            rendset = 1, rendstyle = RS_Italic;
+            break;
           case 4:
             rendset = 1, rendstyle = RS_Uline;
             break;
@@ -4094,20 +4133,22 @@ rxvt_term::process_sgr_mode (unsigned int nargs, const int *arg)
           //...
           //case 19: // ninth alt font
           //case 20: // gothic
-          case 21: // disable bold, faint
+          case 21: // disable bold, faint, sometimes doubly underlined (iso 8613)
             rendset = 0, rendstyle = RS_Bold;
             break;
-          case 22:
+          case 22: // normal intensity
             rendset = 0, rendstyle = RS_Bold;
             break;
-          //case 23: disable italic
+          case 23: // disable italic
+            rendset = 0, rendstyle = RS_Italic;
+            break;
           case 24:
             rendset = 0, rendstyle = RS_Uline;
             break;
           case 25:
             rendset = 0, rendstyle = RS_Blink;
             break;
-          case 26:
+          case 26: // variable spacing (iso 8613)
             rendset = 0, rendstyle = RS_Blink;
             break;
           case 27:
@@ -4135,15 +4176,13 @@ rxvt_term::process_sgr_mode (unsigned int nargs, const int *arg)
           case 37:
             scr_color ((unsigned int) (minCOLOR + (arg[i] - 30)), Color_fg);
             break;
-#ifdef TTY_256COLOR
-          case 38:
+          case 38: // set fg color, ISO 8613-6
             if (nargs > i + 2 && arg[i + 1] == 5)
               {
                 scr_color ((unsigned int) (minCOLOR + arg[i + 2]), Color_fg);
                 i += 2;
               }
             break;
-#endif
           case 39:		/* default fg */
             scr_color (Color_fg, Color_fg);
             break;
@@ -4158,19 +4197,19 @@ rxvt_term::process_sgr_mode (unsigned int nargs, const int *arg)
           case 47:
             scr_color ((unsigned int) (minCOLOR + (arg[i] - 40)), Color_bg);
             break;
-#ifdef TTY_256COLOR
-          case 48:
+          case 48: // set bg color, ISO 8613-6
             if (nargs > i + 2 && arg[i + 1] == 5)
               {
                 scr_color ((unsigned int) (minCOLOR + arg[i + 2]), Color_bg);
                 i += 2;
               }
             break;
-#endif
           case 49:		/* default bg */
             scr_color (Color_bg, Color_bg);
             break;

+          //case 50: // not variable spacing
+
 #ifndef NO_BRIGHTCOLOR
           case 90:
           case 91:		/* set bright fg color */
@@ -4180,8 +4219,7 @@ rxvt_term::process_sgr_mode (unsigned int nargs, const int *arg)
           case 95:
           case 96:
           case 97:
-            scr_color ((unsigned int) (minBrightCOLOR + (arg[i] - 90)),
-                       Color_fg);
+            scr_color ((unsigned int) (minBrightCOLOR + (arg[i] - 90)), Color_fg);
             break;
           case 100:
           case 101:		/* set bright bg color */
@@ -4191,8 +4229,7 @@ rxvt_term::process_sgr_mode (unsigned int nargs, const int *arg)
           case 105:
           case 106:
           case 107:
-            scr_color ((unsigned int) (minBrightCOLOR + (arg[i] - 100)),
-                       Color_bg);
+            scr_color ((unsigned int) (minBrightCOLOR + (arg[i] - 100)), Color_bg);
             break;
 #endif

@@ -4244,7 +4281,7 @@ rxvt_term::tt_printf (const char *fmt,...)
 void
 rxvt_term::tt_write (const unsigned char *data, unsigned int len)
 {
-  enum { MAX_PTY_WRITE = 255 }; // minimum MAX_INPUT
+  const unsigned int MAX_PTY_WRITE = 255; // minimum MAX_INPUT

   if (len)
     {
@@ -4268,7 +4305,7 @@ rxvt_term::tt_write (const unsigned char *data, unsigned int len)

   for (;;)
     {
-      int written = write (pty.pty, v_buffer, min (MAX_PTY_WRITE, v_buflen));
+      int written = write (pty.pty, v_buffer, min (v_buflen, MAX_PTY_WRITE));

       if (written > 0)
         {
diff --git a/src/init.C b/src/init.C
index d3ea2afd8dca567d7774431fa9be0bab3a1d8db9..
index ..42e40331433f9b4d47df5644b05581cd1a727f1e 100644
--- a/src/init.C
+++ b/src/init.C
@@ -69,248 +69,81 @@ const char *const def_colorName[] =
     "Magenta",                  /* 5/13: bright magenta (#FF00FF) */
     "Cyan",                     /* 6/14: bright cyan    (#00FFFF) */
     "White",                    /* 7/15: bright white   (#FFFFFF) */
-#ifdef TTY_256COLOR
-    "rgbi:0/0/0",               /* default 16-255 color table     */
-    "rgbi:0/0/.2",              /* consists of 6 6x6 colour cubes */
-    "rgbi:0/0/.4",              /* and a 24 greyscale ramp w/o    */
-    "rgbi:0/0/.6",              /* black or white                 */
-    "rgbi:0/0/.8",
-    "rgbi:0/0/1",
-    "rgbi:0/.2/0",
-    "rgbi:0/.2/.2",
-    "rgbi:0/.2/.4",
-    "rgbi:0/.2/.6",
-    "rgbi:0/.2/.8",
-    "rgbi:0/.2/1",
-    "rgbi:0/.4/0",
-    "rgbi:0/.4/.2",
-    "rgbi:0/.4/.4",
-    "rgbi:0/.4/.6",
-    "rgbi:0/.4/.8",
-    "rgbi:0/.4/1",
-    "rgbi:0/.6/0",
-    "rgbi:0/.6/.2",
-    "rgbi:0/.6/.4",
-    "rgbi:0/.6/.6",
-    "rgbi:0/.6/.8",
-    "rgbi:0/.6/1",
-    "rgbi:0/.8/0",
-    "rgbi:0/.8/.2",
-    "rgbi:0/.8/.4",
-    "rgbi:0/.8/.6",
-    "rgbi:0/.8/.8",
-    "rgbi:0/.8/1",
-    "rgbi:0/1/0",
-    "rgbi:0/1/.2",
-    "rgbi:0/1/.4",
-    "rgbi:0/1/.6",
-    "rgbi:0/1/.8",
-    "rgbi:0/1/1",
-    "rgbi:.2/0/0",
-    "rgbi:.2/0/.2",
-    "rgbi:.2/0/.4",
-    "rgbi:.2/0/.6",
-    "rgbi:.2/0/.8",
-    "rgbi:.2/0/1",
-    "rgbi:.2/.2/0",
-    "rgbi:.2/.2/.2",
-    "rgbi:.2/.2/.4",
-    "rgbi:.2/.2/.6",
-    "rgbi:.2/.2/.8",
-    "rgbi:.2/.2/1",
-    "rgbi:.2/.4/0",
-    "rgbi:.2/.4/.2",
-    "rgbi:.2/.4/.4",
-    "rgbi:.2/.4/.6",
-    "rgbi:.2/.4/.8",
-    "rgbi:.2/.4/1",
-    "rgbi:.2/.6/0",
-    "rgbi:.2/.6/.2",
-    "rgbi:.2/.6/.4",
-    "rgbi:.2/.6/.6",
-    "rgbi:.2/.6/.8",
-    "rgbi:.2/.6/1",
-    "rgbi:.2/.8/0",
-    "rgbi:.2/.8/.2",
-    "rgbi:.2/.8/.4",
-    "rgbi:.2/.8/.6",
-    "rgbi:.2/.8/.8",
-    "rgbi:.2/.8/1",
-    "rgbi:.2/1/0",
-    "rgbi:.2/1/.2",
-    "rgbi:.2/1/.4",
-    "rgbi:.2/1/.6",
-    "rgbi:.2/1/.8",
-    "rgbi:.2/1/1",
-    "rgbi:.4/0/0",
-    "rgbi:.4/0/.2",
-    "rgbi:.4/0/.4",
-    "rgbi:.4/0/.6",
-    "rgbi:.4/0/.8",
-    "rgbi:.4/0/1",
-    "rgbi:.4/.2/0",
-    "rgbi:.4/.2/.2",
-    "rgbi:.4/.2/.4",
-    "rgbi:.4/.2/.6",
-    "rgbi:.4/.2/.8",
-    "rgbi:.4/.2/1",
-    "rgbi:.4/.4/0",
-    "rgbi:.4/.4/.2",
-    "rgbi:.4/.4/.4",
-    "rgbi:.4/.4/.6",
-    "rgbi:.4/.4/.8",
-    "rgbi:.4/.4/1",
-    "rgbi:.4/.6/0",
-    "rgbi:.4/.6/.2",
-    "rgbi:.4/.6/.4",
-    "rgbi:.4/.6/.6",
-    "rgbi:.4/.6/.8",
-    "rgbi:.4/.6/1",
-    "rgbi:.4/.8/0",
-    "rgbi:.4/.8/.2",
-    "rgbi:.4/.8/.4",
-    "rgbi:.4/.8/.6",
-    "rgbi:.4/.8/.8",
-    "rgbi:.4/.8/1",
-    "rgbi:.4/1/0",
-    "rgbi:.4/1/.2",
-    "rgbi:.4/1/.4",
-    "rgbi:.4/1/.6",
-    "rgbi:.4/1/.8",
-    "rgbi:.4/1/1",
-    "rgbi:.6/0/0",
-    "rgbi:.6/0/.2",
-    "rgbi:.6/0/.4",
-    "rgbi:.6/0/.6",
-    "rgbi:.6/0/.8",
-    "rgbi:.6/0/1",
-    "rgbi:.6/.2/0",
-    "rgbi:.6/.2/.2",
-    "rgbi:.6/.2/.4",
-    "rgbi:.6/.2/.6",
-    "rgbi:.6/.2/.8",
-    "rgbi:.6/.2/1",
-    "rgbi:.6/.4/0",
-    "rgbi:.6/.4/.2",
-    "rgbi:.6/.4/.4",
-    "rgbi:.6/.4/.6",
-    "rgbi:.6/.4/.8",
-    "rgbi:.6/.4/1",
-    "rgbi:.6/.6/0",
-    "rgbi:.6/.6/.2",
-    "rgbi:.6/.6/.4",
-    "rgbi:.6/.6/.6",
-    "rgbi:.6/.6/.8",
-    "rgbi:.6/.6/1",
-    "rgbi:.6/.8/0",
-    "rgbi:.6/.8/.2",
-    "rgbi:.6/.8/.4",
-    "rgbi:.6/.8/.6",
-    "rgbi:.6/.8/.8",
-    "rgbi:.6/.8/1",
-    "rgbi:.6/1/0",
-    "rgbi:.6/1/.2",
-    "rgbi:.6/1/.4",
-    "rgbi:.6/1/.6",
-    "rgbi:.6/1/.8",
-    "rgbi:.6/1/1",
-    "rgbi:.8/0/0",
-    "rgbi:.8/0/.2",
-    "rgbi:.8/0/.4",
-    "rgbi:.8/0/.6",
-    "rgbi:.8/0/.8",
-    "rgbi:.8/0/1",
-    "rgbi:.8/.2/0",
-    "rgbi:.8/.2/.2",
-    "rgbi:.8/.2/.4",
-    "rgbi:.8/.2/.6",
-    "rgbi:.8/.2/.8",
-    "rgbi:.8/.2/1",
-    "rgbi:.8/.4/0",
-    "rgbi:.8/.4/.2",
-    "rgbi:.8/.4/.4",
-    "rgbi:.8/.4/.6",
-    "rgbi:.8/.4/.8",
-    "rgbi:.8/.4/1",
-    "rgbi:.8/.6/0",
-    "rgbi:.8/.6/.2",
-    "rgbi:.8/.6/.4",
-    "rgbi:.8/.6/.6",
-    "rgbi:.8/.6/.8",
-    "rgbi:.8/.6/1",
-    "rgbi:.8/.8/0",
-    "rgbi:.8/.8/.2",
-    "rgbi:.8/.8/.4",
-    "rgbi:.8/.8/.6",
-    "rgbi:.8/.8/.8",
-    "rgbi:.8/.8/1",
-    "rgbi:.8/1/0",
-    "rgbi:.8/1/.2",
-    "rgbi:.8/1/.4",
-    "rgbi:.8/1/.6",
-    "rgbi:.8/1/.8",
-    "rgbi:.8/1/1",
-    "rgbi:1/0/0",
-    "rgbi:1/0/.2",
-    "rgbi:1/0/.4",
-    "rgbi:1/0/.6",
-    "rgbi:1/0/.8",
-    "rgbi:1/0/1",
-    "rgbi:1/.2/0",
-    "rgbi:1/.2/.2",
-    "rgbi:1/.2/.4",
-    "rgbi:1/.2/.6",
-    "rgbi:1/.2/.8",
-    "rgbi:1/.2/1",
-    "rgbi:1/.4/0",
-    "rgbi:1/.4/.2",
-    "rgbi:1/.4/.4",
-    "rgbi:1/.4/.6",
-    "rgbi:1/.4/.8",
-    "rgbi:1/.4/1",
-    "rgbi:1/.6/0",
-    "rgbi:1/.6/.2",
-    "rgbi:1/.6/.4",
-    "rgbi:1/.6/.6",
-    "rgbi:1/.6/.8",
-    "rgbi:1/.6/1",
-    "rgbi:1/.8/0",
-    "rgbi:1/.8/.2",
-    "rgbi:1/.8/.4",
-    "rgbi:1/.8/.6",
-    "rgbi:1/.8/.8",
-    "rgbi:1/.8/1",
-    "rgbi:1/1/0",
-    "rgbi:1/1/.2",
-    "rgbi:1/1/.4",
-    "rgbi:1/1/.6",
-    "rgbi:1/1/.8",
-    "rgbi:1/1/1",
-    "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",
+
+    // 88 xterm colours
+    "rgb:00/00/00",
+    "rgb:00/00/8b",
+    "rgb:00/00/cd",
+    "rgb:00/00/ff",
+    "rgb:00/8b/00",
+    "rgb:00/8b/8b",
+    "rgb:00/8b/cd",
+    "rgb:00/8b/ff",
+    "rgb:00/cd/00",
+    "rgb:00/cd/8b",
+    "rgb:00/cd/cd",
+    "rgb:00/cd/ff",
+    "rgb:00/ff/00",
+    "rgb:00/ff/8b",
+    "rgb:00/ff/cd",
+    "rgb:00/ff/ff",
+    "rgb:8b/00/00",
+    "rgb:8b/00/8b",
+    "rgb:8b/00/cd",
+    "rgb:8b/00/ff",
+    "rgb:8b/8b/00",
+    "rgb:8b/8b/8b",
+    "rgb:8b/8b/cd",
+    "rgb:8b/8b/ff",
+    "rgb:8b/cd/00",
+    "rgb:8b/cd/8b",
+    "rgb:8b/cd/cd",
+    "rgb:8b/cd/ff",
+    "rgb:8b/ff/00",
+    "rgb:8b/ff/8b",
+    "rgb:8b/ff/cd",
+    "rgb:8b/ff/ff",
+    "rgb:cd/00/00",
+    "rgb:cd/00/8b",
+    "rgb:cd/00/cd",
+    "rgb:cd/00/ff",
+    "rgb:cd/8b/00",
+    "rgb:cd/8b/8b",
+    "rgb:cd/8b/cd",
+    "rgb:cd/8b/ff",
+    "rgb:cd/cd/00",
+    "rgb:cd/cd/8b",
+    "rgb:cd/cd/cd",
+    "rgb:cd/cd/ff",
+    "rgb:cd/ff/00",
+    "rgb:cd/ff/8b",
+    "rgb:cd/ff/cd",
+    "rgb:cd/ff/ff",
+    "rgb:ff/00/00",
+    "rgb:ff/00/8b",
+    "rgb:ff/00/cd",
+    "rgb:ff/00/ff",
+    "rgb:ff/8b/00",
+    "rgb:ff/8b/8b",
+    "rgb:ff/8b/cd",
+    "rgb:ff/8b/ff",
+    "rgb:ff/cd/00",
+    "rgb:ff/cd/8b",
+    "rgb:ff/cd/cd",
+    "rgb:ff/cd/ff",
+    "rgb:ff/ff/00",
+    "rgb:ff/ff/8b",
+    "rgb:ff/ff/cd",
+    "rgb:ff/ff/ff",
+    "rgb:2e/2e/2e",
+    "rgb:5c/5c/5c",
+    "rgb:73/73/73",
+    "rgb:8b/8b/8b",
+    "rgb:a2/a2/a2",
+    "rgb:b9/b9/b9",
     "rgb:d0/d0/d0",
-    "rgb:da/da/da",
-    "rgb:e4/e4/e4",
-    "rgb:ee/ee/ee",
-#endif
+    "rgb:e7/e7/e7",
+
 #ifndef NO_CURSORCOLOR
     COLOR_CURSOR_BACKGROUND,
     COLOR_CURSOR_FOREGROUND,
@@ -320,6 +153,7 @@ const char *const def_colorName[] =
     NULL,                       /* Color_border                   */
 #ifndef NO_BOLD_UNDERLINE_REVERSE
     NULL,                       /* Color_BD                       */
+    NULL,                       /* Color_IT                       */
     NULL,                       /* Color_UL                       */
     NULL,                       /* Color_RV                       */
 #endif                          /* ! NO_BOLD_UNDERLINE_REVERSE */
@@ -388,10 +222,6 @@ rxvt_term::init_vars ()
   TermWin.saveLines = SAVELINES;
   numpix_colors = TOTAL_COLORS;

-#ifndef NO_BRIGHTCOLOR
-  colorfgbg = DEFAULT_RSTYLE;
-#endif
-
   refresh_limit = 1;
   refresh_type = SLOW_REFRESH;
   prev_nrow = prev_ncol = 0;
@@ -601,8 +431,7 @@ rxvt_term::init_resources (int argc, const char *const *argv)
     }

 #ifdef HAVE_SCROLLBARS
-  setup_scrollbar (rs[Rs_scrollBar_align], rs[Rs_scrollstyle],
-                   rs[Rs_scrollBar_thickness]);
+  setup_scrollbar (rs[Rs_scrollBar_align], rs[Rs_scrollstyle], rs[Rs_scrollBar_thickness]);
 #endif

 #ifdef XTERM_REVERSE_VIDEO
@@ -642,6 +471,9 @@ rxvt_term::init_resources (int argc, const char *const *argv)
   color_aliases (Color_RV);
 #endif                          /* ! NO_BOLD_UNDERLINE_REVERSE */

+  if (!rs[Rs_color + Color_border])
+    rs[Rs_color + Color_border] = rs[Rs_color + Color_bg];
+
   return cmd_argv;
 }

@@ -987,7 +819,6 @@ rxvt_term::color_aliases (int idx)
           rs[Rs_color + idx] = rs[Rs_color + minBrightCOLOR + i];
           return;
 #endif
-
         }

       if (i >= 0 && i <= 7)   /* normal colors */
@@ -1115,12 +946,8 @@ rxvt_term::create_windows (int argc, const char *const *argv)
   /* grab colors before netscape does */
   Get_Colours ();

-  if (!change_font (rs[Rs_font]))
-    {
-      fprintf (stderr, "unable to load a base font, please provide one using -fn fontname\n");
-      destroy ();
-      return;
-    }
+  if (!set_fonts ())
+    rxvt_fatal ("unable to load base fontset, please specify one using -fn, aborting.\n");

   window_calc (0, 0);
   old_width = szHint.width;
@@ -1129,8 +956,8 @@ rxvt_term::create_windows (int argc, const char *const *argv)
   /* sub-window placement & size in rxvt_resize_subwindows () */

 #ifdef PREFER_24BIT
-  attributes.background_pixel = pix_colors[Color_bg];
-  attributes.border_pixel = pix_colors[Color_border];
+  attributes.background_pixel = pix_colors_focused[Color_border];
+  attributes.border_pixel = pix_colors_focused[Color_border];
   attributes.colormap = display->cmap;
   TermWin.parent[0] = XCreateWindow (display->display, DefaultRootWindow (display->display),
                                      szHint.x, szHint.y,
@@ -1144,8 +971,8 @@ rxvt_term::create_windows (int argc, const char *const *argv)
                                            szHint.x, szHint.y,
                                            szHint.width, szHint.height,
                                            TermWin.ext_bwidth,
-                                           pix_colors[Color_border],
-                                           pix_colors[Color_bg]);
+                                           pix_colors_focused[Color_border],
+                                           pix_colors_focused[Color_border]);
 #endif

   process_xterm_seq (XTerm_title, rs[Rs_title], CHAR_ST);
@@ -1171,7 +998,7 @@ rxvt_term::create_windows (int argc, const char *const *argv)

   XSelectInput (display->display, TermWin.parent[0],
                 KeyPressMask
-#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING)
+#if (MOUSE_WHEEL && MOUSE_SLIP_WHEELING) || ENABLE_FRILLS || ISO_14755
                 | KeyReleaseMask
 #endif
                 | FocusChangeMask | VisibilityChangeMask
@@ -1182,8 +1009,8 @@ rxvt_term::create_windows (int argc, const char *const *argv)
 #if ENABLE_FRILLS
   if (mwmhints.flags)
     {
-      prop = XInternAtom(display->display, "_MOTIF_WM_HINTS", False);
-      XChangeProperty(display->display, TermWin.parent[0], prop, prop, 32, PropModeReplace, (unsigned char *) &mwmhints, PROP_MWM_HINTS_ELEMENTS);
+      prop = XInternAtom (display->display, "_MOTIF_WM_HINTS", False);
+      XChangeProperty (display->display, TermWin.parent[0], prop, prop, 32, PropModeReplace, (unsigned char *) &mwmhints, PROP_MWM_HINTS_ELEMENTS);
     }
 #endif

@@ -1215,8 +1042,8 @@ rxvt_term::create_windows (int argc, const char *const *argv)
                                    TermWin_TotalWidth (),
                                    TermWin_TotalHeight (),
                                    0,
-                                   pix_colors[Color_fg],
-                                   pix_colors[Color_bg]);
+                                   pix_colors_focused[Color_fg],
+                                   pix_colors_focused[Color_bg]);
 #ifdef DEBUG_X
   XStoreName (display->display, TermWin.vt, "vt window");
 #endif
@@ -1246,8 +1073,8 @@ rxvt_term::create_windows (int argc, const char *const *argv)
                                          TermWin_TotalWidth (),
                                          menuBar_TotalHeight (),
                                          0,
-                                         pix_colors[Color_fg],
-                                         pix_colors[Color_scroll]);
+                                         pix_colors_focused[Color_fg],
+                                         pix_colors_focused[Color_scroll]);

 #ifdef DEBUG_X
       XStoreName (display->display, menuBar.win, "menubar");
@@ -1276,8 +1103,9 @@ rxvt_term::create_windows (int argc, const char *const *argv)
           p++;
           scale_pixmap (p);
         }
+
       set_bgPixmap (rs[Rs_backgroundPixmap]);
-      scr_touch (True);
+      scr_touch (true);
     }
 #endif

@@ -1305,6 +1133,8 @@ rxvt_term::create_windows (int argc, const char *const *argv)
   if (rs[Rs_fade])
     pix_colors = pix_colors_unfocused;
 #endif
+
+  scr_recolour ();
 }

 /* ------------------------------------------------------------------------- *
diff --git a/src/version.h b/src/version.h
index 06343a471fad13c4df23a72fc985176f35ef5b77..
index ..80c809fa2fb37cce1a9fa02b2521998db4388054 100644
--- a/src/version.h
+++ b/src/version.h
@@ -1,5 +1,5 @@
-#define VERSION "3.7"
-#define VSTRING "30700"
-#define DATE	"2004-08-17"
-#define LSMDATE	"17AUG04"
-#define LIBVERSION "3:7:0"
+#define VERSION "3.8"
+#define VSTRING "30800"
+#define DATE	"2004-08-25"
+#define LSMDATE	"25AUG04"
+#define LIBVERSION "3:8:0"

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