Submitted by Anonymous on Mon, 11/06/2000 - 18:40. Developers
How does using GNOME and GTK+ differ from using Motif with specific respect to doing object-oriented programming with C++? To using OpenGL?
I read that Motif is very unfriendly to both of these technologies because of the structure of its event loop, but I don`t understand this very well.
I am writing a program to read data from files, do various computations, then construct and display graphical depictions of
the results. For example, I may need to depict a rotatable solid object, with shape or colors changing in time to reflect statistical trends in the data. I program in C++, and plan to use OpenGL for the graphics. I will work in Linux but need the program to be as portable as possible to other *nixs using other windowing environments.
I have no Unix programming experience, leave alone X Windows, Motif, etc. A little research has shown that Motif is being superseded by GTK+, etc.
Two reasons I want to use Motif there is a good book on using OpenGL with X Windows/Motif (Kilgard, I think); and it is pretty universal.
The reason I may not want to use Motif I`ve been told that it is very unfriendly, because of the nature of it`s event loop, to object-oriented programming.
I don`t understand the latter issue, and I guess that`s what I`m trying to understand.
Thanks
Jim
I use C++ and X11 Motif to write applications and I don`t agree about its being `unfriendly` with regards to event-driven programming.
What you need is a good framework library and some knowledge of how Motif works. I have found Motif to be easier to routinely develop applications in, once you get a feel for the way to use it. It is not Motif which makes event-driven programming hard to do it`s X which imposes this steep learning curve. And you get paid back many times in return for efforts to learn it.
I recommend Douglas Young`s Prentice Hall book "Object-Oriented Progamming in C++ and OSF/Motif". I have modified the code presented in that book and use it to generate GUI-based analysis and modeling applications. The source code has been completely portable on the platforms I use (Tru64 Unix, FreeBSD, and Linux). Used this way, the object-oriented features of C++ allow you to concentrate on the part of the code that is unique in a particular application, without having to worry about low-level Xlib functions. But you still have to learn how Xlib and Xt work to use Motif with any programming language.
Just to set things straight, Motif is NOT being superseded by gtk+ or Qt. In fact, it is still the toolkit of choice in the non-hobbyist world of commercial / scientific application development. There is a good reason for this Motif is an industry-standard, rock-solid X11 toolkit. It`s filled with features that make life easy for programmers. As someone who started programming Windows and OS/2 Presentation Manager GUI programs, I find these features extremely valuable.
The event loop is hidden inside the toolkit and the widget set, so you`re not really affected by it -- the whole point of a widget set such as Motif is to hide you from such details.
Please examine the ViewKit toolkit, which encapsulates Motif widgets and common actions on them into a very good C++ framework. See http//www.viewkit.com for details.