*** empty log message ***
authorroot <root>
Wed, 4 Aug 2004 03:29:28 +0000 (03:29 +0000)
committerroot <root>
Wed, 4 Aug 2004 03:29:28 +0000 (03:29 +0000)
48 files changed:
reconf
src/command.C
src/defaultfont.h
src/encoding.C
src/encoding.h
src/gentables
src/main.C
src/rxvt.h
src/rxvtcolor.C
src/rxvtcolor.h
src/rxvtlib.h.in
src/screen.C
src/table/big5.h
src/table/big5_ext.h
src/table/big5_plus.h
src/table/cns11643_1992_1.h
src/table/cns11643_1992_2.h
src/table/cns11643_1992_3.h
src/table/cns11643_1992_4.h
src/table/cns11643_1992_5.h
src/table/cns11643_1992_6.h
src/table/cns11643_1992_7.h
src/table/cns11643_1992_f.h
src/table/gb2312_1980_0.h
src/table/iso8859_1.h
src/table/iso8859_10.h
src/table/iso8859_11.h
src/table/iso8859_13.h
src/table/iso8859_14.h
src/table/iso8859_15.h
src/table/iso8859_16.h
src/table/iso8859_2.h
src/table/iso8859_3.h
src/table/iso8859_4.h
src/table/iso8859_5.h
src/table/iso8859_6.h
src/table/iso8859_7.h
src/table/iso8859_8.h
src/table/iso8859_9.h
src/table/jis0201_1976_0.h
src/table/jis0208_1990_0.h
src/table/jis0212_1990_0.h
src/table/jis0213_1.h
src/table/jis0213_2.h
src/table/koi8_r.h
src/table/koi8_u.h
src/table/ksc5601_1987_0.h
src/table/viscii.h

diff --git a/reconf b/reconf
index b4d860d..2d3de88 100755 (executable)
--- a/reconf
+++ b/reconf
@@ -4,11 +4,11 @@
 # support and is a good baseline :)
 
 ./configure --prefix=/opt/rxvt --enable-utmp \
-            --enable-wtmp --enable-lastlog --enable-xim --disable-strings \
+            --enable-wtmp --enable-lastlog --disable-strings --enable-xim \
             --with-term=rxvt --disable-keepscrolling --enable-xft --enable-mousewheel \
             --with-name=rxvt --enable-selectionscrolling --enable-pointer-blank \
             --enable-frills --enable-swapscreen --enable-transparency --enable-slipwheeling \
-            --with-codesets=eu,jp --enable-menubar --enable-tinting \
+            --with-codesets=all --enable-menubar --enable-tinting \
             --enable-cursor-blink --enable-text-blink --enable-fading \
             --enable-plain-scroll --enable-rxvt-scroll --enable-combining \
             "$@"
index ebaaa1c..c65e4e5 100644 (file)
@@ -677,6 +677,8 @@ rxvt_term::flush ()
     }
 
   display->flush ();
+
+  flush_ev.stop ();
 }
 
 void
@@ -685,6 +687,20 @@ rxvt_term::check_cb (check_watcher &w)
   SET_R (this);
   SET_LOCALE (locale);
 
+  display->flush ();
+
+  if (!flush_ev.active)
+    flush_ev.start (NOW + 0.01);
+}
+
+void
+rxvt_term::flush_cb (time_watcher &w)
+{
+  SET_R (this);
+  SET_LOCALE (locale);
+
+  refresh_limit = 1;
+  refresh_count = 0;
   flush ();
 }
 
@@ -1076,7 +1092,7 @@ rxvt_term::x_cb (XEvent &ev)
         break;
 
       case MappingNotify:
