Chapter 10. Handling Users' System Preferences

This chapter describes how your application can recognize and use various system preferences that users can set through Desktop control panels. Whenever possible, your application should follow these preferences to provide a consistent interface for your users. In particular, this chapter contains:

Handling the Mouse Double-Click Speed Setting

The Mouse Settings control panel (available from the “Customize” submenu of the Desktop toolchest) allows users to set various parameters that affect the operation of the mouse. The setting of importance to applications is “Click Speed,” which determines the maximum interval between double-clicks. “Click Speed” sets the *multiClickTime X resource.

In most cases, you don't need to do anything to handle this setting. IRIS IM widgets automatically use the multiClickTime value as appropriate. Only if your application needs to handle double-clicks explicitly (for example, to select a word in a word processing application) does it need to call XtGetMultiClickTime() to determine the double-click time. See the XtGetMultiClickTime(3Xt) reference page for more information on XtGetMultiClickTime().


Note: Don't call XtSetMultiClickTime(), which sets the double-click time for the entire display.


Using the Default Viewer and Editor Utilities Panel

Users who select Toolchest->Customize->Utilities invoke /usr/sbin/dtUtilities. This application displays the “Default Viewer and Editor Utilities” panel (shown in Figure 10-1).

Figure 10-1. The dtUtilities Panel

The dtUtilities Panel

Using the dtUtilities panel, users can select installed utilities, including the following:

  • Text Editor (for example, xwsh, Jot, or Vi)

  • Web Browser (for example, Netscape)

  • Image Viewer (for example, Imgview)

  • Mailer (for example, MediaMail or Netscape)

  • Book Viewer (for example, Insight)

  • PostScript Viewer (for example, ShowPS)

Selecting Utilities and Their Values

The dtUtilities variables and their values are listed in Table 10-1. An example of providing programmatic access to one of these utilities is in “Setting the Preferred Text Editor”, which is below the table.

Table 10-1. dtUtilities and Their Values

dtUtility Variable

Value

WINEDITOR

Path to a window editor (for example, /usr/sbin/jot).

WEBBROWSER

Path to an X Window System application that is a World Wide Web visual browser (for example, /usr/bin/X11/netscape).

IMGVIEWER

Path to an application that displays image files (for example, /usr/bin/X11/imgview).

MAILBOXPROG

Path to a mail reader application (for example, /usr/bin/X11/MediaMail -gui).

BOOKVIEWER

Path to an application for displaying InSight books (for example, /usr/sbin/insight).

PSVIEWER

Path to an application for viewing PostScript files (for example, /usr/bin/X11/showps).


Setting the Preferred Text Editor

The “Text Editor” setting on the dtUtilities control panel allows users to select a preferred visual editor for editing ASCII text. This setting sets the value of the WINEDITOR environment variable.

The following instructions explain how to set the value of WINEDITOR. You can use the same instructions for the other utilities on the control panel. Just refer to Table 10-1 for the utility and value you wish to set.

Whenever your application needs to let users edit text, you should:

  1. Call getenv() to check whether the WINEDITOR environment variable is set. See the getenv(3c) reference page for more information on getenv().

  2. If WINEDITOR is set, save the text to edit in a temporary file. Typically, you should check the value of the environment variable TMPDIR and, if it is set, put the temporary file in that directory.

  3. Execute the editor, providing it the name of the temporary file as an argument.

  4. When the user quits the editor, read the temporary file and delete it.