# Development Environment Considerations

This chapter discusses general information you should know before starting to use the Common Desktop Environment application program interfaces (APIs).

Before you integrate your application into the desktop, you should have a basic understanding of how the desktop works. Install the Common Desktop Environment on your platform and familiarize yourself with its features. For an introduction to the desktop, see the User's Guide or the Desktop Introduction online help volume.

RDMAP.consi.mkr.2
RDMAP.consi.mkr.3
RDMAP.consi.mkr.4
RDMAP.consi.mkr.5
RDMAP.consi.mkr.6
RDMAP.consi.mkr.7
RDMAP.consi.mkr.8

## Common Desktop Environment Characteristics

The Common Desktop Environment provides a productive and comfortable desktop environment for UNIX users. As you develop your application, keep in mind the experience that the Common Desktop Environment delivers to its users. Develop your application with the following
characteristics in mind, to help make it a powerful, consistent, and predictable part of the Common Desktop Environment:

- Hide the complexities of UNIX.

  Because the Common Desktop Environment targets end users as its primary customers, providing an application that hides UNIX as much as possible is a key ingredient to a successful product.

- Provide a common look and feel.

  Successful applications in the Common Desktop Environment share look- and-feel characteristics with other applications on the desktop. Follow the style and other guidelines (such as the Common Desktop Environment standard font names) so that your application encompasses the Common Desktop Environment Motif look and feel.

- Make applications easy to use.

  Provide an easily readable default font size, and provide keyboard accelerators for mouse-oriented actions. Use the desktop online help component to integrate a complete Help system into your application. Basic computer interaction styles should be consistent across platforms wherever possible.

- Take advantage of desktop integration services.

  The Common Desktop Environment provides a set of desktop integration services that enable applications to be well-integrated into the desktop. Users benefit because they do not have to know whether an application is running on a local machine or somewhere on the network, or which toolkit (if any) was used to write the application they are running. Provide mechanisms in your application that enable it to be launched from the desktop and to communicate with other Common Desktop Environment applications. Use the online Help system to provide users with quick information. Use drag and drop to provide users with a more predictable way to use their systems.

- Design for individual and cultural differences.

  By following the Common Desktop Environment conventions and policies, your application will naturally provide for smooth, consistent, and appropriate customization of:

  - Fonts

  - Color

  - Keyboard and mouse bindings

  - Locale-specific configuration files

    For more about locale-specific configuration files, see the localization section of the Advanced User's and System Administration Guide .

## Underlying Foundations

To compile an application that uses the desktop APIs, you need:

- Common Desktop Environment header files and libraries

- X11R6.2 or later header files and libraries

- ANSI C compiler; or C++ compiler, version 2.0 or later, if you are developing a C++ application

The resulting binary file must be run in an environment in which matching libraries are installed. The run-time libraries are in `/usr/dt/lib`, and they include the directories listed in RDMAP.consi.mkr.9.

To run properly, Common Desktop Environment-based applications require an environment in which some files from the following run-time directories are installed:

- `/etc/dt/*`

- `/var/dt/*`

- The following subdirectories of `/usr/dt`:

  - `app-defaults`

  - `appconfig`

  - `bin`

  - `dthelp`

  - `lib`

Your application should depend on only those run-time files explicitly mentioned in the X/Open XCDE standard. It should not depend on files not mentioned in the standard; for example, `/usr/dt/appconfig/icons`. If you build such dependencies into your application, it should be robust enough to run in an environment in which such files are missing or have changed.

For a listing of the minimum run-time environment required to run a Common Desktop Environment application, see the `dtfilsys(5)` man page.

The run-time environment includes Common Desktop Environment Motif, which is Motif 1.2.3 with bug fixes and enhancements. For more information on the Common Desktop Environment run-time environment, see the run-time documentation set.

## Running Existing Applications

Existing
X Window System-based applications that are not compiled with any Common Desktop Environment libraries run under the desktop window manager (`dtwm`) similarly to the way they run under the Motif window manager: they still work. The level of interoperability with the Common Desktop Environment follows these guidelines.

## Interoperability of Existing X-Based Applications with the Common Desktop Environment

