diff -ruN torsmo-0.17.old/README torsmo-0.17/README
--- torsmo-0.17.old/README	2004-05-25 13:07:10.000000000 +0200
+++ torsmo-0.17/README	2004-11-28 13:03:27.088407000 +0200
@@ -55,6 +55,7 @@
    default_color         Default color and border color                       
    default_shade_color   Default shading color and border's shading color     
    default_outline_color Default outline color                                
+   double_buffer         Use the Xdbe extension? (eliminates flicker)         
    draw_borders          Draw borders around text?                            
    draw_shades           Draw shades?                                         
    draw_outline          Draw outlines?                                       
@@ -84,6 +85,7 @@
      Argument                          Description                        
    -V           Prints version and exits                                  
    -a ALIGNMENT Text alignment on screen, {top,bottom}_{left,right}       
+   -b           Use double buffering (eliminates flicker)                 
    -c FILE      Config file to load instead of $HOME/.torsmorc            
    -d           Daemonize, fork to background                             
    -f FONT      Font to use                                               
--- torsmo-0.17.old/configure.in	2004-05-25 10:46:27.000000000 +0200
+++ torsmo-0.17/configure.in	2004-11-28 13:15:03.538530488 +0200
@@ -36,6 +36,17 @@
   AC_DEFINE(OWN_WINDOW, 1, [Define if you want support for window creating])
 fi
 
+dnl DOUBLE_BUFFER option
+
+dah=yes
+AC_ARG_ENABLE(double_buffer,
+[  --enable-double-buffer  enable if you want to support flicker-free operation [default=yes]],
+  [dah="$enableval"])
+
+if test $dah != "no"; then
+  AC_DEFINE(DOUBLE_BUFFER, 1, [Define if you want support for the DBE extension])
+fi
+
 dnl USE_PROC_UPTIME option
 
 dah=no
@@ -61,6 +72,10 @@
 AC_DEFINE(HAVE_X11, 1, [Define if you have X11])
 
 AC_CHECK_LIB([X11], [XOpenDisplay], [X11_LIBS="-lX11"], [], [[-L$x_libraries]])
+AC_CHECK_LIB([Xext], [XdbeQueryExtension], [
+  X11_LIBS="$X11_LIBS -lXext"
+  AC_DEFINE(HAVE_LIBXEXT, 1, [Define if you have libXext])
+], [], [[-L$x_libraries $X11_LIBS]])
 
 if test "$x_libraries" != ""; then
   LDFLAGS="$LDFLAGS -L$x_libraries"
@@ -73,6 +88,8 @@
 dnl Some random headers
 
 AC_CHECK_HEADERS([signal.h unistd.h X11/Xlib.h sys/utsname.h sys/stat.h])
+dnl Needed for double buffering
+AC_CHECK_HEADERS([X11/extensions/Xdbe.h])
 
 dnl Check help2man
 
--- torsmo-0.17.old/readme.html	2004-05-25 12:28:50.000000000 +0200
+++ torsmo-0.17/readme.html	2004-11-28 14:49:20.596526952 +0200
@@ -59,6 +59,7 @@
 <TR><TD>default_color		<TD>Default color and border color
 <TR><TD>default_shade_color	<TD>Default shading color and border's shading color
 <TR><TD>default_outline_color	<TD>Default outline color
+<TR><TD>double_buffer		<TD>Use the Xdbe extension? (eliminates flicker)
 <TR><TD>draw_borders		<TD>Draw borders around text?
 <TR><TD>draw_shades		<TD>Draw shades?
 <TR><TD>draw_outline		<TD>Draw outlines?
@@ -88,6 +89,7 @@
 <TR><TH>Argument     <TH>Description
 <TR><TD>-V           <TD>Prints version and exits
 <TR><TD>-a ALIGNMENT <TD>Text alignment on screen, {top,bottom}_{left,right}
+<TR><TD>-b	     <TD>Use double buffering (eliminates flicker)
 <TR><TD>-c FILE      <TD>Config file to load instead of $HOME/.torsmorc
 <TR><TD>-d           <TD>Daemonize, fork to background
 <TR><TD>-f FONT      <TD>Font to use
