next up previous
Next: About this document Up: X WIndow/Motif Programming Previous: Motif Style

Further Journeys


This Chapter briefly highlights advanced features of Motif that have not been addressed so far in this text. We also highlight related libraries that can be used to perform advanced tasks such as three-dimensional graphics. We conclude this Chapter by highlighting books, WWW and other Internet resources where further information on many aspects of X/Motif, including the above, may be readily obtained

Motif 2.0

  The most current version of Motif is version 2.0 was released in late 1994. Motif 2.0 provides some significant enhancements and many bug fixes. However due to parallel development of the Common Desktop Environment (Chapter 1) Motif 2.0 is not yet in common circulation on the major UNIX platforms. During 1997 this situation is expected to change when new released of the Common Desktop Environment and Motif are due. All parties involved (the OSF and COSE) announced that CDE and Motif technologies will converge.

We now briefly summarise the key enhancements made in Motif 2.0.

New widgets

Several new widgets are provided in Motif 2.0. One major reason for the development of these was to introduce greater parity with the PC. Toolkits available on the PC have, typically, offered a greater functionality than Motif -- particularly in the set of controls provided. Consequently the ComboBox (a drop down list), CSText (a multiple-font text widget), Container, Notebook, SpinBox and widgets were developed. The Scale widget was also amended so that it is easier to add tick marks along the scale as prescribed by the Motif Style Guide (Chapter 13). The key features of the new widgets is as follows:

   -- The ComboBox widget combines the capabilities of a single line text widget and a list widget. It allows users to type in (or paste) information to a TextField. Input may also be provided by a list of possible choices that the user can select to complete the TextField entry. The list can either be displayed at all times or can be dropped down by the user which is why ComboBox is sometimes referred to as drop down list. When the list portion of the ComboBox is hidden, users are given a visual cue, a downward-pointing arrow next to the text field.

These drop down ComboBoxes are useful when presentation space is limited, or when users will complete the text entry field more often by typing text than by choosing the entry field text from the list.

   - The ompound tring Text widget provides the same features as the Text widget (Chapter 11) but performs all operations using the XmString (compound string) data type. In addition, with the use of compound strings, the CSText widget also supports text with multiple fonts

   -- The Container widget is a new Manager class widget. A Container allows its child widgets to viewed in three different formats:

  • an icon view, in which every contained object is represented by an icon.
  • a hierarchical view, also called outline view, which displays the object tree.
  • a detail view, a tabular view where every object appears as a line in a table and properties of the object are listed in the columns.

Through direct manipulation, Child widgets may also be selected and directly manipulated by the user. The user can select, move, copy or delete these objects, drag them into other applications, or drop new objects into the container.

The Container widget uses heavily uses the new (Motif 2.0) IconGadget. An IconGadget  can display both text and a pixmap in various combinations. It can be displayed as a either a small or large icon. When a small icon display mode the text label is displayed to the side of the icon whereas the text is placed below the icon in large icon display mode. A major advantage of IconGadget is that it takes advantage of the general gadget caching facility from Motif. If the same icon is used hundreds times, it actually allocates it once in memory and the resources are shared.

   -- The Notebook is another powerful new Manager widget. The Notebook widget organises its children into pages, tabs, status areas, and the page scrollers. The visual display of the Notebook simulates the appearance of a real notebook. It stacks its page children so that all page children occupy the same area just like real world book pages. Tabs simulates notebook tabs -- major tabs are used for dividing pages into several sections, and minor tabs are used for subdividing the sections. The page scroller is used for switching the current page to back and forth. Finally the Notebook provides tab scrollers for scrolling major and minor tabs when it cannot display all tabs. Tab scrollers are visible and enabled only when there is not enough space to display all the major tabs or the minor tabs appropriate to the page.

