GTK+ 3.0: Getting serious.

GTK+ has come a long way. From its humble beginnings as “The GIMP ToolKit”, it is now used in a plethora of applications. In fact, GTK+ is very popular. GNOME, one of the leading desktop environment on Unix systems, uses GTK+ almost exclusively. The Gimp is built upon GTK+, of course. And there are many commercial software developers like Adobe, NVidia and VMware that decided to use it as a base for their products.

Still, there are several shortcomings with GTK+. Development of the 2.x series started back in 2002. Since then, GTK+ has ripened and aged. It has aged well, but still: its age shows.  Throughout the 2.x cycle, several years now, the developers have kept GTK+ ABI compatible. This keeps application developers depending on GTK+ very happy:  they can be sure that code linked to an older version of GTK+ continues to work with newer releases. Packages released back in 2002 will continue to work with new library releases. That’s great, because no third-party application developer likes to rebuild and repackage the whole product line, just because a new version of the underlying libraries got released and all the distribution start packaging that version. It causes work and trouble. And for commercial/proprietary developers that means costs.

The commitment not to break ABI made a lot of people very happy. But it also put very tight constraints on the GTK+ developers. It’s not that easy to add new features and remain ABI compatible. Minor features, yes. But as soon as you want to make radical improvements and need to change the exposed data structures, you run into serious trouble. It just not possible beyond a certain point.

On the 2008 GTK+ Hackfest in Berlin, Imendio’s GTK+ hackers presented their vision [1] of GTK+’s future and the reasons why they think that GTK+ has to make a step forward, embrace change and break ABI compatibility. Other GTK+ developers [2] have also voiced their opinions, listing parts of GTK+ that need serious love, but state that they don’t require breakage.
Whether or not these are the things that will mark the road to GTK+ 3.0, almost all of them need attention. And give hints to the shape of things to come.

Theming:
Theming is one major aspect of GTK+ that needs a serious overhaul. Theming in GTK+ sucks and blows big time. The initial concept of how theming works in GTK+ stems from the very first releases and never received serious love. As a result it is very difficult to do fancy graphic things in GTK+ or to make custom widgets that fit into the rest of the desktop. The funny look of Evolution’s tree headers in some themes is one symptom, but every developer with the need to write custom widgets is looking for a hard time.
There have been several suggestions on how to do that, some of them involving CSS-style theming [3]. CSS would be nice, for sure. But even the ability to paint one widget to mimick another would be a huge gain. Application-specific theming and custom layouts? Delicious.

Animations:
Although it is possible to create animations in plain GTK+, it’s not very easy to do. Out of the desire to create fancy interfaces in the image of the iPhone interface arose several GLib/GTK+ inspired libraries; Clutter, Pigment and Moonlight. All of those have drawbacks, however: Clutter doesn’t use the GLib event system, Moonlight is written in C++ (a no-go for a GTK+ library) and Pigment is in a very rough state. Still, there are very solid plans to what extent a scene-graph library might interact with GTK+ and what requirements such a library has to fulfill [4].

Canvas:
GTK+ has no standard Canvas. There is a GnomeCanvas, but it’s deprecated, not very popular and lacks some key features, like drawing GUI. Many developers resort to plain Cairo when it comes to custom graphics, but Cairo is lacking a way to draw GUI elements also. Nothing gained. There are some possible candidates [5] for a possible GTKCanvas, but none of them seems to be the right candidate. And then there is the question, if a specialised canvas is a good idea at all.
This problem might be solved with the emergence of the aforementioned scene-graph library; instead of introducing a specialised library for custom paint operations, make that library the standard way.

OS integration:
GTK+ is not limited to X11 systems anymore. There are many GTK+ applications that have been ported to Windows and enjoy a surprising popularity there; Inkscape for example has a significant Windows user base. And OS X gets more important with every passing month. Some of these applications make extensive use of operating system features. Up to now, GTK+ featured only a limited set of functions to provide access to operating system functions, but the first solutions addressing this problem are starting to appear [6].

Introspection:
One of the GTK+ buzzwords of the last few month has been introspection. Introspection allows to, well, inspect an object, its methods, public members and its inheritance. This is not only very comfortable for debugging, it also allows for very easy bindings: automated bindings for your favourite programming language? Here it comes. It might still be a while until all parts are in place, but already the results are amazing [7].

