Release 1.2 of the Motif toolkit introduces a number of new features, as well as many enhancements to existing
functionality. This section summarizes all of the changes in Motif 1.2 and refers you to other sections in the book for
more detailed information on specific changes. We also describe the changes that we made to the example programs
in the book to make them accurate with respect to Motif 1.2.
4.5.1 General Toolkit Changes
Many of the changes in Motif 1.2 affect the functionality of the toolkit as whole, rather than individual widget classes.
This release demonstrates performance improvements, as the code has been reorganized to improve locality and
dynamic memory usage has been reduced. The toolkit also benefits from the improved performance of the X11R5
translation manager. Motif 1.2 provides a new header file, <Xm/XmAll.h>, that includes all of the public header files
for the toolkit. The <Xm/ExtObject.h>, <Xm/Traversal.h>, <Xm/VaSimple.h>, and <Xm/VendorE.h> header files that
are present in Motif 1.1 are obsolete in Motif 1.2. The addition of internationalization capabilities is one of the major
enhancements provided by Motif 1.2. An internationalized application can run in different language environments
without any modification. Most of the support for developing internationalized applications in Motif is based on
features provided by X11R5. Xlib provides support for internationalized text output, interclient communication, and
localization of the resource database, while Xt handles establishing the locale. See Section #slangproc in Chapter 2,
The Motif Programming Model, for more information on establishing the language environment in an Xt−based
application; refer to Volume One, Xlib Programming Manual, for a description of the internationalization features in
X11R5.
The Text and TextField widgets have been modified to support internationalized text input and output; see Section
#stexti18n in Chapter 14, Text Widgets, for more information. The Motif routines that manipulate compound strings
and font lists have also been updated for Motif 1.2. See Chapter 19, Compound Strings, for details on the new API for
XmString and XmFontList values. The ability to transfer data using the drag and drop metaphor is another major
new feature in Motif 1.2. Drag and drop allows the user to select a data source, drag the data around on the display,
and drop the data on a new location. The drag and drop mechanism handles data transfer both within and between
applications. The Label widget and its subclasses, the List widget, and the Text and TextField widgets all provide
built−in drag and drop capabilities. The toolkit also provides some new objects and routines that can be used to
implement custom drag and drop functionality. In Chapter 18, Drag and Drop, we describe the Motif drag and drop
model and the objects that implement it, and we present some examples of providing custom drag and drop
functionality in an application. Motif provides a new feature in menus that allows them to be torn off and displayed in
separate windows. Tear−off menus make it easy for the user to make repeated selections from a menu. Normally,
when a menu is posted, it is only displayed until a selection is made, and then it is removed. If the menu has been torn
off, it is placed in its own window and remains available for the user to make multiple selections. The tear−off
functionality is activated by a special tear−off button in the menu. The button displays a dashed line to indicate that
the menu can be torn off, much as a coupon is torn out of a newspaper. Tear−off functionality is provided for all of the
Motif menu types; it is controlled by the XmNtearOffModel resource of the RowColumn widget. See Section
#stearoff in Chapter 15, Menus, for a more complete description of tear−off menus. The new Display and Screen
objects store per−display and per−screen resources and data. These objects essentially provide a way for the toolkit to
keep track of information about the display and the screen that it needs to access frequently. When Motif creates the
first shell on a particular display or screen, it creates a Display or Screen object automatically. An application can
retrieve the Display and Screen objects using XmGetXmDisplay() and XmGetXmScreen(), respectively. Values
for the resources defined by the Display and Screen objects can be set in a resource file or in a program using
XtVaSetValues(), and they can be retrieved using XtVaGetValues().
The Display object defines resources that an application can set to control the behavior of the application on the
display. The XmNdragInitiatorProtocolStyle and XmNdragReceiverProtocolStyle resources
specify the protocol used during a drag and drop transfer, as described in Section #sdragprot, while
XmNdefaultVirtualBindings sets the default virtual bindings for the display. For a complete description of
the Display object, see the reference page in Volume Six B, Motif Reference Manual.
4 Overview of the Motif Toolkit 4.5.1 General Toolkit Changes
76
The Screen object defines a number of resources that control the default drag icons used during drag and drop; see
Section #smodicon for a discussion of these resources. The XmN-darkThreshold,
XmNforegroundThreshold, and XmNlightThreshold resources specify values that affect the default color
calculation algorithm, as we describe shortly.
The XmNfont, XmNhorizontalFontUnit, and XmNverticalFontUnit resources specify the font units that
are used to convert geometry values when the Xm100TH_FONT_UNITS value is being used for units. These
resources make the XmSetFontUnit() and XmSetFontUnits() routines in Motif 1.1 obsolete.
The XmNmenuCursor resource controls the pointer shape that is used when a menu is posted; the resource
supercedes the XmGetMenuCursor() and XmSetMenuCursor() functions in Motif 1.1. The
XmNunpostBehavior resource indicates the behavior of a menu when the mouse button is pressed outside of the
menu. The value XmUNPOST_AND_REPLAY unposts the menu hierarchy and replays the event, while XmUNPOST
just unposts the menu. For more information on the various Screen resources, see the reference page in Volume Six
B, Motif Reference Manual. Motif provides a number of new functions that support better control of keyboard
traversal. The XmGetFocusWidget() routine returns the widget that has the input focus, while
XmGetTabGroup() returns the widget that is the tab group for the specified widget. An application can also call
XmIsTraversable() to determine whether or not a particular widget is eligible to receive the input focus. See
Section #skeybtrav in Chapter 8, Manager Widgets, for more information about keyboard traversal.
The Manager widget class defines the XmNinitialFocus resource to allow an application to specify the widget
that has the initial keyboard focus in a dialog. This resource can be used for both MessageDialogs and
SelectionDialogs, although it is normally only used for SelectionDialogs. The resource specifies the widget that has
the keyboard focus the first time that the dialog is popped up, as described in Section #sinitfocus in Chapter 5,
Introduction to Dialogs.
The XmTrackingEvent() routine in Motif 1.2 replaces the existing XmTrackingLocate() routine for
implementing context−sensitive help. XmTrackingEvent() works for both keyboard and mouse events, and it
returns the widget selected by the user, regardless of whether or not the widget is sensitive to input. The routine also
returns the actual event performed by the user, as explained in Section #sconthelp in Chapter 21, Advanced Dialog
Programming. Motif 1.2 provides a representation type manager to handle many of the tasks related to enumerated
values, such as installing resource converters that convert string values to their numerical representations. The toolkit
provides following functions for managing representation types:
XmRepTypeAddReverse()
XmRepTypeGetId()
XmRepTypeGetNameList()
XmRepTypeGetRecord()
XmRepTypeGetRegistered()
XmRepTypeRegister()
XmRepTypeValidValue()
For more information about these routines, see the appropriate reference pages in Volume Six B, Motif Reference
Manual.
Motif also provides a name−to−widget converter in this release so that widgets can be specified in resource files. This
converter is most useful for specifying Form attachments in a resource file. The converter uses
XtNameToWidget() from the parent of the widget specified on the left−hand side of the resource specification.
Motif includes the new xmbind client that configures the virtual key bindings for Motif applications. This action is
performed at startup by the Motif Window Manager (mwm) or any application that uses the Motif toolkit, so an
application only needs to use xmbind if it wants to reconfigure the bindings without restarting mwm or a Motif
application. The toolkit also provides a new function, XmTranslateKey(), to translate a keycode into a virtual
4 Overview of the Motif Toolkit 4.5.1 General Toolkit Changes
77

Get Volume 6A: Motif Programming Manual now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.