The Notebook widget can be a versatile tool for all kinds of applications that display organized information. It can be used for:

  • Displaying on-line documentation, with quick access to information using the tabs indexing.
  • Making visible only the necessary information. It reduces the size occupied by an application on the screen if only relevant information is displayed at any time on the current page.
  • Displaying alternatives. For example, a Dialog box for configuring a user's desktop may be implemented as a Notebook where different pages correspond to different properties such as font display, colour display and window appearance.

Typical applications that could be implemented as a Notebook include card filer, agenda and calendar applications. The Notebook also provides good support for hypertext based applications.

   -- The SpinBox widget offers a quick way of selecting, cycling, or setting a value within a range. The SpinBox always displays an increment, decrement and one or more child widgets. Choices are displayed one at at time.

C++ support


This Motif 2.0 release had the major goal of providing support for C++. This, importantly, would allow developers to more easily build new widgets. In order to support an object oriented framework Motif required new extensible features such as subclassing, traits, C++ programming support and detailed documentation. This provided many challenges.

If basic subclassing was implemented then to fully understand Motif's class methods detailed knowledge and experience of all Xt based toolkits, and access to the source code would be required. However this is not really necessary and Motif 2.0 simplified this process allowing subclassing from the Primitive and Manager classes. Extensive new documentation is also provided in The OSF/Motif Widget Writer's Guide[Ope95c]. This book provides all necessary information to subclass from Primitive and Manager and numerous examples of subclassing are provided.

Traits are a new feature with Motif 2.0. The trait abstraction was first introduced by Xerox during the development of the Star (Chapter 1). A trait , in general, is a characteristic of an object that can be expressed by a set of methods or data and can be applied to, or carried by, the object holding that trait. At a higher level, a trait implements a behavior that can be shared by different objects of a system without requiring any particular hierarchical relationship between these objects, or any particular implementation of the trait.

Traits are therefore an important mechanism that make it possible to implement a form of multiple inheritance on top of the Xt object oriented framework (which only supports single inheritance). In the Motif 2.0 model, traits are seen as light abstract classes (sometimes called mix-ins). Traits also make it possible to implement a form of polymorphism on the various widgets. For example if a trait has a setvalue method, it can be used to set values of resources that actually have a different name (e.g. a trait::setvalue() replaces XtSetValues() on multiple XmNresource names).

In true object orientated fashion traits offer the potential for the reduction of code size in applications and also augment code re-use inside Motif. A widget writer can simply decide to inherit a Trait from another widget. It then inherits the class methods implemented.

For example, consider the navigator trait implemented in Motif 2.0. This trait characterises the fact that an object can set a value between a minimum and a maximum value, regardless of the particular method used to set the value. A navigator can be implemented by a scrollbar, a scale or even a choice in the list of all possible values. The navigator provides an abstraction which guarantees that any object carrying this trait can be used to choose arbitrarily between two values. The navigator trait implements methods that allow clients of the object carrying the trait to set and get the minimum, maximum and current values independently of the implementation. In Motif 2.0 both the ScrollBar widget and the SpinBox posses the navigator trait. They can both inherit or specialize the methods of that trait.

The number of applications developed in C++ is rapidly growing and C++ programmers are now able to derive new subclasses and still have those C++ widgets usable as regular widgets with the standard API in Motif 2.0. Appendix A gives further details on how to actually write C++ Motif programs.

Common Desktop Environment (CDE) convergence


The previous version of Motif (1.2) introduced major new features such as internationalisation, drag-and-drop and tear-off menus. Those features were intended to allow application developers to produce interoperable, easy to use applications for a worldwide market. As a result, this technology was selected to become the basis of the Common Desktop Environment proposed to become an X/Open standard. The CDE also provided some new widget including the ComboBox and SpinBox and extensions to some existing widgets such as the FileSelectionBox. These new features as well as the extensions added to the CDE specifications have been added to Release 2.0.

