[plug] Gdk errors
Russell Keith-Magee
Russell.Magee at calytrix.com
Fri Aug 3 09:58:32 WST 2001
> While speaking about GTK....
>
> How does everyone find it?
>
> Some people tell me QT is the way to go, but I dislike C++
>
> Im especially interested in GTK as a cross-platform GUI, so has
> anyone tried the windows ports?
>
> How friendly/useful are the widgets?
I like GTK+, but it does have a few problems.
Positives:
1) It's fast. I find that startup times for GTK applications are up to an
order of magnitude faster than comparable QT apps. This doesn't always hold
for Gnome apps, however. Nautilus, for example, starts much slower than
Konqueror on my box.
2) Even though GTK is written C, it's got a really nice OO infrastructure. I
would much rather use GTK+'s OO-ified C than raw K&R C anyday. Dynamic
casting with typechecking is a beautiful thing, and it requires surprisingly
little overhead.
3) The widget library is very extensive, especially if you include all the
Gnome UI classes.
4) Unlike QT, you don't require a meta-compiler. QT adds keywords to the C++
language spec to do event handling, etc. You have to run moc over your code
before you run gcc. GTK does all its magic with #defines and standard ANSI C
structures.
5) IMHO, the theming engines for GTK look nicer than the ones available for
Qt. I acknowledge that this is 100% personal taste, but this might be a
contributor to any decision you make.
Negatives:
1) Although the OO infrastructure is powerful, its convoluted. You can do
inheritance, virtual methods, event handling, etc., but you have to write a
lot of syntactic noise to do it. A basic C++ class which could be written in
5 lines of code would require almost a page of code in GTK. Admittedly, it's
all boilerplate, but it does impede readability.
2) Although there is a OO structure in the GTK "class library", there are
some instances where OO isn't being used all that well. This is especially
evident in the Gnome UI library. A lot of code in Gnome isn't 100% OO. This
may be done for performance reasons, or it may be an extension of point 1
(Doing OO for a small class requires often more effort than it is worth) - I
can't really say - but either way, you can't get the full advantage of a
100% OO system.
3) There is nothing forcing you to do OO - the facility is there, but you
can break the rules by simply
ignoring the GTK extensions. Given the overhead required to use the OO
stuff, there is often a strong incentive to do this. This is another facet
of point 2.
4) The support for Xfree 4 extensions (like the render and font antialiasing
extensions) is pretty abysmal. Whereas QT gets font antialiasing through a
recompile of the QT library, you have to completely rewrite your GTK apps to
use Pango, the new antialiased font system. This is an artifact of points 2
and 3.
5) The UI system isn't threaded at all (although many of the libraries are
thread safe). Consequently, it is very easy to lock up your UI by having a
processing routine that doesn't return quickly.
Summary:
GTK+ is good and stable for finished applications that are written properly.
However, it's not an effective prototyping tool, and it's easy to write an
application that will look really sluggish if you are not fully aware of how
to use the GTK event model. My experience with the Windows support is
limited, but what I have seen is fairly impressive.
My 2c...
Russ %-)
********************************************
Russell Keith-Magee
Software Engineer
Calytrix Technologies
Unit 9, EIR Building, Technology Park
PO Box 1173, BENTLEY 6982, Western Australia
Tel: +61 8 9362 5300
Fax: +61 8 9362 5400
Mobile: 0408 928 379
More information about the plug
mailing list