Common Desktop Environment: Programmer's Overview

Motif GUI Engine

Think of the Motif toolkit as the GUI engine of the desktop. This section discusses Common Desktop Environment Motif, Common Desktop Environment widgets, and alternative modes of Motif programming.

Common Desktop Environment Motif Toolkit

The Common Desktop Environment Motif toolkit is Motif 2.1 with bug fixes, enhancements, and some new features. You must explicitly set resources to enable the new features. Functional additions include file selection box GUI modifications, different default settings of existing resources (primarily to lighten up the default border widths), color management enhancements, internationalization of error messages, and minor usability fixes (some of which have the effect of easing migration of OPEN LOOK users to the Common Desktop Environment).

Common Desktop Environment Motif and Motif 2.1 are also highly compatible. Most functions put into Common Desktop Environment Motif have been introduced into Motif 2.1. As a result, developers have compiled their applications with Common Desktop Environment Motif, relinked to Motif 2.1, and ran the applications successfully. Widget subclassing that has not followed Motif 1.2 subclassing guidelines designed to shield programs from widget size changes are likely to fail.

A drag-and-drop convenience layer has been added on top of the Motif 1.2 drag-and-drop API. In addition, the Common Desktop Environment uses the Motif 1.2 preregister drag feedback protocol. A drop site drag manager process keeps track of visible drop zones on the desktop. This data is used by a drag source client process to manage drag feedback interaction. Limited drag time validation of drop zones is followed by full validation at drop time, with snap-back-to-source animation if the drop fails.

Common Desktop Environment Motif includes a GUI style guide and certification checklist that has substantially expanded on the Motif 2.1 style guide. Additions affect the input models, window management, and GUI design principles.

Common Desktop Environment Motif Widgets

Common Desktop Environment Motif provides two types of widgets that are not available in Motif 1.2.3:

Help is delivered with an application in the form of Semantic Description Language (SDL) files that have been compiled from HelpTag, a form of Standard Generalized Markup Language (SGML) files. The Help system features mixed text and graphics, hyperlinks, dynamic reformatting of text, and structured navigation capabilities.

GUI Shell

The Common Desktop Environment includes Desktop Korn shell, an interpreted scripting language alternative to C programming of the Motif toolkit. Desktop Korn shell includes selected frequently-used Common Desktop Environment, Xt, and Xlib APIs. You must use a compiled language to access the full power of the environment. However, you can write Desktop Korn shell scripts that participate in desktop integration activities such as drag and drop, session management, and ToolTalk messaging.

If you are comfortable with shell programming, you may prefer to use Desktop Korn shell for modest programming tasks because it is:

GUI Construction

The easiest way to produce your first Common Desktop Environment application, and perhaps the fastest, is to do almost no Motif toolkit programming at all. Use the Common Desktop Environment Application Builder, also known as App Builder, to construct the GUI control portion of your application. App Builder focuses on making default widget behavior easy to access. It does this by hiding many of the more esoteric resources that are available on most widgets. App Builder also makes it as easy to incorporate desktop integration infrastructure into your application, including drag and drop, session management, and ToolTalk messaging.


Tip -

App Builder is a good learning tool. A full-featured Motif GUI builder called XDesigner is available for purchase from the Sun Microsystems Advanced Developer Tools organization.


App Builder maintains the user interface state in Builder Interface Language (BIL) files. A code generator takes the BIL files and produces Motif toolkit code. App Builder can also generate User Interface Language (UIL) files.

As you make changes to your application's user interface, App Builder merges your custom code with the code it generates. Generated code is a good source of example code, even if you do not using App Builder to maintain your application's GUI state.

In addition, non-programmers can use App Builder to produce an application GUI prototype. The prototype can roll forward to programmers for the production phase of development.