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” describes how to recognize the preferred mouse double-click speed.
“Using the Default Viewer and Editor Utilities Panel” describes the dtUtilities panel, lists utility variables and their values, and provides an example of how to set the preferred visual text editor when your application needs to let users edit text.
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.|
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).
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)
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.
Path to a window editor (for example, /usr/sbin/jot).
Path to an X Window System application that is a World Wide Web visual browser (for example, /usr/bin/X11/netscape).
Path to an application that displays image files (for example, /usr/bin/X11/imgview).
Path to a mail reader application (for example, /usr/bin/X11/MediaMail -gui).
Path to an application for displaying InSight books (for example, /usr/sbin/insight).
Path to an application for viewing PostScript files (for example, /usr/bin/X11/showps).
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:
Call getenv() to check whether the WINEDITOR environment variable is set. See the getenv(3c) reference page for more information on getenv().
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.
Execute the editor, providing it the name of the temporary file as an argument.
When the user quits the editor, read the temporary file and delete it.