Question

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...

Was it helpful?

Solution

This is a late answer so maybe it doesn't have much relevance anymore but I'll post it anyway since other people might be looking for it...

I have asked myself the same question and came to the conclusion that there exists no such thing, especially not in Java. While certain widget toolkits, like qt, offer you the possibility to use an existing display struct and create widgets out of existing xlib window handles, you'll still have to use xlib/xcb to do the nasty job of communicating with the X server for wm specific operations. Other libraries, as stated by others, like GDK and the enlightenment also offer a pretty good job of basic abstraction.

Still, I wasn't happy with the fact that all of these use C/C++ and sitting on my lazy ass waiting until somebody did the work for me in Java wasn't an option, I started writing my own library that allows you to build your own modular WM, in Java. https://github.com/Zubnix/trinityshell

OTHER TIPS

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.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top