Modern ways to write a window manager

David Given picture David Given · Apr 28, 2011 · Viewed 7.5k times · Source

I'm trying to write a window manager. (Actually, I have written an OS and a compiler, but that's beside the point.)

XLib and xcb aren't exactly nasty, at least not by, say, win32 standards, but they are definitely very old and don't lend themselves nicely to decent abstractions to make my life easier. Not only that, but there's a distinct lack of good bindings for modern high-level languages.

My question is: is all this low-level stuff really necessary these days? Do libraries exist that will encapsulate all the nasty stuff for me? I have a vague memory that the Enlightenment people had done such a thing, but can't find anything. Or do modern widget libraries like, say, GDK have enough functionality that I wouldn't need to touch the Xlib layer?

Any libraries with Java bindings are of particular interest...

Answer

Nathan Kidd picture Nathan Kidd · Apr 28, 2011

is all this low-level stuff really necessary these days?

If by "low-level stuff" you mean the C language then no, it isn't necessary from a technical standpoint; you could use XCB's XML to generate bindings for any language.

However, if by "low-level stuff" you mean dealing at the X protocol level then, yes, it is necessary (if you don't want to pull your hair out). A Window Manager must work at the X11 protocol level, so using something "high level" will only make your life difficult. In fact, XCB was created precisely because Xlib was too high-level, masking too much underneath so it was easy to make mistakes, and making it difficult or impossible to have full control. (Also, XCB is not "very old" from an X perspective; it is only in the last few years that all the major Linux distributions finally started fully using XCB.)