Re: porting Xlib/Motif apps to GTK+

Hi Roger,

I moved a medium-sized (100k lines) application from Motif/X11 to gtk+
a while ago.

As you say, gdk_ is a thin layer over the X11 drawing system, so
converting that is pretty easy. Gdk has quite a few helpers too, eg.
stuff for rendering a 24-bit image to whatever visual the server has,
so you can save some code there. It shouldn't be a huge effort to

A quick port of your GUI code should be fairly easy too. You'll end up
with a not-very-gtk-ish program but, as long as it works, perhaps
that's OK. Prettying it up could be a long-term, low-priority effort.
Gtk has a nice GUI builder which could save you some effort, it'd be
worth experimenting with. You could also consider using Python,
JavaScript or equivalent for the top-level GUI and only using C for
the low-level stuff. Gtk3 seems to be heading very rapidly in this

I make Windows binaries for my program with a cross-compiler on Linux.
It works really well, I can get a nightly build, including a setup.exe
installer, uploaded automatically to my server. The Windows backend
does not implement all of gdk (the stippling modes are missing, for
example) which can be annoying.

I make an OS X binary on OS X with the Quartz backend. It also works
well, though you end up with a program that looks rather out of place
on the Mac desktop unless you do quite a bit of platform-specific
stuff. Again, it's easy to package automatically as a .dmg containing
a .app.

I used to try to make binaries for the various *nix platforms, but
it's a huge effort and not very reliable. IMO a tarball plus
build-it-yourself instructions is best. If your program is useful the
distributions will pick it up and package it for you. You could
support one distribution (eg. centos6) yourself I guess.

Once you have the thing basically working you could think about more
dramatic rewriting. As you say, switching to Cairo is going to be
necessary at some point.

Good luck!


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]