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” describes how to recognize the preferred mouse double-click speed.

“Using the Preferred Text Editor” describes how to use the preferred visual text editor whenever your application needs to let users edit text.

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 Preferred Text Editor

The Desktop Settings control panel (available from the “Customize” submenu of the Desktop toolchest) contains a “Default Editor” setting, which allows users to select a preferred visual editor for editing ASCII text. This sets the value of the WINEDITOR environment variable.

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 new of the temporary file as an argument.

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