GENERAL MOTIF-SPECIFIC APPLICATION ISSUES
- Toolkit applications, including Motif applications, are inherently
heavier than applications that use no toolkit, such as the zip
editor. There is no getting around that. This makes it even more
important to be careful how an application uses X and Motif.
- Minimize the number of GL widgets in an application. Each GL
widget has a separate GL context, and GL context switching is
expensive. Having multiple GL widgets will visibly degrade your
performance.
- Some are concerned that deep widget hierarchies, particularly
those with complex nested geometry management (form), is slow.
Others are not so sure -- you may have to experiment with this
one yourself.
- When adding multiple items to a list, use XtSetValues on
the resources XmNitems and XmNitemCount rather than calling
XmListAddItem multiple times.
- Use gadgets. This is an area where reasonable folks have
different opinions.
- Some folks say that you should use gadgets where possible
such as for menu items.
- Other folks say that as X has handled windows better,
there is less of a win to using gadgets -- in fact in
some cases performance may degrade.
- Note that, because "map" deals with windows (and gadgets
do not have windows), you cannot map or unmap a gadget.
As a practical matter, however, this shouldn't be a
significant limitation. You generally will be mapping
and unmapping some sort of a shell (which may have gadgets
as descendants).
- Using gadgets causes extra server traffic because the widget
parent must track all events for them -- even some they
wouldn't need to track themselves if they were widgets.
- We have seen cases where lots of widgets were involved, and when
gadgets were used instead there was a very noticeable speed-up.
For now, probably the best advice is:
- If you have lots of things that could be gadgets,
it is probably worthwhile to make them gadgets.
- It is generally easy to try both ways, so if in doubt
do try it and see.