Monday, January 3, 2011

Multiple backends for GTK+

I have to blog about this before the other Kristian finds out and beats me to it. Kris wrote about the new GDK backend work that Alex Larsson started and Benjamin Otte and Matthias Clasen finished. The backend work lets us compile several GDK backends into GTK+ at the same time. Over the holidays I was able to dust off my Wayland backend work for GTK+ and bring it up to date with all the cleanup that's been going on and make it work with the multi-backend stuff. With a little patch to the build system, it is now possible to actually build multiple backends, and adding a Wayland backend on top of that lets us try out the new multi-backend functionality:

The screen shot shows the testgtk application running under X (that's the window with decorations) and under Wayland (using the X based compositor, sort of like Xnest but Wayland nested under X instead). The two testgtk windows come from the same application linking to the same GTK+ library. The only difference is that the Wayland instance was started with the GDK_BACKEND environment variable set to "wayland".

I moved my wayland backend branch to the upstream gtk+ git repository, but it's still very much a work in progress. In fact, I'm using testgtk in the screenshot above, because gtk-demo currently doesn't work in the Wayland backend. But like Kris mentions in his post, the cleanups that has landed in gtk+ recently makes it a lot easier to work with and port to other window systems. And Wayland itself is a lot easier to run these days, all the custom branches of mesa, libdrm etc and kernel patches that were necessary a year ago are now upstream. Fedora rawhide has all the packages required to build and run Wayland and Bryce Harrington maintains a Wayland PPA for Ubuntu (only maverick for now). Or you can build it yourself

And by the way, Wayland moved to freedesktop.org hosting recently: wayland.freedesktop.org. We now have web pages, a real mailing list, #wayland on irc.freenode.org and an official looking git repo.

10 comments:

Anonymous said...

is there anyone actively working on the non drawing parts????

Unknown said...

Wayland and wayland compatibility seems to be walking much faster than I thought. How long do you expect till we'll be able to run a full gnome session under wayland?

Nobu said...

Now we just need some window managers that work on Wayland so we can start using it (in all it's potentially unstable, incomplete glory). ^.^

(or, does the default Gnome WM work already?)

Anonymous said...

@Marco - quite a while, I suspect. Getting the basic graphical toolkit to run on multiple backends is a big step, but there are a lot more pieces after that.

The use of X session management, for example, or Xinerama / Xrandr for screen layout/configuration. Or supporting the myriad keyboard layouts of XKB, or the XScreenSaver extensions, etc, etc.

In short, Gnome uses a large number of native X libraries, the use of which would need to be replaced to work under Wayland. Not only that, but those applications would need to support both the X libraries and Wayland equivalents, picking the right one to use at runtime. Not a small problem.

Kristian Rietveld said...

Dang! I have been beaten! Perhaps I should port Wayland to OS X and beat you with a triple-backend build :)

Anonymous said...

There is ongoing work for Qt and for KWin to eventually bring them to Wayland.

Anonymous said...

@Anonymous
How well does the Qt-port already work?

Anonymous said...

I would just like to say... THANK YOU!!! Thank you, thank you, thank you!!! For all of your hard work, and for all the amazing FOSS projects you keep giving to us, the FOSS community and the World. I wish you and your family all the best!

Ikem said...

Sorry, but I don't get what's so fancy about it..

GREG BATMARX said...

Wayland is the future, as it is in another level the KDE.
I hope that both will cooperate perfectly and that the future Linux will be based on wayland as well as on KDE.
And that QT will be fully compatible with wayland.
Kristian!Thanks for your hard work that changes for the better the Linux world!
And I hope that more and more skillful persons will join your efforts...