Common Desktop Environment: Programmer's Overview

# 2 Development Environment Considerations

Contents of Chapter:

Common Desktop Environment Characteristics

Underlying Foundations

Running Existing Applications

Libraries and Header Files

Demo Programs

Man Pages

Development Environment Directory Structure

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 CDE User's Guide or the Desktop Introduction online help volume.

## 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 CDE Advanced User's and System Administrator's Guide .

## Underlying Foundations

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

- Common Desktop Environment header files and libraries

- X11R5 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 Table 2-2 .

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 a description of these enhancements, see Appendix , "Common Desktop Environment Motif." ) 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.

Table 2-1 Interoperability of Existing X-Based Applications with the Common Desktop Environment

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 X11R5 header files and libraries, which reside in vendor-specific locations. Table 2-2 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 Table 2-2 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 Table 2-2. For more information on the `man()` command, see the `man(1)` man page.

## Development Environment Directory Structure

Table 2-2 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` .)

Table 2-2 Development Environment Directories in /usr/dt

Generated with CERN WebMaker