Whilst Motif still provides its own window manager,mwm 2.0   the trend toward convergence with the CDE is apparent with many common features being developed. Many of these feature have already being address in conjunction with the CDE (Chapter 3). The key desktop enhancements provided with Motif 2.0 are similar and include window and workspace management. Window and workspace Management are closely related, they deal with the very same application windows. The window manager and and the workspace manager must communicate, so that the window manager does not systematically display any window from any application.

The major new feature provide in mwm 2.0 here is the virtual screen manager which operates in a similar fashion to the CDE. Mwm 2.0 also has some useful resources that may be used to modify the behavior of the virtual screen. Since a user may not wish to have all windows on a display moved, it is possible to pin windows down so that they remain relative to the display screen. In Motif 2.0, each workspace corresponds to a virtual screen.

UIL extensibility and portability


Since Motif 2.0 introduces an extensible object oriented framework, it was necessary to reflect these changes in the UIL language: once a developer has developed a new widget, that new widget should be usable from UIL as well. However, one does not want to have to generate a new compiler for every new widget supported. It was necessary to develop a mechanism such that the UIL compiler could dynamically incorporate new widgets to be acceptable in UIL source files and generate appropriate binary UID code.

Other Motif 2.0 Enhancements

Motif 2.0 has also made some improvements on existing widgets and performance of Motif within the X system. These are summarised below:

   -- The DrawingArea is now traversable with the keyboard, making it possible for users to select a drawing area and gets its associated functions (e.g. popup menus).

List widget
   -- A keyboard navigation facility has been added allowing the user to navigate directly to a n item by typing the first character of the item. This is, of course, mostly useful in lists organized by alphabetical order. The List widget has also being optimised for large lists and primary selection of items.

-- Once a popup menu has been created, it does not pop up automatically on the screen a button press occurs; some programming (a callback) is required to make it popup. Motif 2.0 simplifies this task allowing to be achieved automatically.

ScrolledWindow and ScrollBar widgets

The ScrollBar widget has been extended to supports a look and feel where both up and down controls are close together at one end of the scrollbar, as opposed to one control at each end.

A new resource has been added to allow more control over the visual of the slider.

Toggle widget
   -- The clarity of the visual display of the Toggle widget has been improved.

Drag and Drop
  -- A new callback function has been added to query whether any widget is a drop site or not. A generic application-wide dragStartCallback has been added, enabling an application to become aware and take action for any drag occurring at any time in the application.

Motif 2.0 also makes it possible to provide feedback with the drag icon changing in real time to convey the side effects that a drop would have if it occurred at the current location of the mouse cursor.

Drag scrolling has been introduced to allow the dragging to objects currently obscured in ScrolledWindow -- the user simply moves the cursor over the scrollbar direction control and pauses. After a (customizable) delay, the scrolled window automatically starts moving itself making the destination to appear. As soon as the user moves the cursor, scrolling stops.

  -- In Motif 2.0, this data type is extended to support not only multiple fonts, but also multiple colours and tab marks. The copying of XmStrings also has been made more efficient.

Screen widget
   -- A new resource has been added to specify whether pixmaps or bitmaps should be used in an application. A new set of resources have also added to provide control of the color schemes to the application.