-        XRefreshKeyboardMapping (& (ev.xmapping));
+        XRefreshKeyboardMapping (&ev.xmapping);
         break;
 
         /*
@@ -1171,16 +1187,8 @@ rxvt_term::x_cb (XEvent &ev)
             while (XCheckTypedWindowEvent (display->display, ev.xconfigure.window, ConfigureNotify, &ev));
 
             if (szHint.width != width || szHint.height != height)
-              {
-                D_SIZE ((stderr, "Size: Resizing from: %4d x %4d", szHint.width, szHint.height));
-                resize_all_windows (width, height, 1);
-              }
-#ifdef DEBUG_SIZE
-            else
-              {
-                D_SIZE ((stderr, "Size: Not resizing"));
-              }
-#endif
+              resize_all_windows (width, height, 1);
+
 #ifdef TRANSPARENT             /* XXX: maybe not needed - leave in for now */
             if (Options & Opt_transparent)
               {
@@ -1230,17 +1238,18 @@ rxvt_term::x_cb (XEvent &ev)
       case Expose:
         if (ev.xany.window == TermWin.vt)
           {
-#ifdef NO_SLOW_LINK_SUPPORT
-            scr_expose (ev.xexpose.x, ev.xexpose.y,
-                        ev.xexpose.width, ev.xexpose.height, False);
-#else
-            // I don't understand this, so I changed it :)
-            scr_expose (ev.xexpose.x, ev.xexpose.y,
-                        ev.xexpose.width, ev.xexpose.height, False);
-            //scr_expose (ev.xexpose.x, 0,
-            //             ev.xexpose.width, TermWin.height, False);
-#endif
-            want_refresh = 1;
+            do
+              scr_expose (ev.xexpose.x, ev.xexpose.y,
+                          ev.xexpose.width, ev.xexpose.height, False);
+            while (XCheckTypedWindowEvent (display->display, TermWin.vt, ev.xany.type, &ev));
+
+            ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose;
+
+            while (XCheckTypedWindowEvent (display->display, TermWin.vt, ev.xany.type, &ev))
+              scr_expose (ev.xexpose.x, ev.xexpose.y,
+                          ev.xexpose.width, ev.xexpose.height, False);
+
+            scr_refresh (refresh_type);
           }
         else
           {
@@ -1260,6 +1269,11 @@ rxvt_term::x_cb (XEvent &ev)
             if (menubar_visible () && isMenuBarWindow (ev.xany.window))
               menubar_expose ();
 #endif
+
+#ifdef TRANSPARENT
+            if (am_transparent && ev.xany.window == TermWin.parent[0])
+              XClearWindow (display->display, ev.xany.window);
+#endif
           }
         break;
 
@@ -1769,238 +1783,234 @@ rxvt_term::button_release (XButtonEvent &ev)
 
 #ifdef TRANSPARENT
 #if TINTING
-/* shading taken from eterm-0.9.2 */
-/* RGB 15 */
+/* taken from aterm-0.4.2 */
 
-static void
-shade_ximage_15(void *data, int bpl, int w, int h, int rm, int gm, int bm)
-{
-    unsigned char  *ptr;
-    int             x, y;
-
-    ptr = (unsigned char *)data + (w * sizeof(uint16_t));
-    if ((rm <= 256) && (gm <= 256) && (bm <= 256)) {
-    /* No saturation */
-        for (y = h; --y >= 0;) {
-            for (x = -w; x < 0; x++) {
-                int             r, g, b;
-
-                b = ((uint16_t *) ptr)[x];
-                r = (b & 0x7c00) * rm;
-                g = (b & 0x3e0) * gm;
-                b = (b & 0x1f) * bm;
-                ((uint16_t *) ptr)[x] = ((r >> 8) & 0x7c00)
-                    | ((g >> 8) & 0x3e0)
-                    | ((b >> 8) & 0x1f);
-            }
-            ptr += bpl;
-        }
-    } else {
-        for (y = h; --y >= 0;) {
-            for (x = -w; x < 0; x++) {
-                int             r, g, b;
-
-                b = ((uint16_t *) ptr)[x];
-                r = (b & 0x7c00) * rm;
-                g = (b & 0x3e0) * gm;
-                b = (b & 0x1f) * bm;
-                r |= (!(r >> 15) - 1);
-                g |= (!(g >> 10) - 1);
-                b |= (!(b >> 5) - 1);
-                ((uint16_t *) ptr)[x] = ((r >> 8) & 0x7c00)
-                    | ((g >> 8) & 0x3e0)
-                    | ((b >> 8) & 0x1f);
-            }
-            ptr += bpl;
-        }
-    }
-}
+typedef uint32_t RUINT32T;
 
-/* RGB 16 */
-static void
-shade_ximage_16(void *data, int bpl, int w, int h, int rm, int gm, int bm)
+void ShadeXImage(rxvt_display *display, XImage* srcImage, int shade, int rm, int gm, int bm)
 {
-    unsigned char  *ptr;
-    int             x, y;
-
-    ptr = (unsigned char *)data + (w * sizeof(uint16_t));
-    if ((rm <= 256) && (gm <= 256) && (bm <= 256)) {
-    /* No saturation */
-        for (y = h; --y >= 0;) {
-            for (x = -w; x < 0; x++) {
-                int             r, g, b;
-
-                b = ((uint16_t *) ptr)[x];
-                r = (b & 0xf800) * rm;
-                g = (b & 0x7e0) * gm;
-                b = (b & 0x1f) * bm;
-                ((uint16_t *) ptr)[x] = ((r >> 8) & 0xf800)
-                    | ((g >> 8) & 0x7e0)
-                    | ((b >> 8) & 0x1f);
-            }
-            ptr += bpl;
-        }
-    } else {
-        for (y = h; --y >= 0;) {
-            for (x = -w; x < 0; x++) {
-                int             r, g, b;
-
-                b = ((uint16_t *) ptr)[x];
-                r = (b & 0xf800) * rm;
-                g = (b & 0x7e0) * gm;
-                b = (b & 0x1f) * bm;
-                r |= (!(r >> 16) - 1);
-                g |= (!(g >> 11) - 1);
-                b |= (!(b >> 5) - 1);
-                ((uint16_t *) ptr)[x] = ((r >> 8) & 0xf800)
-                    | ((g >> 8) & 0x7e0)
-                    | ((b >> 8) & 0x1f);
-            }
-            ptr += bpl;
+  int sh_r, sh_g, sh_b;
+  RUINT32T mask_r, mask_g, mask_b;
+  RUINT32T *lookup, *lookup_r, *lookup_g, *lookup_b;
+  unsigned int lower_lim_r, lower_lim_g, lower_lim_b;
+  unsigned int upper_lim_r, upper_lim_g, upper_lim_b;
+  int i;
+
+  Visual* visual = display->visual;
+
+  if( visual->c_class != TrueColor || srcImage->format != ZPixmap ) return ;
+
+  /* for convenience */
+  mask_r = visual->red_mask;
+  mask_g = visual->green_mask;
+  mask_b = visual->blue_mask;
+
+  /* boring lookup table pre-initialization */
+  switch (srcImage->bits_per_pixel) {
+    case 15:
+      if ((mask_r != 0x7c00) ||
+          (mask_g != 0x03e0) ||
+          (mask_b != 0x001f))
+        return;
+        lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(32+32+32));
+        lookup_r = lookup;
+        lookup_g = lookup+32;
+        lookup_b = lookup+32+32;
+        sh_r = 10;
+        sh_g = 5;
+        sh_b = 0;
+      break;
+    case 16:
+      if ((mask_r != 0xf800) ||
+          (mask_g != 0x07e0) ||
+          (mask_b != 0x001f))
+        return;
+        lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(32+64+32));
+        lookup_r = lookup;
+        lookup_g = lookup+32;
+        lookup_b = lookup+32+64;
+        sh_r = 11;
+        sh_g = 5;
+        sh_b = 0;
+      break;
+    case 24:
+      if ((mask_r != 0xff0000) ||
+          (mask_g != 0x00ff00) ||
+          (mask_b != 0x0000ff))
+        return;
+        lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(256+256+256));
+        lookup_r = lookup;
+        lookup_g = lookup+256;
+        lookup_b = lookup+256+256;
+        sh_r = 16;
+        sh_g = 8;
+        sh_b = 0;
+      break;
+    case 32:
+      if ((mask_r != 0xff0000) ||
+          (mask_g != 0x00ff00) ||
+          (mask_b != 0x0000ff))
+        return;
+        lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(256+256+256));
+        lookup_r = lookup;
+        lookup_g = lookup+256;
+        lookup_b = lookup+256+256;
+        sh_r = 16;
+        sh_g = 8;
+        sh_b = 0;
+      break;
+    default:
+      return; /* we do not support this color depth */
+  }
+
+  /* prepare limits for color transformation (each channel is handled separately) */
+  if (shade < 0) {
+    shade = -shade;
+    if (shade < 0) shade = 0;
+    if (shade > 100) shade = 100;
+
+    lower_lim_r = 65535-rm;
+    lower_lim_g = 65535-gm;
+    lower_lim_b = 65535-bm;
+
+    lower_lim_r = 65535-(unsigned int)(((RUINT32T)lower_lim_r)*((RUINT32T)shade)/100);
+    lower_lim_g = 65535-(unsigned int)(((RUINT32T)lower_lim_g)*((RUINT32T)shade)/100);
+    lower_lim_b = 65535-(unsigned int)(((RUINT32T)lower_lim_b)*((RUINT32T)shade)/100);
+
+    upper_lim_r = upper_lim_g = upper_lim_b = 65535;
+  } else {
+    if (shade < 0) shade = 0;
+    if (shade > 100) shade = 100;
+
+    lower_lim_r = lower_lim_g = lower_lim_b = 0;
+
+    upper_lim_r = (unsigned int)((((RUINT32T)rm)*((RUINT32T)shade))/100);
+    upper_lim_g = (unsigned int)((((RUINT32T)gm)*((RUINT32T)shade))/100);
+    upper_lim_b = (unsigned int)((((RUINT32T)bm)*((RUINT32T)shade))/100);
+  }
+
+  /* switch red and blue bytes if necessary, we need it for some weird XServers like XFree86 3.3.3.1 */
+  if ((srcImage->bits_per_pixel == 24) && (mask_r >= 0xFF0000 ))
+  {
+    unsigned int tmp;
+
+    tmp = lower_lim_r;
+    lower_lim_r = lower_lim_b;
+    lower_lim_b = tmp;
+
+    tmp = upper_lim_r;
+    upper_lim_r = upper_lim_b;
+    upper_lim_b = tmp;
+  }
+
+  /* fill our lookup tables */
+  for (i = 0; i <= mask_r>>sh_r; i++)
+  {
+    RUINT32T tmp;
+    tmp = ((RUINT32T)i)*((RUINT32T)(upper_lim_r-lower_lim_r));
+    tmp += ((RUINT32T)(mask_r>>sh_r))*((RUINT32T)lower_lim_r);
+    lookup_r[i] = (tmp/65535)<<sh_r;
+  }
+  for (i = 0; i <= mask_g>>sh_g; i++)
+  {
+    RUINT32T tmp;
+    tmp = ((RUINT32T)i)*((RUINT32T)(upper_lim_g-lower_lim_g));
+    tmp += ((RUINT32T)(mask_g>>sh_g))*((RUINT32T)lower_lim_g);
+    lookup_g[i] = (tmp/65535)<<sh_g;
+  }
+  for (i = 0; i <= mask_b>>sh_b; i++)
+  {
+    RUINT32T tmp;
+    tmp = ((RUINT32T)i)*((RUINT32T)(upper_lim_b-lower_lim_b));
+    tmp += ((RUINT32T)(mask_b>>sh_b))*((RUINT32T)lower_lim_b);
+    lookup_b[i] = (tmp/65535)<<sh_b;
+  }
+
+  /* apply table to input image (replacing colors by newly calculated ones) */
+  switch (srcImage->bits_per_pixel)
+  {
+    case 15:
+    {
+      unsigned short *p1, *pf, *p, *pl;
+      p1 = (unsigned short *) srcImage->data;
+      pf = (unsigned short *) (srcImage->data + srcImage->height * srcImage->bytes_per_line);
+      while (p1 < pf)
+      {
+        p = p1;
+        pl = p1 + srcImage->width;
+        for (; p < pl; p++)
+        {
+          *p = lookup_r[(*p & 0x7c00)>>10] |
+               lookup_g[(*p & 0x03e0)>> 5] |
+               lookup_b[(*p & 0x001f)];
         }
+        p1 = (unsigned short *) ((char *) p1 + srcImage->bytes_per_line);
+      }
+      break;
     }
-}
-
-/* RGB 24 */
-static void
-shade_ximage_24(void *data, int bpl, int w, int h, int rm, int gm, int bm)
-{
-    unsigned char  *ptr;
-    int             x, y;
-
-    ptr = (unsigned char *)data + (w * 3);
-    if ((rm <= 256) && (gm <= 256) && (bm <= 256)) {
-    /* No saturation */
-        for (y = h; --y >= 0;) {
-            for (x = -(w * 3); x < 0; x += 3) {
-                int             r, g, b;
-
-                if (byteorder.big_endian()) {
-                    r = (ptr[x + 0] * rm) >> 8;
-                    g = (ptr[x + 1] * gm) >> 8;
-                    b = (ptr[x + 2] * bm) >> 8;
-                    ptr[x + 0] = r;
-                    ptr[x + 1] = g;
-                    ptr[x + 2] = b;
-                } else {
-                    r = (ptr[x + 2] * rm) >> 8;
-                    g = (ptr[x + 1] * gm) >> 8;
-                    b = (ptr[x + 0] * bm) >> 8;
-                    ptr[x + 2] = r;
-                    ptr[x + 1] = g;
-                    ptr[x + 0] = b;
-                }
-            }
-            ptr += bpl;
+    case 16:
+    {
+      unsigned short *p1, *pf, *p, *pl;
+      p1 = (unsigned short *) srcImage->data;
+      pf = (unsigned short *) (srcImage->data + srcImage->height * srcImage->bytes_per_line);
+      while (p1 < pf)
+      {
+        p = p1;
+        pl = p1 + srcImage->width;
+        for (; p < pl; p++)
+        {
+          *p = lookup_r[(*p & 0xf800)>>11] |
+               lookup_g[(*p & 0x07e0)>> 5] |
+               lookup_b[(*p & 0x001f)];
         }
-    } else {
-        for (y = h; --y >= 0;) {
-            for (x = -(w * 3); x < 0; x += 3) {
-                int             r, g, b;
-
-                if (byteorder.big_endian()) {
-                    r = (ptr[x + 0] * rm) >> 8;
-                    g = (ptr[x + 1] * gm) >> 8;
-                    b = (ptr[x + 2] * bm) >> 8;
-
-                    r |= (!(r >> 8) - 1);
-                    g |= (!(g >> 8) - 1);
-                    b |= (!(b >> 8) - 1);
-
-                    ptr[x + 0] = r;
-                    ptr[x + 1] = g;
-                    ptr[x + 2] = b;
-                } else {
-                    r = (ptr[x + 2] * rm) >> 8;
-                    g = (ptr[x + 1] * gm) >> 8;
-                    b = (ptr[x + 0] * bm) >> 8;
-
-                    r |= (!(r >> 8) - 1);
-                    g |= (!(g >> 8) - 1);
-                    b |= (!(b >> 8) - 1);
-
-                    ptr[x + 2] = r;
-                    ptr[x + 1] = g;
-                    ptr[x + 0] = b;
-                }
-            }
-            ptr += bpl;
+        p1 = (unsigned short *) ((char *) p1 + srcImage->bytes_per_line);
+      }
+      break;
+    }
+    case 24:
+    {
+      unsigned char *p1, *pf, *p, *pl;
+      p1 = (unsigned char *) srcImage->data;
+      pf = (unsigned char *) (srcImage->data + srcImage->height * srcImage->bytes_per_line);
+      while (p1 < pf)
+      {
+        p = p1;
+        pl = p1 + srcImage->width * 3;
+        for (; p < pl; p += 3)
+        {
+          p[0] = lookup_r[(p[0] & 0xff0000)>>16];
+          p[1] = lookup_r[(p[1] & 0x00ff00)>> 8];
+          p[2] = lookup_r[(p[2] & 0x0000ff)];
         }
+        p1 = (unsigned char *) ((char *) p1 + srcImage->bytes_per_line);
+      }
+      break;
     }
-}
+    case 32:
+    {
+      RUINT32T *p1, *pf, *p, *pl;
+      p1 = (RUINT32T *) srcImage->data;
+      pf = (RUINT32T *) (srcImage->data + srcImage->height * srcImage->bytes_per_line);
 
-/* RGB 32 */
-static void
-shade_ximage_32(void *data, int bpl, int w, int h, int rm, int gm, int bm)
-{
-    unsigned char  *ptr;
-    int             x, y;
-
-    ptr = (unsigned char *)data + (w * 4);
-    if ((rm <= 256) && (gm <= 256) && (bm <= 256)) {
-    /* No saturation */
-        for (y = h; --y >= 0;) {
-            if (byteorder.big_endian()) {
-                for (x = -(w * 4); x < 0; x += 4) {
-                    int             r, g, b;
-
-                    r = (ptr[x + 1] * rm) >> 8;
-                    g = (ptr[x + 2] * gm) >> 8;
-                    b = (ptr[x + 3] * bm) >> 8;
-                    ptr[x + 1] = r;
-                    ptr[x + 2] = g;
-                    ptr[x + 3] = b;
-                }
-            } else {
-                for (x = -(w * 4); x < 0; x += 4) {
-                    int             r, g, b;
-
-                    r = (ptr[x + 2] * rm) >> 8;
-                    g = (ptr[x + 1] * gm) >> 8;
-                    b = (ptr[x + 0] * bm) >> 8;
-                    ptr[x + 2] = r;
-                    ptr[x + 1] = g;
-                    ptr[x + 0] = b;
-                }
-            }
-            ptr += bpl;
-        }
-    } else {
-        for (y = h; --y >= 0;) {
-            for (x = -(w * 4); x < 0; x += 4) {
-                int             r, g, b;
-
-                if (byteorder.big_endian()) {
-                    r = (ptr[x + 1] * rm) >> 8;
-                    g = (ptr[x + 2] * gm) >> 8;
-                    b = (ptr[x + 3] * bm) >> 8;
-
-                    r |= (!(r >> 8) - 1);
-                    g |= (!(g >> 8) - 1);
-                    b |= (!(b >> 8) - 1);
-
-                    ptr[x + 1] = r;
-                    ptr[x + 2] = g;
-                    ptr[x + 3] = b;
-                } else {
-                    r = (ptr[x + 2] * rm) >> 8;
-                    g = (ptr[x + 1] * gm) >> 8;
-                    b = (ptr[x + 0] * bm) >> 8;
-
-                    r |= (!(r >> 8) - 1);
-                    g |= (!(g >> 8) - 1);
-                    b |= (!(b >> 8) - 1);
-
-                    ptr[x + 2] = r;
-                    ptr[x + 1] = g;
-                    ptr[x + 0] = b;
-                }
-            }
-            ptr += bpl;
+      while (p1 < pf)
+      {
+        p = p1;
+        pl = p1 + srcImage->width;
+        for (; p < pl; p++)
+        {
+          *p = lookup_r[(*p & 0xff0000)>>16] |
+               lookup_g[(*p & 0x00ff00)>> 8] |
+               lookup_b[(*p & 0x0000ff)] |
+               (*p & ~0xffffff);
         }
+        p1 = (RUINT32T *) ((char *) p1 + srcImage->bytes_per_line);
+      }
+      break;
     }
-}
+  }
 
+  free (lookup);
+}
 #endif
 
 /*
@@ -2059,7 +2069,11 @@ rxvt_term::check_our_parents ()
                                  0L, 1L, False, XA_PIXMAP, &atype, &aformat,
                                  &nitems, &bytes_after, &prop) == Success);
 
-  if (!i || prop == NULL || !rs[Rs_color + Color_tint])
+  if (!i || prop == NULL
+#if TINTING
+      || !rs[Rs_color + Color_tint]
+#endif
+      )
     have_pixmap = 0;
   else
     {
@@ -2080,7 +2094,7 @@ rxvt_term::check_our_parents ()
       GC gc;
       XGCValues gcvalue;
 
-      XTranslateCoordinates (display->display, TermWin.vt, display->root,
+      XTranslateCoordinates (display->display, TermWin.parent[0], display->root,
                              0, 0, &sx, &sy, &cr);
       nw = (unsigned int)szHint.width;
       nh = (unsigned int)szHint.height;
@@ -2132,21 +2146,11 @@ rxvt_term::check_our_parents ()
           if (ISSET_PIXCOLOR (Color_tint))
             {
               unsigned short rm, gm, bm;
-              if (rs[Rs_shade])
-                PixColorsFocused[Color_tint].fade (display, atoi (rs[Rs_shade])).get (display, rm, gm, bm);
-              else
-                PixColorsFocused[Color_tint].get (display, rm, gm, bm);
+              int shade = rs[Rs_shade] ? atoi (rs[Rs_shade]) : 100;
 
-              rm >>= 8; gm >>= 8; bm >>= 8; // not 100% correct, but...
+              PixColorsFocused[Color_tint].get (display, rm, gm, bm);
 
-              /* Determine bitshift and bitmask values */
-              switch (image->bits_per_pixel)
-                {
-                  case 15: shade_ximage_15 (image->data, image->bytes_per_line, image->width, image->height, rm, gm, bm); break;
-                  case 16: shade_ximage_16 (image->data, image->bytes_per_line, image->width, image->height, rm, gm, bm); break;
-                  case 24: shade_ximage_24 (image->data, image->bytes_per_line, image->width, image->height, rm, gm, bm); break;
-                  case 32: shade_ximage_32 (image->data, image->bytes_per_line, image->width, image->height, rm, gm, bm); break;
-                }
+              ShadeXImage (display, image, shade, rm, gm, bm);
             }
 #endif
 
@@ -2157,7 +2161,8 @@ rxvt_term::check_our_parents ()
                      nx, ny, image->width, image->height);
           XFreeGC (display->display, gc);
           XDestroyImage (image);
-          XSetWindowBackgroundPixmap (display->display, TermWin.vt, TermWin.pixmap);
+          XSetWindowBackgroundPixmap (display->display, TermWin.parent[0], TermWin.pixmap);
+          XClearWindow (display->display, TermWin.parent[0]);
 
           if (!am_transparent || !am_pixmap_trans)
             pchanged = 1;
@@ -2211,7 +2216,7 @@ rxvt_term::check_our_parents ()
 
       if (n > (int) (sizeof (TermWin.parent) / sizeof (TermWin.parent[0])))
         {
-          D_X ((stderr, "InheritPixmap Turning off"));             /* Mikachu? */
+          D_X ((stderr, "InheritPixmap Turning off"));
           XSetWindowBackground (display->display, TermWin.parent[0], PixColorsFocused[Color_fg]);
           XSetWindowBackground (display->display, TermWin.vt, PixColorsFocused[Color_bg]);
           am_transparent = 0;
@@ -2226,7 +2231,10 @@ rxvt_term::check_our_parents ()
 #endif
           D_X ((stderr, "InheritPixmap Turning on (%d parents)", i - 1));
           for (n = 0; n < (unsigned int)i; n++)
-            XSetWindowBackgroundPixmap (display->display, TermWin.parent[n], ParentRelative);
+            {
+              XSetWindowBackgroundPixmap (display->display, TermWin.parent[n], ParentRelative);
+              XClearWindow (display->display, TermWin.parent[n]);
+            }
 
           XSetWindowBackgroundPixmap (display->display, TermWin.vt, ParentRelative);
           am_transparent = 1;
@@ -2236,6 +2244,15 @@ 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);
+    }
+
   return pchanged;
 }
 #endif
