blog · git · desktop · images · contact


tuxeye2

2017-03-02

In the 1990ies, there was a cute little program. It displayed Tux, our beloved penguin. His eyes followed movement of your mouse. :-) That program was called “tuXeyes” and Debian dubbed it as “a fancier version of Xeyes”. It was written by Ivo van der Wijk.

Sadly, it no longer exists. There are some old sources from Ubuntu 12.04, but that’s it. Nobody wants to maintain the original program anymore, because it has a dependency on a very old version of Qt. And, of course, it’s just a toy. It appears it was originally written for Qt 1.42 and later ported to Qt 3 (probably by Debian). Given that Qt’s current version is 5.8, you won’t have a lot of fun.

Guess what? You’re right, I’ve rewritten tuXeyes from scratch. It’s a short C program now and depends only on xlib. However, there’s only one theme at the moment, Tux. The original tuXeyes can show a couple more guys.

tuxeye2

It was a fun exercise. Once again, I chose to work with farbfeld images, which I’m already using in katriawm and bevelbar/infofeld. This is such a pleasant file format to work with (except for the endianness swapping, but I get why it’s done that way).

Tux is built using three layers: A background, the (moving) eyes, and a foreground overlay. They are drawn in this order, which allows the eyes to disappear “behind” “skin”. All of this happens in terms of in-memory farbfeld images, only the end result is convert to an XImage and then to an X11 pixmap.

There’s the file libff.h which does all the farbfeld handling. Maybe this will evolve into a proper library. Dunno, we’ll see. The idea with farbfeld is that the image format is so simple that you don’t need a library, but there’s still some code that’s needed in every project.

As X11 windows can only be rectangular, I’m using the SHAPE extension cut off all “non-Tux parts”. To my surprise, there’s a ready-to-use function, XShapeCombineMask(), which can calculate the window shape from a pixmap mask. Neat.

This is the first time that I’m using the _MOTIF_WM_HINTS hint in a client to request an undecorated window. Works with katriawm and Openbox. Maybe more. There’s no such hint in EWMH or ICCCM – I’m not exactly sure why not.

Have fun: tuxeye2

Comments?