Getting the hang of a new gtk+ feature

For some time now gtk+ offers redirecting widgets, so the rendering happens offscreen only. That is a mandatory feature for doing some interesting things with UI-elements. With the source-distribution of gtk+ you get a huge collection of coding-examples. There is also an example for offscreen widget-rendering. Unfortunately this is a very basic and boring example. It does not really demonstrate the additional possibilities now available in gtk+ very well. Since I need to make use of this new feature in gtk+ in the near future, I had to create my own example, which is much closer to the application-need I have.

Here’s a little show-off screencast for your viewing-pleasure…


(click to play back, ogg/theora, ~1.1 MBytes)

P.S.: Yes, usually I type much faster.

23 Responses to “Getting the hang of a new gtk+ feature”

  1. anonim Says:

    very cool

  2. zodmaner Says:

    Funky indeed. :D

  3. jonathan Says:

    I want it.

  4. john Says:

    Hiya,

    Can you explain the difference between "composited child windows"

    1) http://bugzilla.gnome.org/show_bug.cgi?id=412882

    Which AIUI is letting the application draw its children, and offscreen rendering

    2) http://bugzilla.gnome.org/show_bug.cgi?id=318807

    Which AIUI is the more efficient way to implement (1), needed for canvas support, and not yet finished. Either that or I am completely beside the point, so please correct me…

    John

  5. Carl Says:

    So if GTK+ has off-screen rendering, is there anything standing in the way of GL-accelerated GTK themes?

  6. iain Says:

    Umm, the offscreen rendering patch is neither finished nor included in the main GTK+. Where did you get your "source-distribution of GTK+" that has this in it?

  7. Emmanuele Bassi Says:

    offscreen redirection is not available in gtk+ trunk, but just as a patch that’s neither complete nor heavily tested. I’m pretty sure mirco knows this, but just as heads up for everybody else. ;-)

  8. john Says:

    To continue on my comment from above, which approach are you using here?

  9. Paula Says:

    Nice Work!
    What did you plan in the near future :)

  10. Wesley S Says:

    Does this work the same way as ‘Widgets on the canvas’ in Qt 4.4 ?
    Anyone know the difference between this and the ‘Widgets on the canvas’ project of Qt?

    Things like this are possible in Gtk+ too now? http://labs.trolltech.com/blogs/2007/11/22/widgets-on-the-canvas-integrated/

  11. Luca Says:

    Wesley S,
    something like this?

    http://njpatel.blogspot.com/2007/11/i-think-i-just-found-another-dimention.html

  12. Alberto Ruiz Says:

    Erm, where’s the code?

  13. Munchkinguy Says:

    Where can I get that wallpaper?

  14. Glynn Foster Says:

    humina humina humina - nice work dude :)

  15. Alexander Larsson Says:

    That is just with the drawing redirection part of the offscreen patch.

    With the full patch you get input redirection for transformed widgets too.
    Check out this screencast i did three years ago when working on the offscreen patch:
    http://people.redhat.com/alexl/files/offscreen3.html

  16. MacSlow Says:

    @ Carl: Hm… not without a lot of work. Right now the best approach available to use would be sticking this into clutter & Co (demonstrated by Neil J. Patel some weeks ago).

    @ iain: I use gdk_window_set_composited().

    @ Emmanuele B.: Indeed it’s not the full deal yet, but it’s close.

    @ john: The one from http://bugzilla.gnome.org/show_bug.cgi?id=412882

    @ Paula: Fun things as always.

    @ Wesley S.: No that’s not easily possible yet. But it’s part of the solution to get something like that working.

    @ Alberto R.: Patience my friend… it will come.

    @ Munchkinguy: That’s https://wiki.ubuntu.com/Artwork/Incoming/OranSun

    @ Glynn F.: Thanks man!

    @ Alexander L.: Indeed I have not looked into input-redirection yet. That stuff is three years old already… whee :) BTW, I’m a bit confused about your and Ryan "desrt" Lortie’s work regarding the whole offscreen/redirection in gtk+. Who did what now?

  17. sxpert Says:

    nice and cool, but pretty useless :-)

  18. Alexander Larsson Says:

    MacSlow:
    desrt did the gdk_window_set_composited() stuff. My code is different and doesn’t use XComposite, instead it basically just wraps all Gdk drawing ops and redirects them.

    The offscreen patch is at:
    http://bugzilla.gnome.org/show_bug.cgi?id=318807

  19. Johannes Says:

    This is really cool! I hope we can get some more (useful) bling to GNOME in the future. Not fully sure yet where it could be useful…

  20. MacSlow Says:

    @ Johannes: It’s not really about the bling, but the things possible now that we’re able to redirect widget-rendering offscreen. You’ll see what I mean sooner or later :)

  21. Tomasz Says:

    GTK+ web 2.0 style… just LOL :)

  22. kamallneet Says:

    Excellent!

  23. jc_sandrea Says:

    Can this de done with pygtk and cairo? and if so can someone please do it and post it…

Leave a Reply