Re: [gtk-list] Motif



In a previous message, Markus Sabadello says:
> I was wondering how difficult it would be to port a Motif-based 
> application to gtk. Has anyone experiences with this?

Depends on the application.  I've been porting a Motif version of my
XPostitPlus (now named XNotesPlus) to Gtk recently.  For the most part its
been pretty straight forward.  The biggest difference is the use of
resources.  In Motif you have app-defaults files.  In Gtk you have to use
.rc files, and these aren't quite as easy to use (IMHO, of course).  I also
had to write a command line parser along the lines of getopt_long() so that
I could use the same command line args in either version and still
guarantee portability (since getopt_long() isn't on all Unix platforms by
default).

Some differences I can remeber off hand:  there isn't a standard method for
setting background colors for all widgets.  Some use "bg", others use
"base".  The label widget, for example, doesn't appear to be able to have
its background set to a different color from the .rc file (although you can
probably do it programmatically using GC's).  There also seem to be 5
element arrays for bg, fg, and other colors.  I thought this might be the 3
RGB colors plus 1 alpha channel, but I don't know what the 5 element is for.

Most of the differences are mostly just a matter of learning the new API.
In general its easier (re: less code) to create a window component (label, 
text field, etc) in Gtk, but its harder to do all the things that are
handled in convenience routines in Motif.  The latter is probably just a
matter of time for Gtk - its still a young widget set.  The use of common
resources, like background colors, are not consistant across all widgets
yet.  One annoying factor is that the dialogs in GTK have the same resource
name as the main window.  My XNotesPlus main window is set to have no
borders by the window manager (fvwm).  With Motif the individual notes have a 
different resource name (they are PopUp's) so they have borders and title 
bars.  With GTK all the notes have no title bars (no matter if I make them
dialogs or popups).  I'm not sure how to get around this one yet.

And, of course, theres not printed manuals for Gtk.  (Yet.) :-)

I'm still fairly new to Gtk myself and this is just based on my experiences
so far.  I have a moderately long list of things I've noted about dealing with 
Gtk that Motif programmers might find useful.  If you're interested I'll
pass it along.  Eventually, I'll either post it on my web site or just
point folks to my XNotesPlus package (which will include it too).
-- 
Michael J. Hammel           |The Space People think factories are musical
The Graphics Muse           |instruments.  They sing along with them.  Each song
mjhammel@graphics-muse.org  |lasts from 8am to 5pm.  No music on weekends.
http://www.graphics-muse.org        Talking Heads - "Stop Making Sense"



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