--- torsmo-0.17.old/torsmo.c	2004-05-25 12:58:51.000000000 +0200
+++ torsmo-0.17/torsmo.c	2004-11-28 14:40:23.023250512 +0200
@@ -23,6 +23,11 @@
 #include <X11/Xatom.h>
 #include <X11/Xutil.h>
 
+#if defined(HAVE_X11_EXTENSIONS_XDBE_H) && defined(HAVE_LIBXEXT) && defined(DOUBLE_BUFFER)
+# define XDBE
+# include <X11/extensions/Xdbe.h>
+#endif
+
 /* alignments */
 enum {
   TOP_LEFT = 1,
@@ -111,6 +116,11 @@
 static XFontStruct *font_info;
 static int display_width, display_height;
 
+#ifdef XDBE
+static XdbeBackBuffer back_buffer;
+static int use_xdbe = 0;
+#endif
+static Drawable drawable;
 static Window win;
 static int window_width, window_height;
 
@@ -1351,7 +1361,7 @@
 static void draw_string(const char *s) {
   if (s[0] == '\0') return;
 
-  XDrawString(display, win, gc, cur_x, cur_y, s, strlen(s));
+  XDrawString(display, drawable, gc, cur_x, cur_y, s, strlen(s));
 
   cur_x += get_string_width(s);
 }
@@ -1383,7 +1393,7 @@
           w = text_start_x + text_width - cur_x;
 
           XSetLineAttributes(display, gc, h, LineSolid, CapButt, JoinMiter);
-          XDrawLine(display, win, gc, cur_x, cur_y-mid, cur_x+w, cur_y-mid);
+          XDrawLine(display, drawable, gc, cur_x, cur_y-mid, cur_x+w, cur_y-mid);
         }
         break;
 
@@ -1397,7 +1407,7 @@
 
           XSetLineAttributes(display, gc, h, LineOnOffDash, CapButt, JoinMiter);
           XSetDashes(display, gc, 0, ss, 2);
-          XDrawLine(display, win, gc, cur_x, cur_y-mid, cur_x+w, cur_y-mid);
+          XDrawLine(display, drawable, gc, cur_x, cur_y-mid, cur_x+w, cur_y-mid);
         }
         break;
 
@@ -1411,8 +1421,8 @@
 
           XSetLineAttributes(display, gc, 1, LineSolid, CapButt, JoinMiter);
 
-          XDrawRectangle(display, win, gc, cur_x, by, w, h);
-          XFillRectangle(display, win, gc, cur_x, by, w * bar_usage / 255, h);
+          XDrawRectangle(display, drawable, gc, cur_x, by, w, h);
+          XFillRectangle(display, drawable, gc, cur_x, by, w * bar_usage / 255, h);
         }
         break;
 
@@ -1461,7 +1471,7 @@
       XSetLineAttributes(display, gc, border_width, LineSolid, CapButt, JoinMiter);
     }
 
-    XDrawRectangle(display, win, gc,
+    XDrawRectangle(display, drawable, gc,
         text_start_x - border_margin + b,
         text_start_y - border_margin + b,
         text_width + border_margin*2 - 1 - b*2,
@@ -1503,9 +1513,21 @@
   set_foreground_color(default_fg_color);
   draw_mode = FG;
   draw_text();
+  
+#ifdef XDBE
+  if (use_xdbe) {
+    XdbeSwapInfo swap;
+    swap.swap_window = win;
+    swap.swap_action = XdbeBackground;
+    XdbeSwapBuffers(display, &swap, 1);
+  }
+#endif
 }
 
 static void clear_text() {
+#ifdef XDBE
+  if (use_xdbe) return; /* The swap action is XdbeBackground, which clears */
+#endif
   /* there is some extra space for borders and outlines */
   XClearArea(display, win, text_start_x-border_margin-1, text_start_y-border_margin-1,
       text_width+border_margin*2+2, text_height+border_margin*2+2, True);
@@ -1550,6 +1572,10 @@
 }
 
 static void clean_up() {
+#ifdef XDBE
+  if (use_xdbe)
+    XdbeDeallocateBackBufferName(display, back_buffer);
+#endif
 #ifdef OWN_WINDOW
   if (own_window)
     XDestroyWindow(display, win);
@@ -1728,7 +1754,26 @@
       }
     }
 
