Thoughts on Gtk# and P.Net’s SWF
I thought I’d talk a little bit about my experience creating a Linux/Gtk frontend to Meshwork…
The biggest challenge while writing the Gtk client has really been “I really don’t feel like doing all this again…”
All platform-independent code is in the libMeshwork library, but that still leaves of platform-depended code that has to be re-written. Because of this you might wonder why I am not developing meshwork for DotGnu Portable.net (another free .net platform), which is working on a System.Windows.Forms implementation.
What they have done is written a low level Xlib wrapper that gives them a drawing enviroment, then written a complete System.Drawing library that uses it, then using that written managed controls mimicing everything in Microsoft’s SWF class. Because of the layers, a windows application can be compied over to a linux box and dotgnu will automatically use Xlib to render the controls in the unmodifed program, rather than the Windows APIs like Microsoft.NET.
Java developers will notice this is exactly how “swing” works, and anyone who has ever used swing before will notice “swing sucks!”.
The problem with this method is integration and consistancy. No matter how hard you try, these wrappers never look, function, or feel as good as the originals.
The “look” aspect is especially apparent in windows where you can always tell if a program is using Gtk with the wimp theme engine, qt using a windows theme, wxwindows, etc. Buttons are slightly the wrong size or color, fonts dont look exactly the same, etc.
Funcionality is even more important. For the longest time Gtk applications in windows were not dual monitor friendly. Windows, tooltips, and other non-toplevel-windows would appear on the wrong monitor, causing a great annoyance. Menus in general do not behave exactly the same as windows menus which can drive users crazy who are used to a specific behavior.
While both these examples use Windows, the exact same thing happens on a linux based system. For example there are several Gtk theme engines that use the active Qt theme engine for drawing. As with Gtk’s wimp theme, you can always tell that they are not the same.
DotGnu Portable.net’s SWF will be no exception to this. I say will because there is currently no theming support but I know that it is being developed, using Qt actually.
Here are two official screenshots of both mono and pnet’s IDE’s:
![]() |
![]() |
While as stated preveously pnet does not yet do theming, anyone who has used gnome before can tell instantly that portable studio looks NOTHING like any other native application on the system, and quite honestly appears worse than any theme could possibly hope to fix. Monodevelop on the other hand, which uses Gtk#, fits perfectly in with the rest of the system.
Swing and SWF’s appearance is emulated, Gtk# is as real as any native application could ever wish to be.
Mono is also working on an SWF implementation using winelib, however they are promoting it more as a way to move people away from commercial operating systems rather than saying everything should be written for it. Mono, Gnome, and Novel are all promoting Gtk# in their applications and I think this is a great move.
The main point is that Swing and SWF’s apperance is emulated, Gtk# is as real as any native application could ever wish to be. Swing and SWF use intermediary drawing to make things appear to be the same, but they fool nobody, they will always act different, and will always cause usability problems.
Gtk apps are known for their simplicity and cleanness (hm, is that even a word?). Gtk# not only gives me that but it also gives me access to all the other things that the gnome desktop is built off of such as gconf and gnome-vfs.
Gtk# is by no means perfect. Since it wraps the C API there are quite a few things that arent as object-oriented as they could be (using ‘out’ instead of return values is a big one), but it’s not difficult to get used to.
I hope to have a working release of the linux meshwork client soon, which should be complete with the network map everone has grown to love. :)
Categorized as Technology/Software Development, Technology

