Let fishes swim over your desktop!
Xfishtank is a well-known vintage application for Unix systems, based on the X11 protocol. It shows fishes swimming over the desktop. The original version, named xfish is from John Bradley who wrote the program back around 1987. J.T Anderson created from this xfishtank. My version of xfishtank is derived from the Debian version xfishank-2.5, maintained by Marius Gavrilescu.
Like the other applications, using the root-window to draw in, xfishtank does not behave well in modern desktops: the program runs, but the drawings are invisible.
After completing Xroachng I adapted xfishtank-2.5 to modern desktops, while maintaining support for old desktops.
Xfishtank is available here.
The original version uses libimlib2 to handle the drawings of the fishes. Because I was used to the usage of the xpm format in my other graphical projects, I decided to convert to the xpm format. That was not difficult: the xpm library contains a function to write a xpm file from an image or pixmap: XpmWriteFileFromImage() and XpmWriteFileFromPixmap() (I forgot which I used...). This change made it possible to clean up the code considerably. I also changed the timing of the drawings to get less jumpy behaviour of the fishes and bubbles. I created a simple menu and I was able to use double buffering, if possible. Xfishtank is now also usable as screen saver, see the man page.
In the original version, overlap of pictures is avoided, I guess to avoid ugly side-effects. For example assuming that fish 1 and fish 2 overlap: erase fish 1,draw fish 1 on new position, erase fish 2 and draw fish 2 on new position. Note that erasing erases the enveloping rectangle of the fish. This problem is circumvented now: first everything is erased, then everything is drawn, a trick I learned from the original code of xpenguins. In my version, overlap is not an issue.