Self and X Windows - The future

Russell Allen mail at
Tue Sep 13 04:24:21 UTC 2011

Hi guys,

I promised to write up a more details look at Self on X, so here it is. I want to start a discussion on this because it's important.

X Windows is used by Self for two different purposes. The first purpose is for local morphic desktop on Linux systems. The second purpose is for remote desktop sharing, so that multiple developers can collaborate on a single Self world.

X was the first gui language that Self spoke, back on Sun machines. The current OSX Cocoa/Carbon mix came after it.

The basic X Windows protocols (as implemented in haven't changed over the years since then, but increasingly Linux systems in particular have stopped directly using them. Extensions to have allowed changes to font rendering etc without updating the core protocols. 

As well, most applications on Linux no longer talk X directly, but instead use higher level libraries layered on top of X such as GTK and QT.  These libraries increasingly move towards multiple backends such as Wayland and the plan as I understand it is that X will be gradually replaced.

One immediate consequence of this process has been that the old X font system which Self uses has fewer and fewer fonts available to it, and increasingly doesn't have the integration with the rest of the system that modern GTK or QT based applications have. This is why Self 4.4 doesn't work properly on Ubuntu 11.04. My quick and dirty solution which I've implemented makes sure that we default on Linux to a font we know still exists on the current version of Ubuntu.  It looks pretty ugly but is so basic that hopefully it won't go away in the immediate future.  It's a placeholder though, until we do one of the more comprehensive solutions below.

The long term consequence is that eventually Self won't run at all on modern Linux distros.

There are a few solutions to this which come to mind:

- we can fix the immediate problem with fonts by implement the new primitives needed in the VM to use the newer Xft font system. This is a good thing to do, but won't fix our problems in the longer term. 

- we can implement the primitives and the Self code needed to target either GTK or QT rather than X. This makes us much more future proof and much more natively integrated with the Linux desktops. It doesn't however help with maintaining the remote access ability; we would have to write something like a VNC server to get that ability back.

- we can target an intermediate layer designed for gaming, such as OpenGl and OpenAL, or SDL ( which is also cross platform so might help us with Windows in the future. I think that comparable projects such as Croquet and Factor have done this?

- we can bypass the native API entirely, and implement a bridge between the existing Self canvas and a HTML canvas element - that is make a browser interface to morphic which is fast enough to be used locally. Assuming that this can be made fast and solid enough, it would also give us our remote access in an even better form than we have at the moment. This solution could even be done without adding any primitives beyond the existing socket ones. The potential downside is that the canvas element in browsers remains as I understand it slower and buggier than direct access to the system gui libraries; it might be harder to get more interesting 3D or sound or video elements into our interfaces.

All of the above solutions bind us into whatever we rely on, at least for that platform. It would be nice to write font rendering etc in Self and rely on a modern equivalent of bitblt but looking at the attempts historically by Squeak to do that I doubt we could pull it off with an acceptable quality.

This is I think critical for the further use of Self and it's something I would consider helping out with funding if someone is seriously interested in tackling it. 

I'd be interested in your thoughts.


More information about the Self-interest mailing list