(Back to main page)

Aximgview

(a.k.a. How To Talk To An X11 Server Without Using Xlib)

Overview

This is an X11 image viewing program that behaves similarly to xloadimage, but is written in a programming language called Asterix and does not use any of the usual libraries like libc or Xlib, instead relying on system (Linux kernel) calls and “speaking” the X11 network protocol directly.

With a couple of features to make it at least somewhat usable, it serves as an example program demonstrating some of the strengths and weaknesses of Asterix and a few possible ways to solve various technical and practical problems with it.

It is not a tutorial or easy example for beginners. A description of Asterix and a few small test programs are included with the Asterix compiler itself. Besides that, you'll need to be familiar with at least the basics of low-level systems programming to understand its code and how it works.

Aximgview and the other programs included with it are free software (free as in freedom), currently distributed under the GNU General Public License (GPL), version 3 or any later version.

History

Aximgview began as a little experiment in communicating with an X11 display server without using any of the libraries normally used for this task (Xlib or more recently, xcb).

Starting off with an xdpyinfo-like program that connects to an X11 server and parses and shows the display configuration data it sends in its initial response (this program is included as axdpyinfo), I then implemented a basic image viewer for PPM files and continued working on it, adding some ‘polish’ and ‘user-friendly’ features, as well as making it behave more like xloadimage (an old X11 image viewer that I often use). For example:

The last pieces of work consisted of fixing some of the shortcuts I took to get it working with my own setup, as well as writing all the documentation. In particular:

Display and .Xauthority handling was a bit of annoying and tedious work and it's still lacking compared to Xlib/Xt-based programs, but hopefully it's enough to let aximgview run on most Linux-based systems without having to learn and mess around with the -display and -xauth* command-line options.

In this way it eventually turned into a practical example program, and although not everyone's going to call it a good example, it's a program that I'm personally happy to actually use.

Links

(Back to main page)