xroottext

Version 0.8

ftp

patch to fix stupid memory leak

README

xroottext
Copyright 1999 Robert Forsman 
GNU General Public License

  Render text into a rectangular area in the root window.

Usage:
  ./xroottext [ -v ] [ -display dpyname ] [ -geom WxH+X+Y ] [ -fn fontspec ]
	[ -fg color ] [ -bg color ] < text



  Mike Shaver forwarded a program called xwrite to me.  It was just a
322-line C file that turned your X display's root window into a text
display.  I didn't like the way it worked, so I wrote a replacement
that worked the way I wanted.

  3 hours later, I had xroottext v0.7.  xroottext takes text from
stdin and renders it into a rectangular pseudo-terminal in the root
window.  It processes newlines and tabs (hard-coded to 8 characters)
and translates NULs to spaces, but all other characters are left
alone.  Text wraps to the next line when the "cursor" goes beyond the
last column.  The display scrolls when the "cursor" proceeds past the
last line.

  If you don't use the -bg argument, you'll be able to see your
background image behind the text.  If you do use the -bg argument,
each line of text will have a solid rectangle behind it obscuring the
background, but you'll be able to see through the unwritten remainder
of the line.  If your background isn't very bland, you'll have
difficulty reading the text.

  When stdin is exhausted the program continues to process Expose
events.  When the program is interrupted by one of the normal "go
away" signals, it clears its little area of the screen and exits.

  If you use a font which should be rendered vertically I have no idea
what will happen.  I have never used such a font.

  There is no scrollbar.  This text will always be beneath your other
windows.  If this is a problem, use an xterm or some other program.

Patch 0.81

From: "jason l. jordan" 
...
  I decided to hunt down the memory leak, and fortunately it wasn't
difficult.  In redraw_psuedo_tty(), there is a malloc() called every time
the function is entered, but isn't free()'d.  After I fixed that,
everything has been running great.  I've included the patch below (to be
applied in the same directory as xroottext.c with 'patch -p0', or by hand
since it is so simple :-).


Thanks,
-jason


--- xroottext.c Wed Mar 10 14:38:00 1999
+++ new-xroottext.c     Sun May  2 12:17:19 1999
@@ -161,6 +161,7 @@
                fprintf(stderr, "rendered row %d @%d+%d `%s'\n", row, pty->xoff, y+ascent, buf);
        }
     }
+    free(buf);
 }
 
 void erase_pseudo_tty(struct pseudo_tty *pty, Display *dpy, Window win, GC gc,