Projects:GTK on DirectFB
|Error creating thumbnail: convert: unable to open image `/var/lib/mediawiki/images/8/8d/Gimp.png': @ error/blob.c/OpenBlob/2587.|
convert: unable to open file `/var/lib/mediawiki/images/8/8d/Gimp.png' @ error/png.c/ReadPNGImage/3238.
convert: missing an image filename `/var/lib/mediawiki/images/thumb/8/8d/Gimp.png/200px-Gimp.png' @ error/convert.c/ConvertImageCommand/3011.
|Error creating thumbnail: convert: unable to open image `/var/lib/mediawiki/images/3/34/Gimp-multi.png': @ error/blob.c/OpenBlob/2587.|
convert: unable to open file `/var/lib/mediawiki/images/3/34/Gimp-multi.png' @ error/png.c/ReadPNGImage/3238.
convert: missing an image filename `/var/lib/mediawiki/images/thumb/3/34/Gimp-multi.png/200px-Gimp-multi.png' @ error/convert.c/ConvertImageCommand/3011.
The GTK on DirectFB (shortly GTK-DFB from now on) project consists in a GDK library which acts as a glue between the GTK+ toolkit and the DirectFB windowing system (similarly, the GTK-X11 libary acts as a glue between GTK+ and X11 and GDK-WIN32 does the same for Windows GDI).
Because GTK-DFB is meant for use in embedded applications rather than desktop, it has not all the features the X11 or WIN32 GDK backends do, but it is mature enough to run even complex applications like the GIMP.
This wiki page contains an howto about building the GTK+ libraries with the DirectFB backend enabled, in order to operate atop of the DirectFramebuffer windowing system.
At the moment of the writing of this document, the most recent stable release of gtk+ was 2.10.13: because newer versions may be available when you read this page, please make sure to always build a recent gtk+ release.
For historical reasons information has been left at the bottom of this page for people who want to get the old GTK-DFB 2.0.9 running: please notice that that GTK-DFB version is really out of date and is no longer maintained.
The DirectFB flavour of GTK+ can be found precompiled in the packages repositories of some Linux distributions. If your distribution is not listed among those below, you need to build everything by hand as explained in the successive sections.
If you're a Debian user, you can install the libgtk-directfb-2.0-0 binary package and its -dev companion libgtk-directfb-2.0-dev.
If you're an ArchLinux user, you can try the gtk2-dfb package available in the ArchLinux User-community Repository . Note that you will also need the linux-fusion, directfb and cairo-dfb packages availables in that repository too.
Building from sources
In order to get everything working you need a working framebuffer: make sure that framebuffer support is built into your kernel ( kernels provided today by the many popular Linux distributions include framebuffer support ) and that it is properly turned on at boot time by passing the appropriate parameters to the kernel.
On i386s, you should pass something similar to the kernel
while on PowerPC systems you should pass something like
Other than a recent DirectFB version ( you need DirectFB >= 0.9.25 ), a complete GTK-DFB environment is composed by the following libraries (system libraries like libc are of course needed but are not listed here):
- GTK+ - The GTK+ library which includes the GTK-DFB backend
- Cairo - The 2D vectorial drawing library that GTK relies upon starting from version 2.8.0
- Pango - GTK+ font rendering library
- GLib - A Library that extends libc functions
- ATK - GTK+ accessibility toolkit
Notice that the while Glib and ATK are indipendent from the windowing system underlying GTK+, so you don't need to recompile them and stock òibraries provided by your distribution will do.
Building the Requirements
First, make sure you have DirectFB ( >=0.9.25 ), ATK ( >=1.0.1 ) and Glib ( >=2.13.1 ) installed togheter with all the development stuff.In a Debian system you must install the
libglib2.0-0 libglib2.0-dev libatk1.0-0 libatk1.0-dev libdirectfb-0.9-25 libdirectfb-devset of packages.
Then open a new terminal and set up the following variables:
export PREFIX=/usr/gtkdfb export LD_LIBRARY_PATH=$PREFIX/lib export PKG_CONFIG_PATH=$LD_LIBRARY_PATH/pkgconfig export CFLAGS="-g"
This allows to install GTK-DFB runtime-libraries and developement files in a place (/usr/gtkdfb in this case) where they don't mess up with the standard set of GTK+ libraries.
Next, get cairo and build it with the DirectFB backend enabled:
mkdir -p $PREFIX/src cd $PREFIX/src wget http://cairographics.org/releases/cairo-1.4.6.tar.gz tar -xvzf cairo-1.4.6.tar.gz cd cairo-1.4.6 sh configure --prefix=$PREFIX --enable-directfb --disable-xlib --disable-win32 make make install
Do the same for PanGO
wget http://ftp.acc.umu.se/pub/GNOME/sources/pango/x.y/pango-x.y.z.tar.bz2 tar -xvjf pango-x.y.z.tar.bz2 cd pango-x.y.z ./configure --prefix=$PREFIX --without-x make make install
You can now build GTK-DFB
cd $PREFIX/src wget http://ftp.gnome.org/pub/GNOME/sources/gtk+/2.10/gtk+-2.10.13.tar.bz2 tar -xvjf gtk+-2.10.13.tar.bz2 cd gtk+ ./configure --prefix=$PREFIX --with-gdktarget=directfb --without-x make make install
Hey presto! If everything went according to plan, you have compiled GTK-DFB, congratulations!
To see if it worked, try running (*as root*, unless you've compiled DFB with a specific option which allows unprivileged users to access the framebuffer):
export LD_LIBRARY_PATH=/usr/gtkdfb/lib /usr/gtkdfb/bin/gtk-demo
If all went well you should see a GTK window on a blue background. Don't be worried that the window has no Frame - after all you are not running a Window Manager, right? The following commands are provided by DFB to help you handle the windows:
- Meta + Mouse Movement = Move the window
- Meta + C = close the window
- Meta + X + Mouse Movement = Change Window stacking order
Meta = Windows Key on most desktop Systems. Use the Meta + C command on the main window to quit the demo.
Chinese Beta Testing on Directfb
If you get directfb and gtk setup, now you can move on the vte and scim so you can get a chinese terminal.
Compiling applications against GTK-DFB - the GIMP
To compile a generic GTK+ application against your freshly built GTK-DFB libraries, always remember to issue
export PREFIX=/usr/gtkdfb export LD_LIBRARY_PATH=$PREFIX/lib export PKG_CONFIG_PATH=$LD_LIBRARY_PATH/pkgconfig
before launching configuration scripts. You may also need to replace all the occourrences of <gtk/gtkx.h> with <gtk/gtk.h> in your headers/source files and make sure you use the gtk+-directfb-2.0.pc file when calling pkg-config to get the correct compiler and linker flags for GTK+-DirectFB:
pkg-config --cflags gtk+-directfb-2.0 pkg-config --libs gtk+-directfb-2.0
The GIMP is one of the most complex GTK+ application ever written, so it is a good testbench to evaluate the capabilities and the soundness of GTK-DFB. Proceed as following:
export PREFIX=/usr/gtkdfb export LD_LIBRARY_PATH=$PREFIX/lib export PKG_CONFIG_PATH=$LD_LIBRARY_PATH/pkgconfig wget ftp://ftp.gimp.org/pub/gimp/v2.2/gimp-2.2.10.tar.bz2 tar -xvjf gimp-2.2.10.tar.bz2 cd gimp-2.2.10 ./configure --prefix=$PREFIX --without-x --without-libtiff --without-libmng --without-libexif --without-aa --without-gtkhtml2 --without-librsvg --without-lcms --disable-print --enable-debug make make install
Now run /usr/gtkdfb/bin/gimp and have fun!
GTK-DFB: Older Information
Some infos on the 2.0.9 version of GTK-DFB here: 
This is a very out of date version of GTK-DFB full of bugs and no longer maintained and is mentioned here for historic reasons only; you should definitely use GTK mainline sources
How it works
-- The Gdk-directfb implementation is using GetSubsurface to create all CHILD widgets ( button, etc ).
Yes, each GdkWindow that is not a top level window is realized via GetSubSurface(). A sub surface is just another graphics context with a fixed x/y offset and a limited clipping region. This limited region is defined during GetSubSurface() and is limited to the region of the (sub) surface which is used to create the new sub surface.
-- I was wondering what is the plan to deal with layered widgets ( i.e. widgets that cover each other ) ? Currently this doesn't seem to work, and some gtk code that works fine in X11 is not working with dfb. I couldn't find the code implementing z-order for subsurfaces or surfaces.
There's no code in DirectFB dealing with the z-order of sub surfaces, because there is neither an order nor any hierarchy except the capability to be a sub surface.
The order is defined by the application, or in this case by GDK.
-- I tried to change the code to use CreateSurface or CreateWindow for the childs - but so far I get the same problem, no layering works.
CreateWindow() and CreateSurface() allocate extra memory which would grow quickly if they are called for each child window. In X11 only the root window is allocated in memory, other windows are embedded in this window like the sub surfaces are in DirectFB toplevel windows.
For further information see the directfb-dev mailing list archives here: http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev
Performance and memory requirements
No serious testing has been done yet about GTK-DFB >= 2.8.0 performance and requirements, but old datas are still available about GTK-DFB 2.0.x here.
References for the GTK-DFB project
Here is a list of useful resources on the web related to the GTK-DFB project
- http://svn.gnome.org/viewcvs/gtk%2B/trunk/gdk/directfb/ Sources for the DFB GTK backend as in GNOME's SVN server
- http://bugzilla.gnome.org/buglist.cgi?query=component%3Adirectfb+product%3Agtk%2B+ GTK-DFB bugs page in Gnome's BTS
- http://cvs.gnome.org/viewcvs/*checkout*/gtk%2B/gdk/directfb/README?rev=1.2 README file from the DFB backend in CVS.
- http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev firstname.lastname@example.org mailing list archives, where most of the developement of GTK-DFB takes place.
- http://mail.gnome.org/archives/gtk-devel-list/ email@example.com mailing list archive, where GTK+ mainline developement takes place.