@@ -2286,10 +2303,9 @@ rxvt_term::cmd_parse ()
                   refresh_count++;
 
                   if (! (Options & Opt_jumpScroll)
-                      || (refresh_count >= (refresh_limit * (TermWin.nrow - 1))))
+                      || (refresh_count >= refresh_limit * (TermWin.nrow - 1)))
                     {
                       refreshnow = true;
-                      flag = true;
                       ch = NOCHAR;
                       break;
                     }
@@ -2317,16 +2333,16 @@ rxvt_term::cmd_parse ()
            * What the heck I'll cheat and only refresh less than every page-full.
            * the number of pages between refreshes is refresh_limit, which
            * is incremented here because we must be doing flat-out scrolling.
-           *
-           * refreshing should be correct for small scrolls, because of the
-           * time-out
            */
           if (refreshnow)
             {
               if ((Options & Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD)
                 refresh_limit++;
               else
-                scr_refresh (refresh_type);
+                {
+                  flag = true;
+                  scr_refresh (refresh_type);
+                }
             }
 
         }
index 215a130..698e4db 100644 (file)
@@ -19,6 +19,8 @@
 # include <langinfo.h>
 #endif
 
+#include <inttypes.h>
+
 #include "rxvtlib.h"
 #include "feature.h"
 #include "encoding.h"