It might still be a long time until GTK+ 3.0 gets released. And in any way; GTK+ 3.0 won’t be about adding new features. There are still some mistakes of the past lumbering in GTK+. Exposed private structues, public members that get manipulated directly: things like these have to be fixed before a GTK+ 3.2 can start adding features [8].  But with some of the features, especially a scene-graph, window-independent widget placing and over-rideable paint methods for GTK+ widgets, GTK+ is starting to look very interesting again.

[1] Imendio’s GTK+ 3.0 vision
[2] Gtk+ Hackfest 2008: Day one and a half
[3] GUADEC 5 Notes
[4] New Theme API
[5] Canvas Overview
[6] libgtkhotkey 0.1, Portable Hotkey Integration
[7]
Future of GNOME language bindings

[8] GTK+ 3.0: Enabling incrementalism

42 Comments so far

  1. visitor on March 12, 2008

    interesting, thx. Could you please link references ?

  2. Emmanuele on March 12, 2008

    Clutter doesn’t use the GLib event system,

    first of all, there’s no “GLib event system”. there’s a GLib main loop, and Clutter fully uses it to integrate itself with libraries such as GStreamer and GTK+ itself.

    actually, Clutter has the same dependencies GTK+ has: GLib, GObject, Pango, GdkPixbuf.

  3. Robert Devi on March 12, 2008

    Reading the plan, it seems like a solid, gradual approach that should allow a smooth transition from Gtk 2.x(last) to Gtk 3.0 without source code changes. I like the plan.

    I notice that part of the plan is to replace all GObjects with IDL files which create the GObjects (thus allowing Gtk 2.x(last) and Gtk 3.x to share a definition even though they have different definitions).

    I haven’t used http://live.gnome.org/Vala, but from the looks of it, it seems to be precisely the sort of tool that can be used to ease the transition as
    a might good foundation for the IDL language.

    It already produces C-compatible GObjects, is planning to provide full Gtk+ binding, has getters/settings, access controls, and is rich enough to provide
    compatibility macros for the bug 2.x to 3.x if it happens.

    Of course, the full Vala might be too much for an IDL compiler, it has a few strong things going for it:
    1) It already exists, has been debugged, already used to create applications, is actively maintained, and has an active mailing list.
    2) It has documentation (important but something that takes ages to be created by programmers who really want to be doing other things)
    3) It’s close enough to C/C++/C# to be easily understandable and it’s requirement on being GObject/GObjectIntrospection compatible makes this option a possibility.
    4) It’s something that can be pointed to today as a migration path to 3.x. It’ll likely take a few years before all major 2.x apps get ported to 3.x, so getting new apps using the IDL early is extremely important in order to make the 2.x to 3.x painless (at least compared to the horrible 1.x to 2.x migration. Some Gtk 1.x are *still* not migrated).

  4. markus on March 12, 2008

    Hi,

    there are many aspects, and I must admit I could write a whole lot from a user’s perspective. There are so many important things to consider.
    Hopefully a transition will be rather slow (and smooth) from a Gtk2 to a possible Gtk3.

    I would like to emphasis on the CSS aspect though, less on the theming aspect. The point which for me is the most important one. It is actually the one I personally think is the most important one!

    === Look and Feel (and modifying this!)===

    I am using ruby-gtk ( <3 ruby ) a lot and whenever I need to design/layout widgets, I start to curse slighty and look for the shortest route to achieve an acceptable result.
    I miss my margin:5px or padding:8px, i miss text-decoration:underline, especially when I struggle with Gtk::Alignment, or use a table layout simply because I dont know of another easy way to arrange what I want to have …

    The way with CSS is very intuitive for a human brain once you read it and fiddled with it, and CSS is well known for MANY people - they could o adapt widget sets to their individual needs easily. Need pink with huge borders? Sure enough!
    Chrome glossy with fancy colours? Easy.

    Personally I would love to see this taken to a much much stronger ground within Gtk3.

    But I think a “CSS-style theming” wont be enough.

    I really mean a general CSS component based theming, one where the buttons in a web app i wrote would behave similar to how Gtk apps could behave, i.e. padding, margin, colours (which brings me to another point, it would be cool to embed Gtk apps into firefox browser. But I agree, this is a totally different topic..)

    The WWW CSS is not the be all, end all solution. I miss variables. I miss component-styled CSS, where I can group CSS statements based on widget sets too, easily (Widget A has these CSS rules, Widget B inherits from it and the user can extend from it)
    Also it did not help that CSS3 never really got realized fully… The -moz CSS compoments at times can really be cool! Just not standard….

    But please please please please please please please PLEASE no gtk rc_files !

    I know what is possible with them to some extend, saw a few widgets like a special border on a button - but I CAN NOT STAND HOW THEY LOOK. :(

    I will never embrace something like:
    MyButton::focus-line-width = 3
    MyButton::focus-line-pattern = “\10\2″

    Yes, denoting a pattern may be nice and it can be useful but it also misses the CSS aspects out!
    If i could have a vote I would make it similar to CSS and then use all the extra aspects you would need there, like focus-line-width

    (Besides it is IMO not good to tie it to a specific class in Question, such as “MyButton” anyway. CSS like themeing should be component independent in its core set. Introspection is also about making objects more transparent)

    Ok, sorry if that sounds confusing, I hope you can make sense of this. Hopefully you guys can put up updates every now and then to the whole process!

  5. markus on March 12, 2008

    Sorry, I forgot one thing :)

    The way about CSS is also about empowering more users to style the compoments in ways they see fit. i.e. how firefox allows you to override the chrome .css files

  6. ohxten on March 12, 2008

    Sounds great to me. GTK is a superb toolkit with _excellent_ documentation, but there are a few annoying shortcomings (at least for a developer like me).

    A few things I would like to see is re-supporting Win9x (impossible, currently, with cairo), speed/memory improvements (we all know GTK ain’t the least-latent, lowest memory-usage UI API on the block), etc.

    Let’s just hope that GTK becomes faster and more lightweight with the 3.0 release, and not the other way around.

  7. Jerk on March 12, 2008

    GTK+ 3.0? Sounds like Qt =)

  8. Another Jerk on March 12, 2008

    Sounds like XUL =)

  9. philn on March 12, 2008

    “Pigment is in a very rough state”

    Could you be less vague please?

  10. TejWC on March 12, 2008

    And OS X gets more important with every passing month. Some of these applications make extensive use of operating system features.
    Does that mean compiled GTK apps on OSX will finally use the proper top menu bar?

  11. raphael on March 13, 2008

    Hi philn,

    pigment has no scene graph and there is no way to embed GTK+ widgets. Both features are planned, though. The interpolation system also lacks some techniques, like splines.

  12. phuongnana on March 13, 2008

    This post is very hoting, and this blog is high ranked in
    the top blogs report
    . You can
    earn some money with a good blog
    like this.

  13. Mikael Hallendal on March 13, 2008

    @TejWC, it is up to the applications to handle that but we have made it very simple to do with, you can see our GTK+ Mac OS X integration page for information on how.

    Thanks for the write up, I agree that it would be helpful if the links could be turned clickable.

  14. H3g3m0n on March 13, 2008

    I would love to see decent ARGB/Transparency support for everything.

    For instance if you want to make a GTK theme, its impossible to make the back of the Window transparent. Murrine theme engine recently did quite a lot of work in this area, but it still requires applications to be manually patched. It would be nice if it was just supported in GTK.

  15. CoolGuy on March 13, 2008

    That is good news. Ability to use any scripting language to make widget would be nice !

    All the best !!

  16. CoolGuy on March 13, 2008

    A high level language like ruby or python or vala or maybe C++ will be really a good move. Java and mono are no no.

  17. Simon on March 13, 2008

    What about multitouch support?
    As I understand, Xorg support for multiple inputs is right around the corner, so the next step would be for the toolkits to support it.

    Cocoa on Mac OS X is already there with Leopard and CocoaTouch for the iPhone, and as input devices change and the traditional keyboard+mouse fades away, this approach to interaction will give way to drastic improvement in UI design. There’s no reason for GTK+ to lack in this area.

    - Simon

  18. Mikael Hallendal on March 13, 2008

    @CoolGuy, not sure what you mean exactly but you can already develop your own widgets in scripting languages such as Python and Ruby.

    Do you mean writing a widget in a scripting language and use it from a C application. That requires more work but can be done.

  19. sapphirecat on March 13, 2008

    On theming: someone could stand to clean up the theme names as well. I once started making a GTK theme, only to discover that the tabs which are not the currently active one are all drawn with ‘active’ style (also used for “the mouse is down on you right now” for buttons). When I realized I’d be dealing with a heaping mass of special-cases, and there was no “theme test demo app” which displayed all the widgets for me to see my work, I quit. Life is too short for that.

    Nowadays I’m using the Mist engine with KDE’s color scheme applied. It’s a lot less painful.

  20. [...] GTK+ 3.0: Getting serious. « Federkiel GTK+ 3.0: Getting serious. « Federkiel [...]

  21. PPC Developer on March 13, 2008

    I would like to see a (WinCE) PocketPC port of GTK.

    I would dearly love to be able to drop MFC into the junk-bucket, and deploy a GTK+ user interface on Windows, WinCE, & Linux.

  22. CoolGuy on March 13, 2008

    i mean desktop widgets

  23. any-nym-mouse on March 13, 2008

    “Future of GNOME language bindings” sounds like Kross :)

  24. rm42 on March 13, 2008

    It would be nice to be able to rename files and folders in the File Dialogs.

  25. solid_liq on March 13, 2008

    You forgot one very important thing: a memory management system that works. If you have this, then maybe I won’t have to restart X every few days to reclaim all that leaked memory.

  26. philn on March 13, 2008

    Raphael,

    Pigment has GTK+ support already, since few months… You can embed any Pigment app in a GTK+ window

  27. Mikael Hallendal on March 14, 2008

    @philn, how is the embedding done?

  28. [...] GTK+ 3.0: Getting serious. « Federkiel (tags: linux) [...]

  29. raphael on March 14, 2008

    philn,

    Ups, I didn’t get that one, sorry! :D It didn’t see it in the changelog. Do you have some links for more information? Some examples?

  30. Matthew Holloway on March 15, 2008

    Presumably you mean that Moonlight is written in C#.

    There’s also that idea that Moonlight is licensed to Novell for 4 years and may not be compatible with GPLv3s patent provisions.

  31. Cyber on March 15, 2008

    Why not use QT ? It has all you need

  32. [...] bien, la empresa Immedio, especializada en el desarrollo de Software para Gnome, ha propuesto unas ideas de cómo implementar GTK+ 3.0: qué cambiar, qué eliminar, y qué añadir. Como comentan en un informe, GTK 2.x esta en el final [...]

  33. bubu on March 17, 2008

    I think for GTK3 they need to massively solve the ZILLION of library dependencies that GTK+ needs. Atk, cairo, pango, pangocairo, gtk2×11, libxml2, zlib, pnglib, tifflib, jpeglib… and also to make glade and gtk–(C++) part of them(which adds even more depencies… libglade2, libglademm, gtkmm, pangomm, cairomm, etcccc! )

  34. bubu on March 17, 2008

    Cyber posted:
    [quote]Why not use QT ? It has all you need[/quote]

    Because Qt is not free for commercial or closed-source usage… but GTK+ is.

  35. Gargh on March 18, 2008

    Oh ye Gods. CSS?

    No. Bad. Stop it.

  36. Mack on March 18, 2008

    I think it’s time to abandon the sinking ship that is GTK. I think the entire system needs to be rethought (and renamed) and given some serious effort before it will be worth continuining development on. Carrying on the current trash of GTK2 into 3 would be a crying shame.

  37. arjun on March 19, 2008

    Isn’t GTK the Gnome Toolkit?? :)

  38. Mack on March 19, 2008

    @arjun,
    No, it began as the GIMP Toolkit

  39. philn on March 22, 2008

    @Mikael,

    AFAIK the Pigment’s window is embedded in the gtk+ window via its window id

    @Raphael,

    https://code.fluendo.com/pigment/trac/browser/trunk/pigment/examples/gtk.c
    http://base-art.net/Articles/92/

  40. raphael on March 22, 2008

    @philn,

    that’s not exactly what I was talking about. I know that you can embedd a Pigment canvas into a GTK+ application, but there is no way to put a GTK+ widget on a arbitrary place on the Pigment canvas and have it painted, at least none that I know of.

  41. philn on March 22, 2008

    Ok I misunderstood you ;) You’re right, it’s not possible to do that ATM. But it sounds like a feature Pigment should provide. Definitely worth a ticket, IMHO.

  42. [...] In a largely prophesying look, Federkiel looks into possible and developing parts of GTK+ 3.0. GTK 3.0 - Get Serious [...]

Leave a reply