13.4 Resource Specification and Matching

A resource specification consists of an optional name of a client, followed by one or more predefined variables that indicate the preference to set, followed by a colon, optional white space, and the actual value of the preference.[54]

The format of these preference strings is most easily seen by looking at a resource database file, such as the one shown in Example 13-5.

Example 13-5. A simple resource database file

*font:                   fixed
.borderWidth:            2

xterm.scrollBar:         on
xterm.title:             xterm
xterm.windowName:        xterm
xterm.boldFont:          8x13
xterm.curses:            off
xterm.internalBorder:    2
xterm.iconStartup:       off
xterm.jumpScroll:        on
xterm.reverseWrap:       true
xterm.saveLines:         700
xterm.visualBell:        off

The options which begin with a period apply to all programs unless overruled by a program-specific entry with the same resource name. The last element between a period or asterisk and the colon is the resource name.

This simple example demonstrates the rules as commonly practiced in Xlib applications. However, there are a number of additional rules that come into play in more complex, object-oriented applications, such as those written with the Xt Toolkit. Preferences may apply only to a particular subwindow within an application. For example, the xmh mail handler allows the user to set preferences for multiple levels of windows. These levels can be specified explicitly or by using a wildcard syntax denoted by the asterisk.

As a result, you should think of the syntax for ...

Get XLIB Programming Manual, Rel. 5, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.