Multicolour Pixmaps
  - Support for multi-color pixmap icons instead of two colors bitmaps (XPM format). Motif 2.0 requires that applications now be linked with the freely available Xpm library.

  -- Support has been added for right to left languages (Chapter .

Window Size
-- New conversion methods were added so that a user can specify a window size in inches, millimeters or typographical points.

X related performance
-- Four steps have been made to reduce the memory overheads of Motif on the X server:

Motif 2.1

Motif is still undergiong development and a new release of Motif is expected sometime in 1997. It is not expected that Motif 2.1 will extend the toolkit much in terms functionality. However there are still areas of improvements. Major issues being considered for the Motif 2.1 include:

Additional toolkits

Additional toolokits are available that provide additional functionality. They are generally built on top of Xt Intrinsics and Motif.

Three-Dimensional Graphics and PEX

  Many applications, such as CAD modelling and Virtual Reality, require three-dimensional graphics capabilities. Three-dimensional graphics can greatly enhance many other applications. For many years the area of three-dimensional graphics suffered from a lack of standardisation. However, with the development of the Graphics Kernel System (GKS) and then PHIGS (Programmers, Hierarchical, Interactive Graphics System) three-dimensional graphics standards become established. The extension of PHIGS to the X Window system (PEX)  and the adoption of PEX by COSE has established PHIGS at the forefront of these standards.

PEX basically supplies a library for C bindings to PHIGS and added support for the X server. PEX can be regarded as an extension of the X server and X protocol. There is no absolute need for Motif to run PEX applications. However, Motif and PEX do not work well together. The PHIGS toolkit provides its GUI. This GUI is does not have the look and feel of Motif nor does it provide as many useful features.

In order to ease the combination of Motif and PEX, a low level library PEXlib was developed. PEXlib provides low level access to the underlying PEX protocol much like Xlib provides access to the X protocol.

If Motif and PEX are used sensibly then Motif provides a good GUI to PEXlib which in turn renders the three-dimensional graphics. To connect Motif and PEXlib you create a Motif DrawingArea widget and the pass the widget's window ID to PEXlib in much the same that two-dimensional graphics is performed with Xlib (Chapter 17).

PEXlib is freely available. PEXlib is is released as part of X11R6 and is available in the contributed code section of X11R6. The X consortium (Chapter 1) distribute the release of X and PEXlib.

Third Party Toolkits

A number of thrird party toolkits have appeared in recent years that extend the functionality of Motif by providing a number of specialised widgets. A number of these are listed below:

XRT/table, XRT/graph, XRT/3d
-- XRT/table allows you to easily display and manipulate tables and forms in Motif applications. It supports compound strings, widgets in cells, images in cells, spanned cells, PostScript output, efficient handling of large tables, C++ and UIL.

XRT/graph displays 2-D data in virtually any type of bar chart, X-Y plot, pie chart, area graph, financial graph or logarithmic scientific chart. It has over 200 resources to fine-tune the graph's appearance and behavior. Other features include fast-updates, text areas, 3D-look on bars and pies, time- axis, user-interaction hooks and a graph builder tool.

XRT/3d displays 3-D data in surface plots, contour graphs and bar charts. It has over 140 resources, and will automatically contour and zone 3-D data using custom or default distribution tables. Users can automatically rotate, zoom and scale views. Other features include 4-D graphs, projections, histograms, text areas and user-interaction hooks.

For more information on the above contact KL Group Inc., email: or URL:

The Microline Widget Library
-- A widget library that includes Grid and Tree widgets. The Microline Widget Library was used to build the Netscape Navigator for UNIX. Unlike other tabular widgets, keyboard traversal is intuitive using the arrow keys, PageUP, PageDown, etc. It includes advanced features such as cell spanning, pixmap images in cells, cut and paste, drag and drop (with Motif 1.2), fixed columns on the top, bottom, left and right a number of selection policies, interactive row and column sizing, etc. For more information and to download demos visit the URL A free LINUX version is also available.

-- a Motif widget that presents an editable array of string data to the user in a scrollable table similar to a spreadsheet. The rows and columns of the Matrix may optionally be labeled. For more information visitly grown or shrunk by adding and deleting rows and columns at any position. For Xbae code and documentation visit the URL:

-- The LOOX dynamic graphics and data visualization package includes 2D and 3D charting widgets. The 2D Grapher widget can display up to 30 simultaneous charts of 15 different types, including bar, histogram, pie, candle-stick, high-open-low-close and others. The widget supports user interactions, automatic update and scrolling. For further information contact, URL:, email:

Other references

Throughout the long journey to learn Motif there are many useful sources of reference to guide you. In recent years the Internet  and the World Wide Web (WWW)   has established itself as a very useful source for a variety of information types. X/Motif is no exception and the major distributors of X/Motif have WWW, email and ftp address. Many sites also contain frequently asked questions (FAQs) about general and specific X/Motif queries. News updates on major and minor release of X/Motif and tutorial material is also available. This Section provides pointers to large repositories of such information in a variety of Internet and WWW distribution mediums. We begin by giving a list of relevant reference books.


A complete list of books is given in the bibliography. For ease of reference we highlight appropriate texts that deal with specific topics addressed throughout this book.

X System
  -- Details on the X system are published in many texts. These include the X protocol[NE92a], X System User Guides[QO90, QO91, MP92], general programming guides [Fla91, New92, RR92] and reference guide (including Xlib, Xt and Motif)[Ros93]. A good introduction to the X Window system may be found in [CDO92].

Xlib Programming
  -- Details on Xlib specific program issues may be found in the Xlib programming[Nye92] and reference[NE92b] manuals.
Xt Intrinsics Programming
 -- Details on Xt specific program issues may be found in the Xt programming[NO92] and reference[FE92] manuals.
  -- Details on the Motif Window Manager may be found in [QO91]. A quick reference quick to Motif may be found in [Ros93].
Motif Programming
-- A comprehensive guide to Motif 1.2 programming may be found in[Hel94a, JK94] and reference material in[Hel94b]. Good tutorial material may be found in. [Cul94, New92, RR92]. The Motif 2.0 programmers and reference manuals are also available[Ope95a, Ope95b].
Motif Style Guide
-- The Motif Style Guide is published by Prentice Hall[Ope93].
CDE Reference Material
-- The Common Desktop Technical Library is the CDE documentation set for users [Add94g], system administrators[Add94a], and application developers[Add94e, Add94f, Add94c, Add94d, Add94b, Add93b, Add93a].

-- Details on PEX specific program issues may be found in the PEX programming[Gas92] and reference[KE92]. The Power Programming Motif[JK94]also contains a chapter on PEX programming in Motif. manuals.

WWW/Ftp sites


The main WWW source of information for Motif is MW3: Motif on the World Wide Web (URL: From the home page you can connect to a wealth of resources for Motif and X Window System development. MW3 presently contains over 700 links. Virtually all aspects of Motif are covered here.

Other useful WWW links (URLs) include:

The Motif FAQ is available via ftp also at:

Mailing lists

The following public mailing lists are maintained by the X Consortium for the discussion of issues relating to the X Window System. All are hosted

A mailing list that discuses many X related issues. This list is gatewayed to the newsgroup (see below).

To subscribe to this mailing list, send mail to the request address. In general this is specified by adding -request to the name of the desired list. Thus, to add yourself to the xpert mailing list:

        Subject: (none needed)


To unsubscribe:

        Subject: (none needed)


To add an address to a specific list, or to add a specific user, you can specify options to the subscribe or unsubscribe command. This example adds to the xpert mailing list:

        Subject: (none needed)

        subscribe xpert

This is a moderated mailing list for announcing releases of non-commercial X related software, and other issue concerning the X Window System.

This mailing list is gatewayed to the newsgroup

Subscription requests should be sent to


The news group is the main news group for Motif related issues. The following news groups exist for the discussion of other issues related to the X Window System:
-- This news group is gatewayed to the xpert mailing list (see above).
This group is moderated by the staff of X Consortium, Inc. Traffic is limited to major X announcements, such as X Consortium standards, new releases, patch releases, toolkit releases and X conferences, exhibitions, or meetings
-- This news group is concerned with X applications.
-- This news group is concerned with Xt toolkit.
-- This news group is concerned with the 3D graphics extension to X.
-- The news group dedicated to Common Desktop Environment issues.

Most of the above news groups have a frequently asked question section posted regularly to the news group which provide valuable information for the novice and discuss common problems. The are also accessible from many of the WWW sites listed in Section 21.3.2

next up previous
Next: About this document Up: X WIndow/Motif Programming Previous: Motif Style