# Let fishes swim over your desktop!

## Xfishtank: What does it do?

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.
My version of xfishtank is derived from the Debian version xfishank-2.5,
maintained by  Marius Gavrilescu and written by Jim Rees. 

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](../xroach_ng) I adapted xfishtank-2.5 to
modern desktops, while maintaining support for old desktops.

Xfishtank is available [here](downloads).

## Issues

The original version uses libimlib2 to handle the drawings of the
fishes. Because I was used to the usage of the 
[xpm format](https://en.wikipedia.org/wiki/X_PixMap)
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](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](../xpenguins). In my version, overlap is
not an issue.

## More information

More information about xfishtank can be found 
[by Jim Reese](https://jim.rees.org/computers/xfishtank.html).
You will find there also a link to xfishtank-2.6, from which
my xfishtank is derived.


## Have fun!