`Characteristics of Existing X-based Applications` | `Interoperability Status with Desktop`
Motif 1.2 (and later) drag and drop (using preregister protocol) | Yes
Motif 1.2 (and later) drag and drop (using dynamic protocol) | No This is a Motif 1.2 drag-and-drop dynamic protocol interoperability problem, and it is not due to the Common Desktop Environment.
Cut and paste (all applications) | Yes
OPEN LOOK drag and drop | Yes (except multiple-item drag and drop) This is implemented through a protocol translation mechanism in the drop site database manager (`dsdm`).
ToolTalk Media Exchange and Desktop protocols | Yes

If you want to recompile and relink an existing Motif application with the Common Desktop Environment Motif shared libraries, the application must be compatible with Motif 1.2.

## Libraries and Header Files

Compile Common Desktop Environment applications against X11R6.2 header files and libraries, which reside in vendor-specific locations. RDMAP.consi.mkr.9 lists the locations of all development environment libraries and header files, as subdirectories of `/usr/dt`.

## Demo Programs

The `/usr/dt/examples` subdirectories contain source code for development environment component demos, as well as a template application. See RDMAP.consi.mkr.9 for a listing of all demo subdirectories.

Each demo subdirectory contains source files for one or more demo programs, along with makefiles for the programs. It also contains a `README` file that describes the demos.

The demo whose source is in the `template` subdirectory is a simple drawing program. This demo illustrates the basic structure of a Common Desktop Environment application that is integrated with the desktop. It is internationalized and contains all localized components in a separate subdirectory. You can use the drawing program source as a template for your application.

## Man Pages

The Common Desktop Environment man pages reside in `/usr/dt/man`. To view them using either the `man()` command or the desktop man page viewer, you must add `/usr/dt/man` to the `MANPATH` environment variable. For example, in your `~/.dtprofile` file, set:

    MANPATH = $MANPATH:/usr/dt/man

For a listing of the `/usr/dt/man` subdirectories and contents, see RDMAP.consi.mkr.9. For more information on the `man()` command, see the `man`(1) man page.

## Development Environment Directory Structure

RDMAP.consi.mkr.9 lists the top-level directories in the development environment directory structure and lists their subdirectories. (All of the top-level directory names are prefixed by `/usr/dt`.)

## Development Environment Directories in /usr/dt

`Directory` | `Subdirectory` | `Contents`
`examples` |  | Subdirectories that contain source code for development environment component demo programs
|  | README file
| dtaction | Action invocation API demos
| dtbuilder | Application Builder examples
| dtcalendar | Calendar API demos
| dtdnd | Drag-and-drop API demos
| dtdts | Data-typing API demos
| dthelp | Help API demos
| dtksh | `dtksh` example scripts
| dtsession | Session Manager API demos
| dtterm | Terminal Emulator widget API demos
| dtwidget | Common Desktop Environment Motif widgets demos
| dtwsm | Workspace Manager API demos
| template | Template Common Desktop Environment application
| motif | Motif 1.2 API demos
| motif/clipboard | `XmClipboard` API demo
| motif/dogs | Widget binary compatibility mechanism demo
| motif/draganddrop | Motif 1.2 drag-and-drop API demo
| motif/periodic | Motif widgets demo
| tt | ToolTalk Messaging Service demos
`include` |  | Development environment library header files
| csa | Calendar header files
| `Dt` | Header files for `DtSvc`, `DtWidget`, `DtHelp`, and `DtTerm`
| `Mrm` | Motif 1.2 resource manager header files
| `Tt` | ToolTalk Messaging Service header files
| `Xm` | Motif 1.2 toolkit header files
| `uil` | Motif 1.2-callable UIL compiler header files
`lib` |  | Library files for `libcsa` (Calendar), `libDtHelp` (Help system), `libDtSvc` (actions, data typing, drag and drop, Session Manager, Workspace Manager), `libDtTerm` (Terminal Emulator), `libDtWidget` (Common Desktop Environment Motif control and editor widgets), `libMrm` (Motif 1.2 resource manager), `libUil` (Motif 1.2-callable UIL compiler), `libXm` (Motif 1.2 toolkit), `libtt` (ToolTalk)
`man` |  | Development environment man pages
| `man1` | Client and utility man pages
| `man3` | API man pages
| `man4` | Data formats
| `man5` | Header file and action man pages``