@@ -110,6 +112,7 @@ struct rxvt_fontset {
   bool populate (const char *desc);
   int find_font (uint32_t unicode, bool bold = false);
 
+  // font-id's MUST fit into a signed 16 bit integer.
   rxvt_font *operator [] (int id) const
   {
     return fonts[id];
index 89becaf..90c012c 100644 (file)
@@ -139,23 +139,17 @@ codeset_from_name (const char *name)
   return CS_UNKNOWN;
 }
 
-struct rxvt_codeset_conv_unknown : rxvt_codeset_conv {
-  unicode_t to_unicode (uint32_t enc) const { return NOCHAR; }
-  uint32_t from_unicode (unicode_t unicode) const { return NOCHAR; }
-} rxvt_codeset_conv_unknown;
+static unicode_t cs_unknown_to_unicode (uint32_t enc)          { return NOCHAR; }
+static uint32_t cs_unknown_from_unicode (unicode_t unicode)    { return NOCHAR; }
 
-struct rxvt_codeset_conv_us_ascii : rxvt_codeset_conv {
-  uint32_t from_unicode (unicode_t unicode) const { return unicode <= 127 ? unicode : NOCHAR; }
-} rxvt_codeset_conv_us_ascii;
+static unicode_t cs_unicode_to_unicode (uint32_t enc)          { return enc; }
+static uint32_t cs_unicode_from_unicode (unicode_t unicode)    { return unicode; }
 
-struct rxvt_codeset_conv_unicode : rxvt_codeset_conv {
-  /* transparent */
-} rxvt_codeset_conv_unicode;
+#define cs_us_ascii_to_unicode cs_unicode_to_unicode
+static uint32_t cs_us_ascii_from_unicode (unicode_t unicode)   { return unicode <= 127 ? unicode : NOCHAR; }
 
-struct rxvt_codeset_conv_unicode_16 : rxvt_codeset_conv {
-  unicode_t to_unicode (uint32_t enc) const { return enc; }
-  uint32_t from_unicode (unicode_t unicode) const { return unicode <= 65535 ? unicode : NOCHAR; }
-} rxvt_codeset_conv_unicode_16;
+#define cs_us_ascii_to_unicode_16 cs_unicode_to_unicode
+static uint32_t cs_unicode_16_from_unicode (unicode_t unicode) { return unicode <= 65535 ? unicode : NOCHAR; }
 
 #define ENCODING_DEFAULT
 
@@ -218,58 +212,65 @@ struct rxvt_codeset_conv_unicode_16 : rxvt_codeset_conv {
 #include "table/jis0213_1.h"
 #include "table/jis0213_2.h"
 
+#if ENCODING_TO_UNICODE
+# define ENC(base) { cs_ ## base ## _from_unicode, cs_ ## base ## _to_unicode }
+#else
+# define ENC(base) { cs_ ## base ## _from_unicode }
+#endif
+  
+
 // order must match table in encoding.h(!)
-const rxvt_codeset_conv *rxvt_codeset[NUM_CODESETS] = {
-  &rxvt_codeset_conv_unknown,
-
-  &rxvt_codeset_conv_us_ascii,
-
-  &rxvt_codeset_conv_iso8859_1,
-  &rxvt_codeset_conv_iso8859_2,
-  &rxvt_codeset_conv_iso8859_3,
-  &rxvt_codeset_conv_iso8859_4,
-  &rxvt_codeset_conv_iso8859_5,
-  &rxvt_codeset_conv_iso8859_6,
-  &rxvt_codeset_conv_iso8859_7,
-  &rxvt_codeset_conv_iso8859_8,
-  &rxvt_codeset_conv_iso8859_9,
-  &rxvt_codeset_conv_iso8859_10,
-  &rxvt_codeset_conv_iso8859_11,
-  &rxvt_codeset_conv_iso8859_13,
-  &rxvt_codeset_conv_iso8859_14,
-  &rxvt_codeset_conv_iso8859_15,
-  &rxvt_codeset_conv_iso8859_16,
-
-  &rxvt_codeset_conv_koi8_r,
-  &rxvt_codeset_conv_koi8_u,
-
-  &rxvt_codeset_conv_jis0201_1976_0,
-  &rxvt_codeset_conv_jis0208_1990_0,
-  &rxvt_codeset_conv_jis0212_1990_0,
-
-  &rxvt_codeset_conv_jis0213_1,
-  &rxvt_codeset_conv_jis0213_2,
-
-  &rxvt_codeset_conv_ksc5601_1987_0,
-
-  &rxvt_codeset_conv_gb2312_1980_0,
-
-  &rxvt_codeset_conv_cns11643_1992_1,
-  &rxvt_codeset_conv_cns11643_1992_2,
-  &rxvt_codeset_conv_cns11643_1992_3,
-  &rxvt_codeset_conv_cns11643_1992_4,
-  &rxvt_codeset_conv_cns11643_1992_5,
-  &rxvt_codeset_conv_cns11643_1992_6,
-  &rxvt_codeset_conv_cns11643_1992_7,
-  &rxvt_codeset_conv_cns11643_1992_f,
-  &rxvt_codeset_conv_big5,
-  &rxvt_codeset_conv_big5_ext,
-  &rxvt_codeset_conv_big5_plus,
-
-  &rxvt_codeset_conv_viscii,
-
-  &rxvt_codeset_conv_unicode_16,
-  &rxvt_codeset_conv_unicode
+const rxvt_codeset_conv rxvt_codeset[NUM_CODESETS] = {
+  ENC (unknown),
+
+  ENC (us_ascii),
+
+  ENC (iso8859_1),
+  ENC (iso8859_2),
+  ENC (iso8859_3),
+  ENC (iso8859_4),
+  ENC (iso8859_5),
+  ENC (iso8859_6),
+  ENC (iso8859_7),
+  ENC (iso8859_8),
+  ENC (iso8859_9),
+  ENC (iso8859_10),
+  ENC (iso8859_11),
+  ENC (iso8859_13),
+  ENC (iso8859_14),
+  ENC (iso8859_15),
+  ENC (iso8859_16),
+
+  ENC (koi8_r),
+  ENC (koi8_u),
+
+  ENC (jis0201_1976_0),
+  ENC (jis0208_1990_0),
+  ENC (jis0212_1990_0),
+
+  ENC (jis0213_1),
+  ENC (jis0213_2),
+
+  ENC (ksc5601_1987_0),
+
+  ENC (gb2312_1980_0),
+
+  ENC (cns11643_1992_1),
+  ENC (cns11643_1992_2),
+  ENC (cns11643_1992_3),
+  ENC (cns11643_1992_4),
+  ENC (cns11643_1992_5),
+  ENC (cns11643_1992_6),
+  ENC (cns11643_1992_7),
+  ENC (cns11643_1992_f),
+  ENC (big5),
+  ENC (big5_ext),
+  ENC (big5_plus),
+
+  ENC (viscii),
+
+  ENC (unicode_16),
+  ENC (unicode),
 };
 
 #if ENABLE_COMBINING
index aa1f5da..2ea5ee9 100644 (file)
@@ -68,18 +68,18 @@ enum {
 };
 
 struct rxvt_codeset_conv {
-  virtual uint32_t from_unicode (unicode_t unicode) const { return unicode; }
+  uint32_t (*from_unicode) (unicode_t unicode);
 #if ENCODING_TO_UNICODE
-  virtual unicode_t to_unicode (uint32_t enc) const { return enc; }
+  unicode_t (*to_unicode) (uint32_t enc);
 #endif
 };
 
-extern const rxvt_codeset_conv *rxvt_codeset[NUM_CODESETS];
+extern const rxvt_codeset_conv rxvt_codeset[NUM_CODESETS];
 
 extern unicode_t rxvt_compose (unicode_t c1, unicode_t c2);
 
-#define FROM_UNICODE(cs,code) rxvt_codeset[cs]->from_unicode (code)
-#define TO_UNICODE(cs,code)   rxvt_codeset[cs]->to_unicode   (code)
+#define FROM_UNICODE(cs,code) rxvt_codeset[cs].from_unicode (code)
+#define TO_UNICODE(cs,code)   rxvt_codeset[cs].to_unicode   (code)
 
 struct unicode { // namespace für arme
   static bool is_space (unicode_t c);
index 3925542..29729a7 100755 (executable)
@@ -236,26 +236,25 @@ while (<DATA>) {
 #ifdef ENCODING_$group
 
 $tab1$tab2
-struct rxvt_codeset_conv_$base : rxvt_codeset_conv {
-  uint32_t from_unicode (unicode_t unicode) const {
-$fun1  }
+static uint32_t cs_$base\_from_unicode (unicode_t unicode) {
+$fun1}
 EOF
 
 if ($TO_UNICODE) {
    print OUT <<EOF
 #if ENCODING_TO_UNICODE
-  unicode_t to_unicode (uint32_t enc) const {
-$fun2  }
+static unicode_t cs_$base\_to_unicode (uint32_t enc) {
+$fun2}
 #endif
 EOF
 }
 
 print OUT <<EOF;
-} rxvt_codeset_conv_$base;
 
 #else
 
-#define rxvt_codeset_conv_$base rxvt_codeset_conv_unknown
+#define cs_$base\_from_unicode cs_unknown_from_unicode
+#define cs_$base\_to_unicode   cs_unknown_to_unicode
 
 #endif
 EOF
index b5df58d..4d5991f 100644 (file)
@@ -173,6 +173,7 @@ rxvt_term::rxvt_term ()
     im_ev (this, &rxvt_term::im_cb),
 #endif
     check_ev (this, &rxvt_term::check_cb),
+    flush_ev (this, &rxvt_term::flush_cb),
     destroy_ev (this, &rxvt_term::destroy_cb),
     pty_ev (this, &rxvt_term::pty_cb),
     incr_ev (this, &rxvt_term::incr_cb)
@@ -888,6 +889,9 @@ rxvt_term::change_font (const char *fontname)
               scr_touch (true);
             }   
 
+          for (unicode_t ch = 0x20; ch <= 0x7f; ch++)
+            TermWin.ascii_map [ch - 0x20] = fs->find_font (ch);
+
           return true;
         }
     }
@@ -977,7 +981,7 @@ rxvt_term::set_window_color (int idx, const char *color)
   if (!rXParseAllocColor (& xcol, color))
     return;
 
-  /* XStoreColor (display->display, XCMAP, XColor*); */
+  /* XStoreColor (display->display, display->cmap, XColor*); */
 
   /*
    * FIXME: should free colors here, but no idea how to do it so instead,
@@ -990,7 +994,7 @@ rxvt_term::set_window_color (int idx, const char *color)
   if (i > Color_White)
     {
       /* fprintf (stderr, "XFreeColors: PixColors [%d] = %lu\n", idx, PixColors [idx]); */
-      XFreeColors (display->display, XCMAP, (PixColors + idx), 1,
+      XFreeColors (display->display, display->cmap, (PixColors + idx), 1,
                   DisplayPlanes (display->display, display->screen));
     }
 # endif
@@ -1025,7 +1029,7 @@ rxvt_term::recolour_cursor ()
 
   xcol[0].pixel = ISSET_PIXCOLOR (Color_pointer_fg) ? PixColorsFocused[Color_pointer_fg] : PixColorsFocused[Color_fg];
   xcol[1].pixel = ISSET_PIXCOLOR (Color_pointer_bg) ? PixColorsFocused[Color_pointer_bg] : PixColorsFocused[Color_bg];
-  XQueryColors (display->display, XCMAP, xcol, 2);
+  XQueryColors (display->display, display->cmap, xcol, 2);
   XRecolorCursor (display->display, TermWin_cursor, xcol + 0, xcol + 1);
 }
 
index 211b602..655c669 100644 (file)
@@ -11,6 +11,9 @@
 #include <X11/keysym.h>
 #include <X11/keysymdef.h>
 #include <X11/Xatom.h>
+#ifndef NO_FRILLS
+#include <X11/Xmd.h>
+#endif
 
 #include "encoding.h"
 #include "defaultfont.h"
@@ -133,6 +136,16 @@ struct mouse_event {
               ? 0                                       \
               : min ((val), (((uint16_t)-1)>>1)))
 
+#ifndef NO_FRILLS
+typedef struct _mwmhints {
+  CARD32 flags;
+  CARD32 functions;
+  CARD32 decorations;
+  INT32  input_mode;
+  CARD32 status;
+} MWMHints;
+#endif
+
 /*
  *****************************************************************************
  * NORMAL DEFINES
@@ -535,6 +548,7 @@ enum {
 #ifndef NO_FRILLS
   Rs_ext_bwidth,
   Rs_int_bwidth,
+  Rs_borderLess,
 #endif
   Rs_scrollBar_thickness,
 #ifndef NO_LINESPACE
@@ -625,10 +639,7 @@ enum {
 # define PrivMode_Default (PrivMode_Autowrap|PrivMode_aplKP|PrivMode_ShiftKeys|PrivMode_VisibleCursor)
 #endif
 
-#define XDEPTH                 display->depth
-#define XCMAP                  display->cmap
-#define XVISUAL                display->visual
-
+// do not change these constants lightly, there are many interdependencies
 #define IMBUFSIZ               128     // input modifier buffer sizes
 #define KBUFSZ                 512     // size of keyboard mapping buffer
 #define CBUFSIZ                4096    // size of command buffer
@@ -638,6 +649,33 @@ enum {
 # define PATH_MAX 16384
 #endif
 
+/* Motif window hints */
+#define MWM_HINTS_FUNCTIONS     (1L << 0)
+#define MWM_HINTS_DECORATIONS   (1L << 1)
+#define MWM_HINTS_INPUT_MODE    (1L << 2)
+#define MWM_HINTS_STATUS        (1L << 3)
+/* bit definitions for MwmHints.functions */
+#define MWM_FUNC_ALL            (1L << 0)
+#define MWM_FUNC_RESIZE         (1L << 1)
+#define MWM_FUNC_MOVE           (1L << 2)
+#define MWM_FUNC_MINIMIZE       (1L << 3)
+#define MWM_FUNC_MAXIMIZE       (1L << 4)
+#define MWM_FUNC_CLOSE          (1L << 5)
+/* bit definitions for MwmHints.decorations */
+#define MWM_DECOR_ALL           (1L << 0)
+#define MWM_DECOR_BORDER        (1L << 1)
+#define MWM_DECOR_RESIZEH       (1L << 2)
+#define MWM_DECOR_TITLE         (1L << 3)
+#define MWM_DECOR_MENU          (1L << 4)
+#define MWM_DECOR_MINIMIZE      (1L << 5)
+#define MWM_DECOR_MAXIMIZE      (1L << 6)
+/* bit definitions for MwmHints.inputMode */
+#define MWM_INPUT_MODELESS                  0
+#define MWM_INPUT_PRIMARY_APPLICATION_MODAL 1
+#define MWM_INPUT_SYSTEM_MODAL              2
+#define MWM_INPUT_FULL_APPLICATION_MODAL    3
+#define PROP_MWM_HINTS_ELEMENTS             5
+
 /*
  *****************************************************************************
  * MACRO DEFINES
@@ -964,7 +1002,6 @@ struct rxvt_term : rxvt_vars {
 #endif
                   refresh_count,
                   refresh_limit,
-                  fnum,       /* logical font number                       */
                   last_bot,   /* scrollbar last bottom position            */
                   last_top,   /* scrollbar last top position               */
                   last_state, /* scrollbar last state                      */
@@ -1134,8 +1171,9 @@ struct rxvt_term : rxvt_vars {
   xevent_watcher menubar_ev;
 #endif
 
-  void check_cb   (check_watcher &w); check_watcher check_ev;
+  void check_cb (check_watcher &w); check_watcher check_ev;
   void destroy_cb (time_watcher &w); time_watcher destroy_ev;
+  void flush_cb (time_watcher &w); time_watcher flush_ev;
 
   void pty_cb (io_watcher &w, short revents); io_watcher pty_ev;
 
index e6066b5..1f8eb76 100644 (file)
 #include <unistd.h>
 #include <fcntl.h>
 
+#ifndef NO_SLOW_LINK_SUPPORT
+# include <sys/socket.h>
+# include <sys/un.h>
+#endif
+
 class byteorder byteorder;
 
 byteorder::byteorder ()
@@ -167,6 +172,20 @@ bool rxvt_display::init ()
   cmap   = DefaultColormap (display, screen);
   depth  = DefaultDepth (display, screen);
 
+  int fd = XConnectionNumber (display);
+
+#ifndef NO_SLOW_LINK_SUPPORT
+  // try to detetc wether we have a local connection.
+  // assume unix domains socket == local, everything else not
+  // TODO: might want to check for inet/127.0.0.1
+  is_local = 0;
+  sockaddr_un sa;
+  socklen_t sl = sizeof (sa);
+
+  if (!getsockname (fd, (sockaddr *)&sa, &sl))
+    is_local = sa.sun_family == AF_LOCAL;
+#endif
+
 #ifdef PREFER_24BIT
   /*
    * If depth is not 24, look for a 24bit visual.
@@ -186,7 +205,6 @@ bool rxvt_display::init ()
     }
 #endif
 
-  int fd = XConnectionNumber (display);
   x_ev.start (fd, EVENT_READ);
   fcntl (fd, F_SETFD, FD_CLOEXEC);
 
index 9edac7d..403a543 100644 (file)
@@ -84,6 +84,9 @@ struct rxvt_display : refcounted {
   Colormap cmap;
   Window   root;
   rxvt_term *selection_owner;
+#ifndef NO_SLOW_LINK_SUPPORT
+  bool     is_local;
+#endif
 
   rxvt_display (const char *id);
   bool init ();
index 1fd0a36..14e396a 100644 (file)
@@ -106,6 +106,7 @@ typedef struct {
   Pixmap         pixmap;
   rxvt_fontset  *fontset;
   rxvt_drawable *drawable;
+  uint16_t       ascii_map[0x7f - 0x20]; // map ascii chars to fonts for speed
 } TermWin_t;
 
 /*
@@ -204,13 +205,15 @@ typedef struct {
 #define Opt_mouseWheelScrollPage (1UL<<19)
 #define Opt_pointerBlank        (1UL<<20)
 #define Opt_cursorBlink         (1UL<<21)
+#define Opt_secondaryScreen    (1UL<<22)
+#define Opt_secondaryScroll    (1UL<<23)
 #ifdef NO_FRILLS
-# define Opt_insecure            0
+# define Opt_insecure          0
+# define Opt_borderLess                0
 #else
-# define Opt_insecure            (1UL<<22) // insecure esc sequences
+# define Opt_insecure          (1UL<<24) // insecure esc sequences
+# define Opt_borderLess                (1UL<<25) // mem borderless hints
 #endif
-#define Opt_secondaryScreen    (1UL<<23)
-#define Opt_secondaryScroll    (1UL<<24)
 /* place holder used for parsing command-line options */
 #define Opt_Reverse             (1UL<<30)
 #define Opt_Boolean             (1UL<<31)
index 87f8055..fc07a76 100644 (file)
@@ -120,7 +120,7 @@ void
 rxvt_term::scr_blank_line (text_t *et, rend_t *er, unsigned int width, rend_t efs)
 {
   efs &= ~RS_baseattrMask;
-  efs = SET_FONT (efs, TermWin.fontset->find_font (' '));
+  efs = SET_FONT (efs, TermWin.ascii_map [' ' - 0x20]);
 
   while (width--)
     {
@@ -796,7 +796,7 @@ rxvt_term::scr_add_lines (const unicode_t *str, int nlines, int len)
 #ifdef DEBUG_STRICT
   assert (screen.cur.col < last_col);
   assert ((screen.cur.row < TermWin.nrow)
-         && (screen.cur.row >= - (int32_t)TermWin.nscrolled));
+          && (screen.cur.row >= - (int32_t)TermWin.nscrolled));
 #else                           /* drive with your eyes closed */
   MIN_IT (screen.cur.col, last_col - 1);
   MIN_IT (screen.cur.row, (int32_t)TermWin.nrow - 1);
@@ -900,7 +900,10 @@ rxvt_term::scr_add_lines (const unicode_t *str, int nlines, int len)
             c = rxvt_composite.compose (c); // map to lower 16 bits
 #endif
           bool bold = (Options & Opt_realBold) && ((rstyle & RS_Bold) != 0);
-          rend_t rend = SET_FONT (rstyle, TermWin.fontset->find_font (c, bold));
+          rend_t rend = SET_FONT (rstyle,
+                                  c > 0x7f || bold || c < 0x20
+                                     ? TermWin.fontset->find_font (c, bold)
+                                     : TermWin.ascii_map [c - 0x20]);
 
           do
             {
@@ -1749,6 +1752,14 @@ rxvt_term::scr_expose (int x, int y, int width, int height, bool refresh)
   if (drawn_text == NULL)  /* sanity check */
     return;
 
+#ifndef NO_SLOW_LINK_SUPPORT
+  if (refresh_type == FAST_REFRESH && !display->is_local)
+    {
+      y = 0;
+      height = TermWin.height;
+    }
+#endif
+
 #ifdef DEBUG_STRICT
   x = max (x, 0);
   x = min (x, (int)TermWin.width);
@@ -2057,7 +2068,8 @@ rxvt_term::scr_refresh (unsigned char refresh_type)
    *    This has been deliberately kept simple.
    */
   i = num_scr;
-  if (refresh_type == FAST_REFRESH && num_scr_allow && i
+  if (!display->is_local
+      && refresh_type == FAST_REFRESH && num_scr_allow && i
       && abs (i) < TermWin.nrow && !must_clear)
     {
       int16_t nits;
@@ -2237,7 +2249,7 @@ rxvt_term::scr_refresh (unsigned char refresh_type)
             }
 
 #ifdef TEXT_BLINK
-          if (rend & RS_Blink && back == Color_bg)
+          if (rend & RS_Blink && (back == Color_bg || fore == Color_bg))
             {
               if (!text_blink_ev.active)
                 {
@@ -2277,7 +2289,7 @@ rxvt_term::scr_refresh (unsigned char refresh_type)
           else
             font->draw (*TermWin.drawable, xpixel, ypixel, text, count, fore, back);
 
-          if ((rend & RS_Uline) && (font->descent > 1))
+          if (rend & RS_Uline && font->descent > 1 && fore != back)
             XDrawLine (display->display, drawBuffer, TermWin.gc,
                        xpixel, ypixel + font->ascent + 1,
                        xpixel + Width2Pixel (count) - 1, ypixel + font->ascent + 1);
@@ -2347,7 +2359,7 @@ rxvt_term::scr_refresh (unsigned char refresh_type)
 #endif
 
   if (refresh_type & SMOOTH_REFRESH)
-    XSync (display->display, False);
+    XFlush (display->display);
 
   num_scr = 0;
   num_scr_allow = 1;
index 0741b21..bfb95e9 100644 (file)
@@ -2401,8 +2401,7 @@ const uint16_t *big5_f_i[] = {
 };
 
 
-struct rxvt_codeset_conv_big5 : rxvt_codeset_conv {
-  uint32_t from_unicode (unicode_t unicode) const {
+static uint32_t cs_big5_from_unicode (unicode_t unicode) {
     if (unicode <= 0x007f) return unicode;
     if (unicode == 0x014b) return 0xc8fc;
     if (unicode == 0x0153) return 0xc8fa;
@@ -2427,11 +2426,11 @@ struct rxvt_codeset_conv_big5 : rxvt_codeset_conv {
              ? big5_f_i[h - 0x00][l - 0x00]
              : NOCHAR;
     return NOCHAR;
-  }
-} rxvt_codeset_conv_big5;
+}
 
 #else
 
-#define rxvt_codeset_conv_big5 rxvt_codeset_conv_unknown
+#define cs_big5_from_unicode cs_unknown_from_unicode
+#define cs_big5_to_unicode   cs_unknown_to_unicode
 
 #endif
index a68028e..42b266d 100644 (file)
@@ -2284,8 +2284,7 @@ const uint16_t *big5_ext_f_i[] = {
 };
 
 
-struct rxvt_codeset_conv_big5_ext : rxvt_codeset_conv {
-  uint32_t from_unicode (unicode_t unicode) const {
+static uint32_t cs_big5_ext_from_unicode (unicode_t unicode) {
     if (unicode <= 0x007f) return unicode;
     if (unicode == 0x2605) return 0xa1b9;
     if (unicode == 0x2606) return 0xa1b8;
@@ -2303,11 +2302,11 @@ struct rxvt_codeset_conv_big5_ext : rxvt_codeset_conv {
              ? big5_ext_f_i[h - 0x00][l - 0x00]
              : NOCHAR;
     return NOCHAR;
-  }
-} rxvt_codeset_conv_big5_ext;
+}
 
 #else
 
-#define rxvt_codeset_conv_big5_ext rxvt_codeset_conv_unknown
+#define cs_big5_ext_from_unicode cs_unknown_from_unicode
+#define cs_big5_ext_to_unicode   cs_unknown_to_unicode
 
 #endif
index 08b31f7..525d748 100644 (file)
@@ -2308,8 +2308,7 @@ const uint16_t *big5_plus_f_i[] = {
 };
 
 
-struct rxvt_codeset_conv_big5_plus : rxvt_codeset_conv {
-  uint32_t from_unicode (unicode_t unicode) const {
+static uint32_t cs_big5_plus_from_unicode (unicode_t unicode) {
     if (unicode <= 0x007f) return unicode;
     if (unicode == 0x2605) return 0xa1b9;
     if (unicode == 0x2606) return 0xa1b8;
@@ -2328,11 +2327,11 @@ struct rxvt_codeset_conv_big5_plus : rxvt_codeset_conv {
              ? big5_plus_f_i[h - 0x00][l - 0x00]
              : NOCHAR;
     return NOCHAR;
-  }
-} rxvt_codeset_conv_big5_plus;
+}
 
 #else
 
-#define rxvt_codeset_conv_big5_plus rxvt_codeset_conv_unknown
+#define cs_big5_plus_from_unicode cs_unknown_from_unicode
+#define cs_big5_plus_to_unicode   cs_unknown_to_unicode
 
 #endif
index 2c54235..21d2ed6 100644 (file)
@@ -1995,8 +1995,7 @@ const uint16_t *cns11643_1992_1_f_i[] = {
 };
 
 
-struct rxvt_codeset_conv_cns11643_1992_1 : rxvt_codeset_conv {
-  uint32_t from_unicode (unicode_t unicode) const {
+static uint32_t cs_cns11643_1992_1_from_unicode (unicode_t unicode) {
     uint8_t  l = unicode;
     uint16_t h = unicode >> 8;
     if (0x4e <= h && h <= 0x9f
@@ -2006,11 +2005,11 @@ struct rxvt_codeset_conv_cns11643_1992_1 : rxvt_codeset_conv {
              ? cns11643_1992_1_f_i[h - 0x4e][l - 0x00]
              : NOCHAR;
     return NOCHAR;
-  }
-} rxvt_codeset_conv_cns11643_1992_1;
+}
 
 #else
 
-#define rxvt_codeset_conv_cns11643_1992_1 rxvt_codeset_conv_unknown
+#define cs_cns11643_1992_1_from_unicode cs_unknown_from_unicode
+#define cs_cns11643_1992_1_to_unicode   cs_unknown_to_unicode
 
 #endif
index d87fcec..aeb2b9b 100644 (file)
@@ -1995,8 +1995,7 @@ const uint16_t *cns11643_1992_2_f_i[] = {
 };
 
 
-struct rxvt_codeset_conv_cns11643_1992_2 : rxvt_codeset_conv {
-  uint32_t from_unicode (unicode_t unicode) const {
+static uint32_t cs_cns11643_1992_2_from_unicode (unicode_t unicode) {
     uint8_t  l = unicode;
     uint16_t h = unicode >> 8;
     if (0x4e <= h && h <= 0x9f
@@ -2006,11 +2005,11 @@ struct rxvt_codeset_conv_cns11643_1992_2 : rxvt_codeset_conv {
              ? cns11643_1992_2_f_i[h - 0x4e][l - 0x00]
              : NOCHAR;
     return NOCHAR;
-  }
-} rxvt_codeset_conv_cns11643_1992_2;
+}
 
 #else
 
-#define rxvt_codeset_conv_cns11643_1992_2 rxvt_codeset_conv_unknown
+#define cs_cns11643_1992_2_from_unicode cs_unknown_from_unicode
+#define cs_cns11643_1992_2_to_unicode   cs_unknown_to_unicode
 
 #endif
index 8ad202d..f8672e1 100644 (file)
@@ -2624,8 +2624,7 @@ const uint16_t *cns11643_1992_3_f_i[] = {
 };
 
 
-struct rxvt_codeset_conv_cns11643_1992_3 : rxvt_codeset_conv {
-  uint32_t from_unicode (unicode_t unicode) const {
+static uint32_t cs_cns11643_1992_3_from_unicode (unicode_t unicode) {
     uint8_t  l = unicode;
     uint16_t h = unicode >> 8;
     if (0x34 <= h && h <= 0x9f
@@ -2635,11 +2634,11 @@ struct rxvt_codeset_conv_cns11643_1992_3 : rxvt_codeset_conv {
              ? cns11643_1992_3_f_i[h - 0x34][l - 0x00]
              : NOCHAR;
     return NOCHAR;
-  }
-} rxvt_codeset_conv_cns11643_1992_3;
+}
 
 #else
 
-#define rxvt_codeset_conv_cns11643_1992_3 rxvt_codeset_conv_unknown
+#define cs_cns11643_1992_3_from_unicode cs_unknown_from_unicode
+#define cs_cns11643_1992_3_to_unicode   cs_unknown_to_unicode
 
 #endif
index 6045a60..7365598 100644 (file)
@@ -2382,8 +2382,7 @@ const uint16_t *cns11643_1992_4_f_i[] = {
 };
 
 
-struct rxvt_codeset_conv_cns11643_1992_4 : rxvt_codeset_conv {
-  uint32_t from_unicode (unicode_t unicode) const {
+static uint32_t cs_cns11643_1992_4_from_unicode (unicode_t unicode) {
     if (unicode == 0x5a0e) return 0x2c40;
     if (unicode == 0x5a10) return 0x2c3e;
     if (unicode == 0x5a27) return 0x2c39;
@@ -2429,11 +2428,11 @@ struct rxvt_codeset_conv_cns11643_1992_4 : rxvt_codeset_conv {
              ? cns11643_1992_4_f_i[h - 0x34][l - 0x00]
              : NOCHAR;
     return NOCHAR;
-  }
-} rxvt_codeset_conv_cns11643_1992_4;
+}
 
 #else
 
-#define rxvt_codeset_conv_cns11643_1992_4 rxvt_codeset_conv_unknown
+#define cs_cns11643_1992_4_from_unicode cs_unknown_from_unicode
+#define cs_cns11643_1992_4_to_unicode   cs_unknown_to_unicode
 
 #endif
index 499b32b..06b67de 100644 (file)
@@ -661,8 +661,7 @@ const uint16_t *cns11643_1992_5_f_i[] = {
 };
 
 
-struct rxvt_codeset_conv_cns11643_1992_5 : rxvt_codeset_conv {
-  uint32_t from_unicode (unicode_t unicode) const {
+static uint32_t cs_cns11643_1992_5_from_unicode (unicode_t unicode) {
     if (unicode == 0x5921) return 0x373d;
     if (unicode == 0x5e07) return 0x225c;
     if (unicode == 0x5e3f) return 0x377c;
@@ -726,11 +725,11 @@ struct rxvt_codeset_conv_cns11643_1992_5 : rxvt_codeset_conv {
              ? cns11643_1992_5_f_i[h - 0x34][l - 0x00]
              : NOCHAR;
     return NOCHAR;
-  }
-} rxvt_codeset_conv_cns11643_1992_5;
+}
 
 #else
 
-#define rxvt_codeset_conv_cns11643_1992_5 rxvt_codeset_conv_unknown
+#define cs_cns11643_1992_5_from_unicode cs_unknown_from_unicode
+#define cs_cns11643_1992_5_to_unicode   cs_unknown_to_unicode
 
 #endif
index 218dac9..9194ccb 100644 (file)
@@ -323,8 +323,7 @@ const uint16_t *cns11643_1992_6_f_i[] = {
 };
 
 
-struct rxvt_codeset_conv_cns11643_1992_6 : rxvt_codeset_conv {
-  uint32_t from_unicode (unicode_t unicode) const {
+static uint32_t cs_cns11643_1992_6_from_unicode (unicode_t unicode) {
     if (unicode == 0x3637) return 0x2f65;
     if (unicode == 0x3652) return 0x474e;
     if (unicode == 0x369d) return 0x3e42;
@@ -405,11 +404,11 @@ struct rxvt_codeset_conv_cns11643_1992_6 : rxvt_codeset_conv {
              ? cns11643_1992_6_f_i[h - 0x34][l - 0x00]
              : NOCHAR;
     return NOCHAR;
-  }
-} rxvt_codeset_conv_cns11643_1992_6;
+}
 
 #else
 
-#define rxvt_codeset_conv_cns11643_1992_6 rxvt_codeset_conv_unknown
+#define cs_cns11643_1992_6_from_unicode cs_unknown_from_unicode
+#define cs_cns11643_1992_6_to_unicode   cs_unknown_to_unicode
 
 #endif
index 21a6de2..7847c63 100644 (file)
@@ -193,8 +193,7 @@ const uint16_t *cns11643_1992_7_f_i[] = {
 };
 
 
-struct rxvt_codeset_conv_cns11643_1992_7 : rxvt_codeset_conv {
-  uint32_t from_unicode (unicode_t unicode) const {
+static uint32_t cs_cns11643_1992_7_from_unicode (unicode_t unicode) {
     if (unicode == 0x34a7) return 0x5274;
     if (unicode == 0x34a8) return 0x574c;
     if (unicode == 0x34b9) return 0x4d3d;
@@ -275,11 +274,11 @@ struct rxvt_codeset_conv_cns11643_1992_7 : rxvt_codeset_conv {
              ? cns11643_1992_7_f_i[h - 0x45][l - 0x04]
              : NOCHAR;
     return NOCHAR;
-  }
-} rxvt_codeset_conv_cns11643_1992_7;
+}
 
 #else
 
-#define rxvt_codeset_conv_cns11643_1992_7 rxvt_codeset_conv_unknown
+#define cs_cns11643_1992_7_from_unicode cs_unknown_from_unicode
+#define cs_cns11643_1992_7_to_unicode   cs_unknown_to_unicode
 
 #endif
index 8f77108..38a5348 100644 (file)
@@ -210,8 +210,7 @@ const uint16_t *cns11643_1992_f_f_i[] = {
 };
 
 
-struct rxvt_codeset_conv_cns11643_1992_f : rxvt_codeset_conv {
-  uint32_t from_unicode (unicode_t unicode) const {
+static uint32_t cs_cns11643_1992_f_from_unicode (unicode_t unicode) {
     if (unicode == 0x3406) return 0x216c;
     if (unicode == 0x3436) return 0x2144;
     if (unicode == 0x343e) return 0x2172;
@@ -402,11 +401,11 @@ struct rxvt_codeset_conv_cns11643_1992_f : rxvt_codeset_conv {
              ? cns11643_1992_f_f_i[h - 0x36][l - 0x0e]
              : NOCHAR;
     return NOCHAR;
-  }
-} rxvt_codeset_conv_cns11643_1992_f;
+}
 
 #else
 
-#define rxvt_codeset_conv_cns11643_1992_f rxvt_codeset_conv_unknown
+#define cs_cns11643_1992_f_from_unicode cs_unknown_from_unicode
+#define cs_cns11643_1992_f_to_unicode   cs_unknown_to_unicode
 
 #endif
index 0444574..fdb4b78 100644 (file)
@@ -2191,8 +2191,7 @@ const uint16_t *gb2312_1980_0_f_i[] = {
 };
 
 
-struct rxvt_codeset_conv_gb2312_1980_0 : rxvt_codeset_conv {
-  uint32_t from_unicode (unicode_t unicode) const {
+static uint32_t cs_gb2312_1980_0_from_unicode (unicode_t unicode) {
     if (unicode == 0x02c7) return 0x2126;
     if (unicode == 0x02c9) return 0x2125;
     if (unicode == 0x2312) return 0x2150;
@@ -2220,11 +2219,11 @@ struct rxvt_codeset_conv_gb2312_1980_0 : rxvt_codeset_conv {
              ? gb2312_1980_0_f_i[h - 0x00][l - 0x00]
              : NOCHAR;
     return NOCHAR;
-  }
-} rxvt_codeset_conv_gb2312_1980_0;
+}
 
 #else
 
-#define rxvt_codeset_conv_gb2312_1980_0 rxvt_codeset_conv_unknown
+#define cs_gb2312_1980_0_from_unicode cs_unknown_from_unicode
+#define cs_gb2312_1980_0_to_unicode   cs_unknown_to_unicode
 
 #endif
index 0f7372e..e454506 100644 (file)
@@ -4,15 +4,14 @@
 #ifdef ENCODING_DEFAULT
 
 
-struct rxvt_codeset_conv_iso8859_1 : rxvt_codeset_conv {
-  uint32_t from_unicode (unicode_t unicode) const {
+static uint32_t cs_iso8859_1_from_unicode (unicode_t unicode) {
     if (unicode <= 0x00ff) return unicode;
     return NOCHAR;
-  }
-} rxvt_codeset_conv_iso8859_1;
+}
 
 #else
 
-#define rxvt_codeset_conv_iso8859_1 rxvt_codeset_conv_unknown
+#define cs_iso8859_1_from_unicode cs_unknown_from_unicode
+#define cs_iso8859_1_to_unicode   cs_unknown_to_unicode
 
 #endif
index 92873e4..e52779c 100644 (file)
@@ -22,8 +22,7 @@ static const uint8_t iso8859_10_f_256[] = {
   0x00, 0x00, 0xd9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xac, 0xbc
 };
 
-struct rxvt_codeset_conv_iso8859_10 : rxvt_codeset_conv {
-  uint32_t from_unicode (unicode_t unicode) const {
+static uint32_t cs_iso8859_10_from_unicode (unicode_t unicode) {
     if (unicode <= 0x009f) return unicode;
     if (unicode == 0x2015) return 0x00bd;
     if (0x00a0 <= unicode && unicode <= 0x00fe)
@@ -31,11 +30,11 @@ struct rxvt_codeset_conv_iso8859_10 : rxvt_codeset_conv {
     if (0x0100 <= unicode && unicode <= 0x017e)
       return iso8859_10_f_256[unicode - 0x0100] == 0 ? NOCHAR : iso8859_10_f_256[unicode - 0x0100];
     return NOCHAR;
-  }
-} rxvt_codeset_conv_iso8859_10;
+}
 
 #else
 
-#define rxvt_codeset_conv_iso8859_10 rxvt_codeset_conv_unknown
+#define cs_iso8859_10_from_unicode cs_unknown_from_unicode
+#define cs_iso8859_10_to_unicode   cs_unknown_to_unicode
 
 #endif
index 4f32f25..185d43c 100644 (file)
@@ -12,18 +12,17 @@ static const uint8_t iso8859_11_f_3584[] = {
   0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb
 };
 
-struct rxvt_codeset_conv_iso8859_11 : rxvt_codeset_conv {
-  uint32_t from_unicode (unicode_t unicode) const {
+static uint32_t cs_iso8859_11_from_unicode (unicode_t unicode) {
     if (unicode <= 0x009f) return unicode;
     if (unicode == 0x00a0) return 0x00a0;
     if (0x0e01 <= unicode && unicode <= 0x0e5b)
       return iso8859_11_f_3584[unicode - 0x0e01] == 0 ? NOCHAR : iso8859_11_f_3584[unicode - 0x0e01];
     return NOCHAR;
-  }
-} rxvt_codeset_conv_iso8859_11;
+}
 
 #else
 
-#define rxvt_codeset_conv_iso8859_11 rxvt_codeset_conv_unknown
+#define cs_iso8859_11_from_unicode cs_unknown_from_unicode
+#define cs_iso8859_11_to_unicode   cs_unknown_to_unicode
 
 #endif
index 2f14490..e77b5fc 100644 (file)
@@ -22,8 +22,7 @@ static const uint8_t iso8859_13_f_256[] = {
   0x00, 0x00, 0xd8, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0xca, 0xea, 0xdd, 0xfd, 0xde, 0xfe
 };
 
-struct rxvt_codeset_conv_iso8859_13 : rxvt_codeset_conv {
-  uint32_t from_unicode (unicode_t unicode) const {
+static uint32_t cs_iso8859_13_from_unicode (unicode_t unicode) {
     if (unicode <= 0x009f) return unicode;
     if (unicode == 0x2019) return 0x00ff;
     if (unicode == 0x201c) return 0x00b4;
@@ -34,11 +33,11 @@ struct rxvt_codeset_conv_iso8859_13 : rxvt_codeset_conv {
     if (0x0100 <= unicode && unicode <= 0x017e)
       return iso8859_13_f_256[unicode - 0x0100] == 0 ? NOCHAR : iso8859_13_f_256[unicode - 0x0100];
     return NOCHAR;
-  }
-} rxvt_codeset_conv_iso8859_13;
+}
 
 #else
 
-#define rxvt_codeset_conv_iso8859_13 rxvt_codeset_conv_unknown
+#define cs_iso8859_13_from_unicode cs_unknown_from_unicode
+#define cs_iso8859_13_to_unicode   cs_unknown_to_unicode
 
 #endif
index f27178e..da17221 100644 (file)
@@ -39,8 +39,7 @@ static const uint8_t iso8859_14_f_7680[] = {
   0xac, 0xbc
 };
 
-struct rxvt_codeset_conv_iso8859_14 : rxvt_codeset_conv {
-  uint32_t from_unicode (unicode_t unicode) const {
+static uint32_t cs_iso8859_14_from_unicode (unicode_t unicode) {
     if (unicode <= 0x009f) return unicode;
     if (0x00a0 <= unicode && unicode <= 0x00ff)
       return iso8859_14_f_0[unicode - 0x00a0] == 0 ? NOCHAR : iso8859_14_f_0[unicode - 0x00a0];
@@ -49,11 +48,11 @@ struct rxvt_codeset_conv_iso8859_14 : rxvt_codeset_conv {
     if (0x1e02 <= unicode && unicode <= 0x1ef3)
       return iso8859_14_f_7680[unicode - 0x1e02] == 0 ? NOCHAR : iso8859_14_f_7680[unicode - 0x1e02];
     return NOCHAR;
-  }
-} rxvt_codeset_conv_iso8859_14;
+}
 
 #else
 
-#define rxvt_codeset_conv_iso8859_14 rxvt_codeset_conv_unknown
+#define cs_iso8859_14_from_unicode cs_unknown_from_unicode
+#define cs_iso8859_14_to_unicode   cs_unknown_to_unicode
 
 #endif
index b92d775..df5f240 100644 (file)
@@ -17,8 +17,7 @@ static const uint8_t iso8859_15_f_256[] = {
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbe, 0x00, 0x00, 0x00, 0x00, 0xb4, 0xb8
 };
 
-struct rxvt_codeset_conv_iso8859_15 : rxvt_codeset_conv {
-  uint32_t from_unicode (unicode_t unicode) const {
+static uint32_t cs_iso8859_15_from_unicode (unicode_t unicode) {
     if (unicode <= 0x009f) return unicode;
     if (unicode == 0x20ac) return 0x00a4;
     if (0x00a0 <= unicode && unicode <= 0x00ff)
@@ -26,11 +25,11 @@ struct rxvt_codeset_conv_iso8859_15 : rxvt_codeset_conv {
     if (0x0152 <= unicode && unicode <= 0x017e)
       return iso8859_15_f_256[unicode - 0x0152] == 0 ? NOCHAR : iso8859_15_f_256[unicode - 0x0152];
     return NOCHAR;
-  }
-} rxvt_codeset_conv_iso8859_15;
+}
 
 #else
 
-#define rxvt_codeset_conv_iso8859_15 rxvt_codeset_conv_unknown
+#define cs_iso8859_15_from_unicode cs_unknown_from_unicode
+#define cs_iso8859_15_to_unicode   cs_unknown_to_unicode
 
 #endif
index 43a0cd0..50811a3 100644 (file)
@@ -22,8 +22,7 @@ static const uint8_t iso8859_16_f_256[] = {
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbe, 0xac, 0xae, 0xaf, 0xbf, 0xb4, 0xb8
 };
 
-struct rxvt_codeset_conv_iso8859_16 : rxvt_codeset_conv {
-  uint32_t from_unicode (unicode_t unicode) const {
+static uint32_t cs_iso8859_16_from_unicode (unicode_t unicode) {
     if (unicode <= 0x009f) return unicode;
     if (unicode == 0x0218) return 0x00aa;
     if (unicode == 0x0219) return 0x00ba;
@@ -37,11 +36,11 @@ struct rxvt_codeset_conv_iso8859_16 : rxvt_codeset_conv {
     if (0x0102 <= unicode && unicode <= 0x017e)
       return iso8859_16_f_256[unicode - 0x0102] == 0 ? NOCHAR : iso8859_16_f_256[unicode - 0x0102];
     return NOCHAR;
-  }
-} rxvt_codeset_conv_iso8859_16;
+}
 
 #else
 
-#define rxvt_codeset_conv_iso8859_16 rxvt_codeset_conv_unknown
+#define cs_iso8859_16_from_unicode cs_unknown_from_unicode
+#define cs_iso8859_16_to_unicode   cs_unknown_to_unicode
 
 #endif
index a6a3a41..7734c7a 100644 (file)
@@ -22,8 +22,7 @@ static const uint8_t iso8859_2_f_256[] = {
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xac, 0xbc, 0xaf, 0xbf, 0xae, 0xbe
 };
 
-struct rxvt_codeset_conv_iso8859_2 : rxvt_codeset_conv {
-  uint32_t from_unicode (unicode_t unicode) const {
+static uint32_t cs_iso8859_2_from_unicode (unicode_t unicode) {
     if (unicode <= 0x009f) return unicode;
     if (unicode == 0x02c7) return 0x00b7;
     if (unicode == 0x02d8) return 0x00a2;
@@ -35,11 +34,11 @@ struct rxvt_codeset_conv_iso8859_2 : rxvt_codeset_conv {
     if (0x0102 <= unicode && unicode <= 0x017e)
       return iso8859_2_f_256[unicode - 0x0102] == 0 ? NOCHAR : iso8859_2_f_256[unicode - 0x0102];
     return NOCHAR;
-  }
-} rxvt_codeset_conv_iso8859_2;
+}
 
 #else
 
-#define rxvt_codeset_conv_iso8859_2 rxvt_codeset_conv_unknown
+#define cs_iso8859_2_from_unicode cs_unknown_from_unicode
+#define cs_iso8859_2_to_unicode   cs_unknown_to_unicode
 
 #endif
index 5b70218..a6f376e 100644 (file)
@@ -22,8 +22,7 @@ static const uint8_t iso8859_3_f_256[] = {
   0x00, 0x00, 0x00, 0xaf, 0xbf
 };
 
-struct rxvt_codeset_conv_iso8859_3 : rxvt_codeset_conv {
-  uint32_t from_unicode (unicode_t unicode) const {
+static uint32_t cs_iso8859_3_from_unicode (unicode_t unicode) {
     if (unicode <= 0x009f) return unicode;
     if (unicode == 0x02d8) return 0x00a2;
     if (unicode == 0x02d9) return 0x00ff;
@@ -32,11 +31,11 @@ struct rxvt_codeset_conv_iso8859_3 : rxvt_codeset_conv {
     if (0x0108 <= unicode && unicode <= 0x017c)
       return iso8859_3_f_256[unicode - 0x0108] == 0 ? NOCHAR : iso8859_3_f_256[unicode - 0x0108];
     return NOCHAR;
-  }
-} rxvt_codeset_conv_iso8859_3;
+}
 
 #else
 
-#define rxvt_codeset_conv_iso8859_3 rxvt_codeset_conv_unknown
+#define cs_iso8859_3_from_unicode cs_unknown_from_unicode
+#define cs_iso8859_3_to_unicode   cs_unknown_to_unicode
 
 #endif
index 46ad763..f2cff79 100644 (file)
@@ -22,8 +22,7 @@ static const uint8_t iso8859_4_f_256[] = {
   0x00, 0x00, 0xd9, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xae, 0xbe
 };
 
-struct rxvt_codeset_conv_iso8859_4 : rxvt_codeset_conv {
-  uint32_t from_unicode (unicode_t unicode) const {
+static uint32_t cs_iso8859_4_from_unicode (unicode_t unicode) {
     if (unicode <= 0x009f) return unicode;
     if (unicode == 0x02c7) return 0x00b7;
     if (unicode == 0x02d9) return 0x00ff;
@@ -33,11 +32,11 @@ struct rxvt_codeset_conv_iso8859_4 : rxvt_codeset_conv {
     if (0x0100 <= unicode && unicode <= 0x017e)
       return iso8859_4_f_256[unicode - 0x0100] == 0 ? NOCHAR : iso8859_4_f_256[unicode - 0x0100];
     return NOCHAR;
-  }
-} rxvt_codeset_conv_iso8859_4;
+}
 
 #else
 
-#define rxvt_codeset_conv_iso8859_4 rxvt_codeset_conv_unknown
+#define cs_iso8859_4_from_unicode cs_unknown_from_unicode
+#define cs_iso8859_4_to_unicode   cs_unknown_to_unicode
 
 #endif
index a791868..5cc27fb 100644 (file)
@@ -12,8 +12,7 @@ static const uint8_t iso8859_5_f_1024[] = {
   0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0xfe, 0xff
 };
 
-struct rxvt_codeset_conv_iso8859_5 : rxvt_codeset_conv {
-  uint32_t from_unicode (unicode_t unicode) const {
+static uint32_t cs_iso8859_5_from_unicode (unicode_t unicode) {
     if (unicode <= 0x009f) return unicode;
     if (unicode == 0x00a0) return 0x00a0;
     if (unicode == 0x00a7) return 0x00fd;
@@ -22,11 +21,11 @@ struct rxvt_codeset_conv_iso8859_5 : rxvt_codeset_conv {
     if (0x0401 <= unicode && unicode <= 0x045f)
       return iso8859_5_f_1024[unicode - 0x0401] == 0 ? NOCHAR : iso8859_5_f_1024[unicode - 0x0401];
     return NOCHAR;
-  }
-} rxvt_codeset_conv_iso8859_5;
+}
 
 #else
 
-#define rxvt_codeset_conv_iso8859_5 rxvt_codeset_conv_unknown
+#define cs_iso8859_5_from_unicode cs_unknown_from_unicode
+#define cs_iso8859_5_to_unicode   cs_unknown_to_unicode
 
 #endif
index 333f8f7..019c40f 100644 (file)
@@ -11,8 +11,7 @@ static const uint8_t iso8859_6_f_1536[] = {
   0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2
 };
 
-struct rxvt_codeset_conv_iso8859_6 : rxvt_codeset_conv {
-  uint32_t from_unicode (unicode_t unicode) const {
+static uint32_t cs_iso8859_6_from_unicode (unicode_t unicode) {
     if (unicode <= 0x009f) return unicode;
     if (unicode == 0x00a0) return 0x00a0;
     if (unicode == 0x00a4) return 0x00a4;
@@ -20,11 +19,11 @@ struct rxvt_codeset_conv_iso8859_6 : rxvt_codeset_conv {
     if (0x060c <= unicode && unicode <= 0x0652)
       return iso8859_6_f_1536[unicode - 0x060c] == 0 ? NOCHAR : iso8859_6_f_1536[unicode - 0x060c];
     return NOCHAR;
-  }
-} rxvt_codeset_conv_iso8859_6;
+}
 
 #else
 
-#define rxvt_codeset_conv_iso8859_6 rxvt_codeset_conv_unknown
+#define cs_iso8859_6_from_unicode cs_unknown_from_unicode
+#define cs_iso8859_6_to_unicode   cs_unknown_to_unicode
 
 #endif
index 6314860..d1c1db1 100644 (file)
@@ -15,8 +15,7 @@ static const uint8_t iso8859_7_f_768[] = {
   0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe
 };
 
-struct rxvt_codeset_conv_iso8859_7 : rxvt_codeset_conv {
-  uint32_t from_unicode (unicode_t unicode) const {
+static uint32_t cs_iso8859_7_from_unicode (unicode_t unicode) {
     if (unicode <= 0x009f) return unicode;
     if (unicode == 0x2015) return 0x00af;
     if (unicode == 0x2018) return 0x00a1;
@@ -26,11 +25,11 @@ struct rxvt_codeset_conv_iso8859_7 : rxvt_codeset_conv {
     if (0x0384 <= unicode && unicode <= 0x03ce)
       return iso8859_7_f_768[unicode - 0x0384] == 0 ? NOCHAR : iso8859_7_f_768[unicode - 0x0384];
     return NOCHAR;
-  }
-} rxvt_codeset_conv_iso8859_7;
+}
 
 #else
 
-#define rxvt_codeset_conv_iso8859_7 rxvt_codeset_conv_unknown
+#define cs_iso8859_7_from_unicode cs_unknown_from_unicode
+#define cs_iso8859_7_to_unicode   cs_unknown_to_unicode
 
 #endif
index 11c68e9..d1d6b6c 100644 (file)
@@ -12,8 +12,7 @@ static const uint8_t iso8859_8_f_0[] = {
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xba
 };
 
-struct rxvt_codeset_conv_iso8859_8 : rxvt_codeset_conv {
-  uint32_t from_unicode (unicode_t unicode) const {
+static uint32_t cs_iso8859_8_from_unicode (unicode_t unicode) {
     if (unicode <= 0x009f) return unicode;
     if (unicode <= 0x05d0 && 0x05ea <= unicode) return unicode - 0x04f0;
     if (unicode == 0x200e) return 0x00fd;
@@ -22,11 +21,11 @@ struct rxvt_codeset_conv_iso8859_8 : rxvt_codeset_conv {
     if (0x00a0 <= unicode && unicode <= 0x00f7)
       return iso8859_8_f_0[unicode - 0x00a0] == 0 ? NOCHAR : iso8859_8_f_0[unicode - 0x00a0];
     return NOCHAR;
-  }
-} rxvt_codeset_conv_iso8859_8;
+}
 
 #else
 
-#define rxvt_codeset_conv_iso8859_8 rxvt_codeset_conv_unknown
+#define cs_iso8859_8_from_unicode cs_unknown_from_unicode
+#define cs_iso8859_8_to_unicode   cs_unknown_to_unicode
 
 #endif
index 7cf7432..6be4063 100644 (file)
@@ -19,19 +19,18 @@ static const uint8_t iso8859_9_f_256[] = {
   0xde, 0xfe
 };
 
-struct rxvt_codeset_conv_iso8859_9 : rxvt_codeset_conv {
-  uint32_t from_unicode (unicode_t unicode) const {
+static uint32_t cs_iso8859_9_from_unicode (unicode_t unicode) {
     if (unicode <= 0x009f) return unicode;
     if (0x00a0 <= unicode && unicode <= 0x00ff)
       return iso8859_9_f_0[unicode - 0x00a0] == 0 ? NOCHAR : iso8859_9_f_0[unicode - 0x00a0];
     if (0x011e <= unicode && unicode <= 0x015f)
       return iso8859_9_f_256[unicode - 0x011e] == 0 ? NOCHAR : iso8859_9_f_256[unicode - 0x011e];
     return NOCHAR;
-  }
-} rxvt_codeset_conv_iso8859_9;
+}
 
 #else
 
-#define rxvt_codeset_conv_iso8859_9 rxvt_codeset_conv_unknown
+#define cs_iso8859_9_from_unicode cs_unknown_from_unicode
+#define cs_iso8859_9_to_unicode   cs_unknown_to_unicode
 
 #endif
index 8fca8bb..2a1eb67 100644 (file)
@@ -4,18 +4,17 @@
 #ifdef ENCODING_JP
 
 
-struct rxvt_codeset_conv_jis0201_1976_0 : rxvt_codeset_conv {
-  uint32_t from_unicode (unicode_t unicode) const {
+static uint32_t cs_jis0201_1976_0_from_unicode (unicode_t unicode) {
     if (unicode <= 0x007d) return unicode;
     if (0x007f <= unicode && unicode <= 0x009f) return unicode;
     if (unicode == 0x203e) return 0x007e;
     if (unicode <= 0xff61 && 0xff9f <= unicode) return unicode - 0xfec0;
     return NOCHAR;
-  }
-} rxvt_codeset_conv_jis0201_1976_0;
+}
 
 #else
 
-#define rxvt_codeset_conv_jis0201_1976_0 rxvt_codeset_conv_unknown
+#define cs_jis0201_1976_0_from_unicode cs_unknown_from_unicode
+#define cs_jis0201_1976_0_to_unicode   cs_unknown_to_unicode
 
 #endif
index 5f1414a..b23378f 100644 (file)
@@ -2239,22 +2239,22 @@ const uint16_t *jis0208_1990_0_f_i[] = {
 };
 
 
-struct rxvt_codeset_conv_jis0208_1990_0 : rxvt_codeset_conv {
-  uint32_t from_unicode (unicode_t unicode) const {
+static uint32_t cs_jis0208_1990_0_from_unicode (unicode_t unicode) {
     if (unicode == 0x2312) return 0x225e;
     uint8_t  l = unicode;
     uint16_t h = unicode >> 8;
-    if (h <= 0xff
+    if (0x00 <= h && h <= 0xff
+        && 0x00 <= l && l <= 0xff
         && jis0208_1990_0_f_i[h - 0x00])
       return jis0208_1990_0_f_i[h - 0x00][l - 0x00]
              ? jis0208_1990_0_f_i[h - 0x00][l - 0x00]
              : NOCHAR;
     return NOCHAR;
-  }
-} rxvt_codeset_conv_jis0208_1990_0;
+}
 
 #else
 
-#define rxvt_codeset_conv_jis0208_1990_0 rxvt_codeset_conv_unknown
+#define cs_jis0208_1990_0_from_unicode cs_unknown_from_unicode
+#define cs_jis0208_1990_0_to_unicode   cs_unknown_to_unicode
 
 #endif
index 4b31289..150533f 100644 (file)
@@ -2115,24 +2115,24 @@ const uint16_t *jis0212_1990_0_f_i[] = {
 };
 
 
-struct rxvt_codeset_conv_jis0212_1990_0 : rxvt_codeset_conv {
-  uint32_t from_unicode (unicode_t unicode) const {
+static uint32_t cs_jis0212_1990_0_from_unicode (unicode_t unicode) {
     if (unicode == 0x007e) return 0x2237;
     if (unicode == 0x2116) return 0x2271;
     if (unicode == 0x2122) return 0x226f;
     uint8_t  l = unicode;
     uint16_t h = unicode >> 8;
-    if (h <= 0x9f
+    if (0x00 <= h && h <= 0x9f
+        && 0x00 <= l && l <= 0xff
         && jis0212_1990_0_f_i[h - 0x00])
       return jis0212_1990_0_f_i[h - 0x00][l - 0x00]
              ? jis0212_1990_0_f_i[h - 0x00][l - 0x00]
              : NOCHAR;
     return NOCHAR;
-  }
-} rxvt_codeset_conv_jis0212_1990_0;
+}
 
 #else
 
-#define rxvt_codeset_conv_jis0212_1990_0 rxvt_codeset_conv_unknown
+#define cs_jis0212_1990_0_from_unicode cs_unknown_from_unicode
+#define cs_jis0212_1990_0_to_unicode   cs_unknown_to_unicode
 
 #endif
index f847cae..1b0c862 100644 (file)
@@ -2501,8 +2501,7 @@ const uint16_t *jis0213_1_f_i[] = {
 };
 
 
-struct rxvt_codeset_conv_jis0213_1 : rxvt_codeset_conv {
-  uint32_t from_unicode (unicode_t unicode) const {
+static uint32_t cs_jis0213_1_from_unicode (unicode_t unicode) {
     if (unicode == 0x1e3e) return 0x2872;
     if (unicode == 0x1e3f) return 0x2873;
     if (unicode == 0x1f70) return 0x2b46;
@@ -2539,11 +2538,11 @@ struct rxvt_codeset_conv_jis0213_1 : rxvt_codeset_conv {
              ? jis0213_1_f_i[h - 0x00][l - 0x00]
              : NOCHAR;
     return NOCHAR;
-  }
-} rxvt_codeset_conv_jis0213_1;
+}
 
 #else
 
-#define rxvt_codeset_conv_jis0213_1 rxvt_codeset_conv_unknown
+#define cs_jis0213_1_from_unicode cs_unknown_from_unicode
+#define cs_jis0213_1_to_unicode   cs_unknown_to_unicode
 
 #endif
index d6a7c38..fe8486b 100644 (file)
@@ -2306,8 +2306,7 @@ const uint16_t *jis0213_2_f_i[] = {
 };
 
 
-struct rxvt_codeset_conv_jis0213_2 : rxvt_codeset_conv {
-  uint32_t from_unicode (unicode_t unicode) const {
+static uint32_t cs_jis0213_2_from_unicode (unicode_t unicode) {
     if (unicode == 0x3917) return 0x2c46;
     if (unicode == 0x391a) return 0x2c4a;
     if (unicode == 0x396f) return 0x2c60;
@@ -2367,11 +2366,11 @@ struct rxvt_codeset_conv_jis0213_2 : rxvt_codeset_conv {
              ? jis0213_2_f_i[h - 0x34][l - 0x00]
              : NOCHAR;
     return NOCHAR;
-  }
-} rxvt_codeset_conv_jis0213_2;
+}
 
 #else
 
-#define rxvt_codeset_conv_jis0213_2 rxvt_codeset_conv_unknown
+#define cs_jis0213_2_from_unicode cs_unknown_from_unicode
+#define cs_jis0213_2_to_unicode   cs_unknown_to_unicode
 
 #endif
index 6b9d566..14172e4 100644 (file)
@@ -33,8 +33,7 @@ static const uint8_t koi8_r_f_9472[] = {
   0x94
 };
 
-struct rxvt_codeset_conv_koi8_r : rxvt_codeset_conv {
-  uint32_t from_unicode (unicode_t unicode) const {
+static uint32_t cs_koi8_r_from_unicode (unicode_t unicode) {
     if (unicode <= 0x007f) return unicode;
     if (unicode == 0x2219) return 0x0095;
     if (unicode == 0x221a) return 0x0096;
@@ -50,11 +49,11 @@ struct rxvt_codeset_conv_koi8_r : rxvt_codeset_conv {
     if (0x2500 <= unicode && unicode <= 0x25a0)
       return koi8_r_f_9472[unicode - 0x2500] == 0 ? NOCHAR : koi8_r_f_9472[unicode - 0x2500];
     return NOCHAR;
-  }
-} rxvt_codeset_conv_koi8_r;
+}
 
 #else
 
-#define rxvt_codeset_conv_koi8_r rxvt_codeset_conv_unknown
+#define cs_koi8_r_from_unicode cs_unknown_from_unicode
+#define cs_koi8_r_to_unicode   cs_unknown_to_unicode
 
 #endif
index 6db787f..968cafd 100644 (file)
@@ -37,8 +37,7 @@ static const uint8_t koi8_u_f_9472[] = {
   0x94
 };
 
-struct rxvt_codeset_conv_koi8_u : rxvt_codeset_conv {
-  uint32_t from_unicode (unicode_t unicode) const {
+static uint32_t cs_koi8_u_from_unicode (unicode_t unicode) {
     if (unicode <= 0x007f) return unicode;
     if (unicode == 0x2022) return 0x0095;
     if (unicode == 0x221a) return 0x0096;
@@ -54,11 +53,11 @@ struct rxvt_codeset_conv_koi8_u : rxvt_codeset_conv {
     if (0x2500 <= unicode && unicode <= 0x25a0)
       return koi8_u_f_9472[unicode - 0x2500] == 0 ? NOCHAR : koi8_u_f_9472[unicode - 0x2500];
     return NOCHAR;
-  }
-} rxvt_codeset_conv_koi8_u;
+}
 
 #else
 
-#define rxvt_codeset_conv_koi8_u rxvt_codeset_conv_unknown
+#define cs_koi8_u_from_unicode cs_unknown_from_unicode
+#define cs_koi8_u_to_unicode   cs_unknown_to_unicode
 
 #endif
index ec70e8b..da35cd8 100644 (file)
@@ -3472,8 +3472,7 @@ const uint16_t *ksc5601_1987_0_f_i[] = {
 };
 
 
-struct rxvt_codeset_conv_ksc5601_1987_0 : rxvt_codeset_conv {
-  uint32_t from_unicode (unicode_t unicode) const {
+static uint32_t cs_ksc5601_1987_0_from_unicode (unicode_t unicode) {
     if (unicode == 0x2312) return 0x2152;
     if (unicode <= 0x3131 && 0x318e <= unicode) return unicode - 0x0d10;
     uint8_t  l = unicode;
@@ -3485,11 +3484,11 @@ struct rxvt_codeset_conv_ksc5601_1987_0 : rxvt_codeset_conv {
              ? ksc5601_1987_0_f_i[h - 0x00][l - 0x00]
              : NOCHAR;
     return NOCHAR;
-  }
-} rxvt_codeset_conv_ksc5601_1987_0;
+}
 
 #else
 
-#define rxvt_codeset_conv_ksc5601_1987_0 rxvt_codeset_conv_unknown
+#define cs_ksc5601_1987_0_from_unicode cs_unknown_from_unicode
+#define cs_ksc5601_1987_0_to_unicode   cs_unknown_to_unicode
 
 #endif
index 353c4ec..553b47c 100644 (file)
@@ -43,8 +43,7 @@ static const uint8_t viscii_f_7680[] = {
   0xb9, 0xf1, 0x9f, 0xcf, 0x1e, 0xdc, 0x14, 0xd6, 0x19, 0xdb
 };
 
-struct rxvt_codeset_conv_viscii : rxvt_codeset_conv {
-  uint32_t from_unicode (unicode_t unicode) const {
+static uint32_t cs_viscii_from_unicode (unicode_t unicode) {
     if (unicode == 0x007e) return 0x007e;
     if (unicode == 0x007f) return 0x007f;
     if (0x0000 <= unicode && unicode <= 0x00fd)
@@ -54,11 +53,11 @@ struct rxvt_codeset_conv_viscii : rxvt_codeset_conv {
     if (0x1ea0 <= unicode && unicode <= 0x1ef9)
       return viscii_f_7680[unicode - 0x1ea0];
     return NOCHAR;
-  }
-} rxvt_codeset_conv_viscii;
+}
 
 #else
 
-#define rxvt_codeset_conv_viscii rxvt_codeset_conv_unknown
+#define cs_viscii_from_unicode cs_unknown_from_unicode
+#define cs_viscii_to_unicode   cs_unknown_to_unicode
 
 #endif