+    /* XDBE doesn't seem to provide a way to clear the back buffer without
+     * interfering with the front buffer, other than passing XdbeBackground
+     * to XdbeSwapBuffers. That means that if we're using XDBE, we need to
+     * redraw the text even if it wasn't part of the exposed area. OTOH,
+     * if we're not going to call draw_stuff at all, then no swap happens
+     * and we can safely do nothing.
+     */
+    
     if (!XEmptyRegion(region)) {
+#ifdef XDBE
+      if (use_xdbe)
+      {
+        XRectangle r;
+        r.x = text_start_x - border_margin;
+        r.y = text_start_y - border_margin;
+        r.width = text_width + border_margin*2;
+        r.height = text_height + border_margin*2;
+        XUnionRectWithRegion(&r, region, region);
+      }
+#endif
       XSetRegion(display, gc, region);
       draw_stuff();
       XDestroyRegion(region);
@@ -1936,6 +1981,28 @@
       window_height = attrs.height;
     }
   }
+  drawable = win;
+#ifdef XDBE
+  if (use_xdbe) {
+    int major, minor;
+    if (!XdbeQueryExtension(display, &major, &minor))
+      use_xdbe = 0;
+    else
+    {
+      back_buffer = XdbeAllocateBackBufferName(display, win, XdbeBackground);
+      if (back_buffer != None)
+      {
+        drawable = back_buffer;
+        fprintf(stderr, "drawing to double buffer\n");
+      }
+      else
+        use_xdbe = 0;
+    }
+    if (!use_xdbe)
+      fprintf(stderr, "failed to set up double buffer\n");
+  }
+  if (!use_xdbe) fprintf(stderr, "drawing to single buffer\n");
+#endif
 
   XSelectInput(display, win, ExposureMask
 #ifdef OWN_WINDOW
@@ -2112,6 +2179,11 @@
       own_window = string_to_bool(value);
     }
 #endif
+#ifdef XDBE
+    else if (strcasecmp(name, "double_buffer") == 0) {
+      use_xdbe = string_to_bool(value);
+    }
+#endif
     else if (strcasecmp(name, "stippled_borders") == 0) {
       if(value)
         stippled_borders = strtol(value, 0, 0);
@@ -2162,6 +2234,9 @@
 #ifdef OWN_WINDOW
 "o"
 #endif
+#ifdef XDBE
+"b"
+#endif
 ;
 
 int main(int argc, char **argv) {
@@ -2198,6 +2273,9 @@
 #ifdef OWN_WINDOW
 "   -o            create own window to draw\n"
 #endif
+#ifdef XDBE
+"   -b            double buffer (prevents flickering)\n"
+#endif
 "   -t TEXT       text to render, remember single quotes, like -t '$uptime'\n"
 "   -u SECS       update interval\n"
 "   -w WIN_ID     window id to draw\n"
@@ -2272,6 +2350,11 @@
       own_window = 1;
       break;
 #endif
+#ifdef XDBE
+    case 'b':
+      use_xdbe = 1;
+      break;
+#endif
 
     case 't':
       if (text != original_text) free(text);
--- torsmo-0.17.old/torsmorc.sample	2004-05-25 13:08:19.000000000 +0200
+++ torsmo-0.17/torsmorc.sample	2004-11-28 14:46:33.623910648 +0200
@@ -21,6 +21,9 @@
 # Create own window instead of using desktop (required in nautilus)
 own_window no
 
+# Use double buffering (reduces flicker, may not work for everyone)
+double_buffer yes
+
 # Minimum size of text area
 minimum_size 280 5
 
