(navigation image)
Home American Libraries | Canadian Libraries | Universal Library | Community Texts | Project Gutenberg | Biodiversity Heritage Library | Children's Library | Additional Collections
Search: Advanced Search
Anonymous User (login or join us)
Upload
See other formats

Full text of "X Window System user's guide : OSF/Motif edition"

The Definitive Guides 
to the X Window System 

Volume Three 

I I I 

X Window System 
User's Guide 

OSF/Motif Edition 

by Valerie Quercia and Tim O'Reilly 

O'Reilly & Associates, Inc. 



X Window System 
User's Guide 



Volume Three 

X Window System 
User's Guide 

OSF/Motif Edition 

by Valerie Quercia and Tim O'Reilly 

O'Reilly & Associates, Inc. 



Color Definition ................................................................................................................... 287 
Help with xset Options ........................................................................................................ 287 
xse'oot: Setting Root Window Characteristics ..................................................................... 288 
Seuing Root Window Patterns .............................................................................................. 288 
Foreground, Background Color and Reverse Video ........................................................... 289 
Changing the Root Window Pointer .................................................................................... 290 
xmodmap: Modifier Key and Pointer Customization ............................................................ 291 
Keycodes and Keysyms ......................................................................................................... 293 
Procedure to Map Modifier Keys ......................................................................................... 294 
Displaying the Current Modifier Key Map .......................................................................... 294 
Determining the Default Key Mappings .............................................................................. 295 
Matching Keysyms with Physical Keys Using xev ............................................................. 296 
Changing the Map with xmodmap ....................................................................................... 297 
Expressions to Change the Key Map ................................................................................. 298 
Key Mapping Examples ...................................................................................................... 299 
Displaying and Changing the Pointer Map .......................................................................... 301 

PART THREE: Client Reference Pages .....................................  ........................ 305 

Into .......................................................................................................................................... 309 
X ............................................................................................................................................... 311 
Xs6rver .................................................................................................................................... 326 
appres ....................................................................................................................................... 333 
bdftosnf .................................................................................................................................... 335 
bitmap ...................................................................................................................................... 336 
listres ........................................................................................................................................ 345 
mkfontdir ................................................................................................................................. 347 
mwm ........................................................................................................................................ 348 
oclock ...................................................................................................................................... 367 
resize ........................................................................................................................................ 369 
showsnf .................................................................................................................................... 371 
xauth ........................................................................................................................................ 375 
xbiff .......................................................................................................................................... 378 
xcalc ......................................................................................................................................... 381 
xclipboard ................................................................................................................................ 388 
xclock ...................................................................................................................................... 391 
xcol .......................................................................................................................................... 395 
xcutsel ...................................................................................................................................... 397 
xditview ................................................................................................................................... 399 
xdm .......................................................................................................................................... 401 
xdpr .......................................................................................................................................... 416 
xdpyinfo ................................................................................................................................... 418 
xedit ......................................................................................................................................... 422 
xev ............................................................................................................................................ 426 
xfd ............................................................................................................................................ 427 
xfontsel .................................................................................................................................... 429 
xhost ......................................................................................................................................... 432 



xterm Control Sequences .......................................................................................................... 631 
Definitions .............................................................................................................................. 631 
VT102 Mode .......................................................................................................................... 631 
Tektronix 4014 Mode ............................................................................................................ 638 

F Translation Table Syntax ........................................................................................ 643 

Event Types and Modifiers ........................................................................................................ 643 
Detail Field " 645 
Modifiers ................................................................................................................................ 646 
Complex Translation Examples ............................................................................................ 646 

G Athena Widget Resources ...................................................................................... 651 

The Widget Class Hierarchy ..................................................................................................... 651 
Widgets in the Application ....................................................................................................... 656 
What all this Means ................................................................................................................... 659 
Complications ............................................................................................................................ 660 
Box .............................................................................................................................................. 661 
Command ................................................................................................................................... 661 
Dialog ......................................................................................................................................... 663 
Form ............................................................................................................................................ 664 
Grip ............................................................................................................................................. 665 
Label ........................................................................................................................................... 666 
List .............................................................................................................................................. 667 
MenuButton ............................................................................................................................... 668 
Paned .......................................................................................................................................... 669 
Scrollbar ..................................................................................................................................... 672 
Simple ......................................................................................................................................... 674 
SimpleMenu ....................  .......................................................................................................... 675 
Sme ............................................................................................................................................. 676 
SmeBSB ..................................................................................................................................... 677 
SmeLine ...................................................................................................................................... 678 
StripChart ................................................................................................................................... 678 
Text ............................................................................................................................................. 679 
Toggle ......................................................................................................................................... 688 
Viewport ..................................................................................................................................... 690 

x// 



Preface 

By convention, a preface describes the book itself, while the introduction 
describes the subject matter. You should read through the preface to get an 
idea of how the book is organized, the conventions it follows, and so on. 

In The Preface: 

Assumptions ...................................................................................... xxiii 
Organization ...................................................................................... xxiv 
Bulk Sales Information ....................................................................... xxvi 
xshowfonts.c and Other Free Programs ............................................. xxvi 
Acknowledgements ........................................................................... xxvii 
Font and Character Conventions ...................................................... xxviii 



In describing various standard clients, this chapter highlights those features provided by the 
Athena widget set. This chapter also describes some of the features of applications written 
using the Motif widget set. 

Part Two: Customizing X 

Chapter 9: Command Line Options 
Discusses some of the standard command line options accepted by most clients. 

Chapter 10: Setting Resources 
Tells how to create an .Xresources file to set default characteristics for client applications. 
This chapter also describes how to use xrdb, which saves you from having to maintain multi- 
ple .Xresources files if you run clients on multiple machines. 

Chapter 11: Customizing mwm 
Describes the .mwmrc file by showing the default file shipped by OSF and examines the pur- 
pose and syntax of entries. Explains various techniques for revising the .mwmrc file to mod- 
ify existing menus and create new ones. Reviews the different types of resources that can be 
used to control mwm. 

Chapter 12: Setup Clients 
Describes how to set display and keyboard preferences using xset and how to set root win- 
dow preferences using xsetroot. Also demonstrates how to use xraodmap to redefine the logi- 
cal keynames and pointer commands recognized by X. 

Part Three: Client Reference Pages 

Extended reference pages for all clients. 

Part Four: Appendices 

Appendix A: System Management 
Appendix B: Release 4 Standard Fonts 
Appendix C: Standard Bitmaps 
Appendix D: Standard Cursors 
Appendix E: xterm Control Sequences 
Appendix F: Translation Table Syntax 
Appendix G: Athena Widget Resources 

Glossary 

Index 

o.o 
Preface xxm 



Part One-. 

Using X 

Part One provides an overview of the X Window System and concepts, and 
describes how to use the most important programs available in the X 
environment. 

An Introduction to the X Window System 
Getting Started 
Working in the X Environment 
More about the mwm Window Manager 
The xterm Terminal Emulator 
Font Specification 
Graphics Utilities 
Other Clients 



1 

An Introduction 
to the X Window System 

This chapter describes the features of a typical X display, while introducing 
some basic window system concepts. It also provides an overview of the X 
Window System's client-server architecture and briefly describes the most 
commonly used clients. 

In This Chapter: 

Anatomy of an X Display ......................................................................... 5 
Standard X Clients versus Motif Clients ................................................. 15 
X Architecture Overview ........................................................................ 19 
The X Display Server ............................................................................. 20 
Clients ................................................................................................... 21 
The Window Manager ........................................................................ 22 
The xterm Terminal Emulator ............................................................. 22 
The Display Manager ......................................................................... 23 
Other X Clients .................................................................................. 23 
Customizing Clients ........................................................................... 24 



1 
An Introduction 
to the X Window System 

The X Window System, called X for short, is a network-based graphics window system that 
was developed at MIT in 1984. Several versions of X have been developed, the most recent 
of which is X Version 11 (X11), first released in 1987. 

X11 has been adopted as an industry standard windowing system. X is supported by a con- 
sortium of industry leaders such as DEC, HewletI-Packard, Sun, IBM, and AT&T that have 
united to dh'ect, contribute to, and fund its continuing development. In addition to the system 
software development directed by the X Consortium, many independent developers are pro- 
ducing application software specifically for use with X, including spreadsheets, database pro- 
grams, and publishing applications. 

First, we'll take a look at a typical X display and consider some general system features. 
We'll also briefly compare a standard X application (written with the X Toolkit) to a Motif 
application (written with the Motif ToolkiO. Then we'll discuss what distinguishes the X 
Window System from other window systems. We'll also introduce some of the more impor- 
tant pmgrarns included in the standard distribution of X, and the mwm window manager 
shipped with OSF/Motif. 

Anatomy of an X Display 

X is typically run on,a workstation with a large screen (although it also runs on PCs and spe- 
cial X terminals, as well as on many larger systems). X allows you to work with multiple 
programs simultaneously, each in a separate window. The display in Figure 1-1 includes five 
windows. 
The operations performed within a window can vary greatly, depending on the type of pro- 
gram running it. Certain windows accept input from the user:, they may function as termi- 
nals, allow you to create graphics, etc. Other windows simply display information, such as 
the time of day or a picture of the characters in a particular font, etc. 
The windows you will probably use most frequently are terminal emulators, windows that 
function as standard terminals. The terminal emulator included with the standard release of 
X is called xterm. Figure 1-1 depicts three xterm windows. In an xterm window, you can do 
anything you might do in a regular terminal: enter commands, run editing sessions, compile 
programs, etc. 

An Introduction to the X Window System 5 



Root Menu 
New Window 
Shuffle Up 
Shuffle Down 
Refresh 
Restart... 

Figure 1-6. A pop-up menu: mwm's Root Menu 

As we'll see in Chapter 8, Other Clients, some programs provide menus that you can display 
simply by placing the pointer on a particular part of the window, e.g., a horizontal menu bar 

A final note about the X display:, in X, the terms display and screen are not equivalent. A 
display may consist of more than one screen. This feature might be implemented in several 
ways. There might be two physical monitors, linked to form a single display, as shown in 
Figure 1-7. Alternatively, two screens might be defined as different ways of using the same 
physical monitor. For example, on the Sun-3/60 color workstation, screen 0 is color, and 
screen 1 is black and white. Each screen is the size of the monitor, you can only view one 
screen at a time. In practice, the two screen seem to be side by side: you can "scroll" 
between them by moving the pointer off either horizontal edge of the screen. By default, 
windows are always placed on screen 0 but you can place a client window on screen 1 by 
specifying the screen number in the -display opdon when starting the client. (See Chap- 
ter 3 for inslructions on using the -display opdom) 

14 

X Window System User's Guide, Motif Edition 



In general, once you've mastered the basics of working with the MIT client programs run- 
ning under the mwm window manager, you should have no problem making use of any addi- 
tional features provided by commercial applications built with the Motif widget set. 

X Architecture Overview 

Most window systems are kernel-based: that is, they are closely tied to the operating system 
itself and can only run on a discrete system, such as a single workstation. The X Window 
System is not part of any operating system but instead is composed entirely of user-level pro- 
grams. 
The architecture of the X Window System is based on what is known as a client-server 
model The system is divided into two distinct parts: display servers that provide display 
capabilities and keep track of user input and clients, application programs that perform spe- 
cific tasks. 
In a sense, the server acts as intermediary between client application programs, and the local 
display hardware (one or perhaps muldple screens) and input devices (generally a keyboard 
and pointer). When you enter input using the keyboard or a pointing device, the server con- 
veys the input to the relevant client application. Likewise, the client programs make requests 
(for information, process, etc.) that are communicated to the hardware display by the 
server. For example, a client may request that a window be moved or that text be displayed 
in the window. 
This division within the X architecture allows the clients and the display server either to 
work together on the same machine or to reside on different machine.s (possibly of different 
types, with different operating systems, etc.) that arc connccted by a network. For example, 
you might use a relatively low-powered PC or workstation as a display server to interact with 
clients that arc running on a more powerful remote system. Even though the client program 
is actually running on the more powerful system, all user input and displayed output occur on 
the PC or workstation server and arc communicated across the network using the X protocol. 
Figure 1-10 shows a diagram of such a network- 

You might choose to run a client on a remote machine for any number of reasons. Generally, 
however, the remote machine offers some feature unavailable on your local machine: a more 
efficient or powerful processor;, a completely different architecture better suited to a particu- 
lar task; different application software; file server capabilities (and perhaps large data files 
you'd rather not transfer over the network). X allows you to take advantage of these remote 
features and to see the results on your local terminal. 

The distinction between clients and the server also allows somewhat complicated display sit- 
uations. For instance, you can access several machines simultaneously. (This can greatly 
simplify the work of a system administrator.) X also allows you to output to several displays 
simultaneously. This capability can be very helpful in educational situations. Hypotheti- 
cally, a teacher could display insmactional material to a group of students each using a graph- 
ics workstation or terminal hooked up to a network. 

An introductJbn to the X Window System 19 



When a client program receives a meaningful event, it responds with a request to the server 
for some sort of action affecting the display. For instance, the client may request that a win- 
dow be resized to particular dimensions. The server responds to requests by a client program 
by updating the appropriate window(s) on your display. 
Servers are available for PCs, workstations, and even for special terminals (generally called 
X terminals), which may have the server downloaded from another machine or stored in 
ROM. 

Clients 

As previously mentioned, a chent is an apphcation program. The standard release of X from 
MIT includes more than 50 client programs that perform a wide variety of tasks. X allows 
you to run many clients simultaneously: each client displays in a separate window. For 
example, you could be editing a text file in one window, compiling a program source file in a 
second window, reading your mail in a third, all the while displaying the system load average 
in a fourth window. 
While X clients generally display their results and take input from a single display server, 
they may each be running on a different computer on the network. It is important to note that 
the same programs may not look and act the same on different servers since X has no stan- 
dard user interface, since users can customize X clients differendy on each server, and since 
the display hardware on each server may be different. 
Remember that the server conveys input from the various input devices to the appropriate cli- 
ent application; likewise, the client issues output in the form of requests to the server for cer- 
tain actions affecting the display. 
In addition to commtmicating with the server, a client sometimes need to communicate with 
other clients. For example, a client may need to teLl the window manager where to place its 
icon. Interclient communication is facilitated by the use of properties. A property is a piece 
of information associated with a window or a font and stored in the server. Properties are 
used by clients to store information that other clients might need to know, such as the name 
of the application associated with a particular window. Storing properties in the server 
makes the information they contain accessible to all clients. 
A typical use of properties in interclient communication involves how a client tells the win- 
dow manager the name of the application associated with its window. By default, the appli- 
cation name corresponds to the client's name, but many clients allow you to specify an alter- 
native name when you run the program. A window manager that provides a titlebar needs to 
know the application name to display in that area. The client's application name is stored in 
the server in the property called WM_NAME and is accessed by the window manager. 
See the xprop reference page in Part Three of this guide, and Volume One, Xlib Program- 
ruing Manual, for more information about properties and the xprop client. 
Several of the more frequently used client programs are discussed in the following sections. 

An Introduction to the X Window System 21 



Font utilities 
xlsfonts 
xfa 
xfontsel 

Graphics utilities 
bitmap 
atobm, bmtoa 

Printing applications 
xwd 
xpr 

xwud 
Removing a window 
xkill 

Lists available fonts. 
Displays the characters in a single font. 
Allows you to display multiple fonts sequentially and select a font to 
be used by another application. 

Bitmap editor. 
Programs to convert ASCII characters to bitmaps and bitmaps to 
ASCII characters. 

Dumps the image of a window to a file. 
Translates an image file produced by xwd to PostScript@ or another 
format, suitable for printing on a variety of printers. 
Redisplays a window dump file created using xwd. 

Terminates a client application. 

Window and display information utilities 
xlsclients Lists the clients running on the display. 
xdpyinfo Lists general characteristics of the display. 
xwininfo Lists general characteristics of a selected window. 
xprop Lists the properties associated with a window. 
These and other client applications are described in Chapters 5 through 8, and in Chapter 11. 
In addition, a reference page describing each client and listing its options appears in Part 
Three of this guide. As more commercial and user-contributed software is developed, many 
more specialized programs will become available. 

Customizing Clients 

Most X clients are designed to be customized by the user. A multitude of command-line 
options can be used to affect the appearance and operation of a single client process. A few 
of the more useful command-line options are introduced in Chapter 3. Chapter 9 discusses 
several options in detail. Part Three of this guide includes a reference page for each client 
that details all valid options. 

X also provides a somewhat more convenient way to customize the appearance and operation 
of client programs. Rather than specifying all characteristics using command line options, 
default values for most options can be stored in a file (generally called .Xresources or .Xde- 
faults) in your home directory Each default value is set using a variable called a resource; 

24 X Window System User's Guide, Motif Edition 



2 

Getting Started 

This chapter helps you start the X server, the first xterm (terminal emulator) 
window, and the mwm window manager. These processes may be started 
automatically when you log in, or you may have to start them manually. 

In This Chapter: 

Starting X .............................................................................................. 29 
Logging On in the Special xdm Window ............................................. 30 
Logging In at a Full Screen Prompt .................................................... 32 
Starting X Manually ........................................................................... 33 
Starting the mwm Window Manager .... ; .............................................. 34 
Typing in a Window Once mwm is Running ............................................ 35 



If you r working wiu a stack of windows dt ovlap, slecting a focus window automati- 
cally raises dmt window to the top of the stack (in effect the front of the display). 

Keep in mind that mwm is highly customizablc. You can specify dozens of features, includ- 
ing the color of the active window's frame, the options available on menus, and how certain 
window management functions are invoked. As we've discussed, one of  most significant 
modifications you can make to mwm is to change the focus policy from chck-to-type (or ex- 
phcit focus_) to real-estate-driven (or pointer focus). 

36 X Window System User's Guide Motif Edition 



Once You Run a Remote xterm using -display ................................. 60 
Logging In to a Remote System ....................................................... 60 
Monitoring the load on a remote system .......................................... 60 
Other Command Line Options ............................................................ 62 
Putting it All Together ............................................................................. 63 
Customizing the X Environment: Specifying Resources ........................ 66 
Where to Go From Here ........................................................................ 68 



Keep in mind that some commands or actions are invoked by a simple click on a particular 
graphic element, as illustrated by mwm's click-to-type focus. Alternatively, some actions 
require a button press and pointer motion (i.e., dragging). 
When dragging is used to move an object, the actual object does not appear in the new loca- 
tion until you complete the movement and release the pointer button. Instead, you appear to 
drag an outline representing the object. When you release the pointer button, the actual 
object appears in the new location. This effect is illustrated in the section "Moving a Win- 
dow," later in this chapter. 
Dragging is also commonly used to change the size of a window. Again, an outline indicates 
that the window's size is changing. When the outline approximates the size you want, you 
release the pointer button and the actual window is redrawn using the selected dimensions. 
Resizing a window is described in Chapter 4. The following sections describe how to per- 
form the most basic window management functions, which require you to use the pointer in 
the ways we've discussed. 

Raising, Moving, and Iconifying Windows 

Figure 3-2 shows an xterm window "framed" by mwm. The window frame itself and several 
features of it are tools that allow you to manipulate the window using the pointer. 

Window title area ----- [ Minimize 
Menu / (iconify) 
button  ........................................................  .............. ; ..... r" 1 button 
title bar[  1 7:=-;- i ::II!  Maximize 
button 

Figure 3-2. An xterm window framed by mwm 

The wider top edge of the frame is the tidebar. The tidebar is composed of several parts 
including a title area (displaying the name of the application) and three command buttons 
(Minimize, Maximize, and Window Menu). Notice that whenever you move the pointer into 
the tidebar, the pointer changes to the arrow cursor. 

42 X Window System User's Guide, Motif Edition 



2. Press and hold down the first pointer button. 
3. Move the window by dragging the pointer. Figure 3-4 shows a window being moved in 
this way. When you begin to move the window, the pointer changes to a cross arrow 
pointer and a window outline appears. This outline tracks the pointer's movement. In the 
center of the screen, a small, rectangular box also appears, displaying the x and y coordi- 
nates of the window as you move it. 
4. Drag the cross arrow pointer with the window outline to the desired location on your 
5. Release the first pointer button. The window will move to the selected location. 

Figure 3-4. Moving a window by dragging the title 

With the default configuration .of mwm, moving a window also selects that window as the 
active or focus window. 

You can also move icons on the display. As we discussed in Chapter 1, an icon is a small 
symbol that (generally) represents a window in an inactive state. The next two sections 
describe how to convert a window to an icon and an icon back to a window. Once we've 
seen how to iconify a window, we'll also learn how to move an icon. 

Working in the X Environment 45 



Figure 3-5. Converting a window to an icon with the Minimize button 

By default, icons are displayed in the bottom left comer of the root window, mwm can also 
be set up to place icons in another location, to allow you to place them interactively using the 
pointer, or to organize icons within a window known as an icon box. In Chapter 11, Custom- 
izing mwm, we'll discuss the specifications necessary to set up an icon box. 

Converting an Icon to a Window 

To convert an icon back to a window (deiconify iO, place the pointer on the icon and double 
click, using the first pointer button. The window is redisplayed in the position it appeared 
before it was iconfied. 
Between the first and second cricks, you'll probably notice that another small window is 
displayed for an instant above the icon. This window is actually the Window Menu (which is 
also displayed when you raise an icon to the top of the stack). We'll discuss the Window 
Menu in more detail in Chapter 4, More about the mwm Window Manager. 
Be aware, however, that if you pause too long between the two clicks in deiconif)dng a win- 
dow, the second click will not be interpreted and the icon will not be converted back to a 
window. Instead the, Window Menu will remain on the screen, as in Figure 3-6. 

Working in the X Environment 47 



Figure 3-8. Closing an xterm window 

Working in the X Envimnmant 51 



Say you're running clients both on the local machine kansas and on the remote machine oz. 
On the local display, you can have two x/oad windows, one showing activity on kansas and 
another showing activity on oz. 
To create an x/oad window monitoring activity on kansas, use the command: 
Once the x/oad window is created, move it to a convenient locadon on the screen. 
Then run an x/oad process on oz using a remote shell and display the results in a window on 
The display option tells x/oad to create its window on the local display (kansas). Again, 
move the window using the pointer. 
Figaz'e 3-11 shows the resulting kansas display:, two x/oad windowsthe top window moni- 
toring activity on the local system and the bottom one monitoring activity on the remote sys- 
tem. 

% mwm& 
% xterm& 
% xload& 
% rsh oz 'xload -display kansas:O.O'& 
%| 

Figure 3-11. Monitodng activity on two systems with X'load 

Working in the X Environment 61 



ify still another background color for the dialog box that encloses them. In such cases, the 
actual widget names are used within the resource specification. Chapter 10, Setting 
Resources explains the resource naming syntax in greater detail and outlines the rules gov- 
erning the precedence of resources. 

Where to Go From Here 

There are many useful client programs supplied with the X Window System. Details of how 
to use one of the most important clients, the xterm terminal emulator, are provided in Chapter 
5, The xterm Terminal Emulator. Clients to list and display fonts are described in Chapter 
6, Font Specification. Chapter 7, Graphics Utilities, describes several graphics utilities 
available with X. An overview and tutorial for other standard clients is provided in Chapter 
8, Other Clients. All clients are described in detail in a reference page format in Part Three 
of this guide. 

We've introduced some basic operations you can perform using the mwm window manager. 
For instructions on performing additional window manager operations, such as resizing a 
window, read Chapter 4, More about the mwm Window Manager. You can then go on to 
read more about xterm in Chapter 5 and about some of the other standard clients in Chapters 
6 through 8. 

68 X Window System User's Guide, Motif Edition 



4 

More about the 
mwm Window Manager 

This chapter describes additional functions you can perform using the Motif 
window manager, mwm. 

In This Chapter: 

Using Special Keys ................................................................................ 72 
Input Focus and the Window Manager ................................................... 73 
Focusing Input on an Icon .................................................................. 74 
Transferring the Focus with Keystrokes .............................................. 74 
What to do if mwm Dies and the Focus is Lost ................................... 75 
Using the mwm Window Frame ............................................................. 75 
Maximizing a Window ........................................................................ 76 
The Maximize Button ....................................................................... 76 
Resizing a Window ............................................................................ 77 
The Window Menu Button: Display a Menu or Close the Window ....... 80 
Using the Window Menu .................................................................... 81 
Invoking Window Menu items .......................................................... 82 
Pointer Commands to Manage Icons ................................................. 83 
Using the Window Menu on Icons ...................................................... 84 
The Root Menu ...................................................................................... 85 



This chapter is intended primarily for those using the Release 1.1 version of mwm. (Unlike 
the 1.0 version, mwm 1.1 is compatible with Release 4 of X.) If mwm has been customized at 
your site or you are nmning a different version, the principles should be basically the same, 
but the window management functions may be invoked in different ways. From time to time, 
we'll mention how commands or functionality might vary, depending on the version of mwm. 

Using Special Keys 

Undoubtedly you know the basics of using a keyboard. However, X interprets certain keys 
somewhat differently than the labels on the keys would indicate. 
Most workstations have a number of "modifier" keys, so-called because they modify the 
action of other keys. Generally these keys are used to invoke commands of some sort, such 
as window manager functions. 
Three of these modifier keys should be familiar to any user of a standard ASCII terminal or a 
personal computer--Shift, Caps I.xx:k, and Control. However, many workstations have addi- 
tional modifier keys as well. A PC has an "Alt" key, a Macintosh TM has a "fan" key, a Sony 
workstation has keys named "Nfer" and "Xfer," and certain model Sun workstations have 
three additional modifier keys, labeled "Left," '"Right," and "Alternate." 
Because X clients are designed to nm on many different workstations, with different key- 
boards, it is difficult to assign functions to special keys on the keyboard. A developer can't 
count on the same key always being present! 
For this reason, many X clients make use of "logical"modifier keyrtames, which can be 
mapped by the user to any actual key on the keyboard. 
Up to eight separate modifier keys can be defined. The most commonly used (after Shift, 
Caps Lock, and Control) has the logical keyrtame "Meta." We'll talk at length about this subject in Chapter 12, Setup Clients, but we wanted to warn 
you here. When we talk later in this chapter about pressing the "Meta" key, you should be 
aware that there is not likely to be a physical key on the keyboard with that name. For 
example, on one workstation, the Meta key might be labeled "Alt" and, on another, "Funct." 
And as we'll show in Chapter 12, you can choose any key you want to act as the Meta key. 
Unfortunately, X provides no easy way to find out which key on your keyboard has been 
assigned to be the Meta key. When you need to know, please turn to the discussion of key 
mapping in Chapter 12, for information on how you can find out. 

72 X Window System User's Guide, Motif Edition 



Figure 4-2. Maximizing a window 

Resizing a Window 

One of the most distinctive and useful features of the mwm window frame is not at all obvi- 
ous. The entire frame (other than the tidebar--i.e., the tide area and command buttons) is 
designed to allow you to resize the window using the pointer. Nodce that the frame is 
divided by small lines into eight sections: four long borders (two horizontal and two vertical) 
and four corners. Figure 4-3 shows these sections of the window frame. 

If you place the pointer within a window and then move it into one of the long horizontal or 
vertical borders, you'll notice the pointer changes to a new shape: an arrow (,pointing toward 
the window border), with a short line perpendicular to it. This short line represents the win- 
dow border. Try moving the pointer in this fashion in one of the windows on your display to 
get a better idea of what the. pointer looks like. If you move the pointer from within a win- 
dow into the outer border at one of the corners, the pointer will become an arrow pointing 
diagonally at a small corner symbol, as pictured in Figure 4-4. Figure 4-5 shows all of the 
possible resize pointers. 

More about the mwm Window Manager 77 



%1 

horizontal border 

corner 

-- vertical 
border 

Figure 4-3. The outer frame is divided into four long borders and four comers 

%1 

Figure 4-4. Window with resizing pointer 

78 X Window System User's Guide, Motif Edition 



To selec the boxed item (the firs available for selection), you can alternatively 
press either the Return key or the space bar. 

To remove the menu without making a selection, move the pointer off of the menu and 
release or click the first pointer button, as appropriate. 

Most items work similarly to the comparable functions performed using the pointer on the 
flame. The primary difference relates to moving or resizing a window. Using the flame, you 
press and hold down a pointer button, move the pointer, and release the button to complete 
the action. Once you invoke the Move or Size item from the Window Menu (by any of the 
methods described previously), you simply move the pointer (without holding a button 
down); then click the first pointer button to complete the action. 
If you test the various items, you'll iliad that each item works in a fairly predictable way. 
When you select Move, for instance, the pointer changes to the cross-arrow cursor, which 
appears in the center of the window; as you move the pointer, a window outline follows; you 
place the window in its new location by clicking the first pointer button. When you select 
Size, the pointer again changes to the cross-arrow cursor in the center of the window; move 
the pointer into any part of the resize border and the pointer symbol becomes one of the 
resize cursors; as you drag the border or corner, a window outline follows the pointer;, then 
complete the resizing by clicking the first pointer button. 

Pointer Commands to Manage Icons 

In addition to managing windows, rnwm provides several easy methods for managing icons. 
The following functions can be invoked using simple pointer button actions on an icon: 
Move Hold down the first pointer button and drag the icon to the desired position. Then 
release the button. 
Raise Click on the obscured icon with the first pointer button. The icon is raised to the top 
of the stack. (mwm does not allow icons to overlap one another;, you'll need to raise 
an icon only when it's obscured by a window.) 
Restore (Deiconify) 
To convert an icon back to a window, double click on the icon with the first pointer 
button. 
Each of these icon management function using the pointer is described in greater detail in the 
section "Raising, Moving, and Iconifying Windows" in Chapter 3, Working in the X Envi- 

More about the mwm Window Manager 83 



5 

The xterm Terminal Emulator 

This chapter describes how to use xterm, the terminal emulator. You use this 
client to create multiple terminal windows, each of which can run any pro- 
grams available on the underlying operating system. 

In This Chapter: 

Terminal Emulation and the xterm Terminal Type ................................... 90 
Resizing an xterm Window ..................................................................... 91 
Using the Scrollbar ................................................................................ 92 
Copying and Pasting Text Selections ..................................................... 94 
Selecting Text to Copy ....................................................................... 95 
Pasting Text Selections ...................................................................... 97 
More About Text Selections ................................................................... 98 
Copying and Pasting between Release 2 and 3 Clients: xcutsel ........ 99 
Saving Multiple Selections: xclipboard ............................................ 101 

Problems with Large Selections ..................................................... 104 
Editing Text Saved in the xclipboard ............................................... 105 
Running a Program in a Temporary xterm Window ............................... 105 
The xterm Menus ................................................................................. 106 
The Main Options Menu ................................................................... 107 
VT Options Menu ............................................................................. 111 
VT Fonts Menu ................................................................................ 113 
Tek Options Menu ............................................................................ 114 



Using the Scrollbar 

When using xterm, you are not limited to viewing the 24 lines displayed in the window at one 
time. By default, xterm actually remembers the last 64 lines that have appeared in the win- 
dow. If the window has a scrollbar, you can scroll up and down through the saved text. 
To create a single xterm window with a scrollbar, use the -sb command line option: 
To display all xterm windows with a scrollbar by default, set scz:olJ.Baz: in your 
.Xresources file, as described in Chapter 10. The appropriate resource setting is illustrated 
below: 
If an xterm window was not created with a scrollbar, you can add one using the Enable 
Scroilbar item on the V'i" Options menu. See the section "VT Options Menu" later in this 
chapter for instructions on selecting a menu item. 
Many applications provide horizontal and/or vertical scrollbars that allow you to look at a 
window's contents that extend beyond the viewing area. You move text (or images in graph- 
ics applications) in the window by placing the pointer on the scrollbar and performing some 
sort of action. 
xterm's scrollbar is created by the Athena Scrollbar widget. (As we'll see in subsequent 
chapters, several of the standard X clients use Athena scrollbars.) An Athena scrollbar looks 
and operates differently than a scrollbar provided by a Motif application (that is, one created 
using the Motif widget set), as described in Chapter 8. If you're accustomed to using a Motif 
(or even a Macintosh) scrollbar, the Athena scrollbar may take some getting used to. While 
Motif and Mac scrollbars have separate parts to invoke different types of scrolling, the 
Athena scrollbar moves text according to which pointer button you use and how you use it. 
Figure 5-1 shows an xterm window with a scrollbar. 
The Athena scrollbar has two parts: a thumb (the highlighted area within the scrollbar) 
which moves within the scroll region. The thumb displays the position and amount of text 
currently showing in the window relative to the amount saved. When an xterm window with 
a scrollbar is first created, the thumb fills the entire scrollbar. As more text is saved, the size 
of the thumb decreases. The number of lines saved is 64 by default but an alternative can be 
specified with either the -s. command line option or the saver,J.nes value in an 
.Xresources file. 
You scroll through the saved text using various pointer commands. When the pointer is posi- 
tioned in the scrollbar, the cursor changes to a two-headed arrow. The scrollbar commands 
are summarized in Table 5-1. 

92 X Window System Users Guide, Mot# Edition 



% mwm& 
% oclock& 
'% xterm -sb& 

Figure 5-1. An xterm window with a scroiroar 

Table 5-1. Athena Scroiibar Commands 

To move text in 
this direction: 

Either up or down 

Either up or down 

Place pointer 
on scrollbar and: 

Hold down second pointer 
button and drag thumb. 

Click first pointer button. 

Click third pointer button, 

Click second pointer but- 

Notes: 

Text follows pointer movement. 

Scrolls towards latest saved text 
(towards bottom of window). 
Scrolls towards earliest saved text 
(towards top of window). 
Scrolls to a position in saved text 
that corresponds to the pointer's 
position in scroll region. 

The first command in Table 5-1 involves dragging the text in the window using the second 
pointer button. This command is the simplest and offers the most control over how much 
scrolling takes place. To drag the text in this manner:, first place the pointer on the scrollbar;, 
press and hold down the second pointer button; then drag the thumb up and down. Notice 
that text moves as you move the thumb. If you drag up, the window scrolls back toward the 

The xtorm Terminal Emulator 93 



Selecting Text to Copy 

There are several ways to select (copy) text. You can select text by individual words or lines, 
or you can select a passage of text. 
In order to copy text from a window, the window must have the input focus. The click to 
focus input is not interpreted as an attempt to start a text selection. 
There are two methods for selecting a passage of text. First, you can make the selection by 
dragging the pointer:, place the pointer at the beginning of the text you want to select; hold 
down the first button; move the pointer to the end of the desired text; then release the button. 
The text is highlighted, copied into the global cut buffer (called CUT_BUFFER0) and also 
made the PRIMARY selection. 
The second way to select a passage is even simpler, mark the beginning of the selection by 
clicking the first pointer button; then mark the end of the selection by clicking the third 
pointer button. The text between the marks is highlighted, copied into CUT_BUFFER0, and 
made the PRIMARY selection. 
You can select a single word or line simply by clicking. To select a single word, place the 
pointer on the word and double-click the first button.* To select a single line, place the 
pointer on the line and triple-click the first button. 
If you hold the button down after double- or triple-clicking (rather than releasing it) and 
move the pointer, you will select additional text by words or lines at a time. Then release the 
button to ead the selection, 
Table 5-2 lists the possible pointer actions and the selections they make. You always begin 
by placing the pointer on the text you want to select. 

Table 5-2. Button Combinations to Select Text for Copying 

To select 

Passage 

Word 
Line 

Do this 

At the beginning of the selection, hold down the first button; move the pointer 
to the end of the desired text; and release the button. Or:. 
Click the first button at the start of the selection and the third button at the end 
of the selection. 
Double-click the first button anywhere on the word. 
Triple-click the first button anywhere on the line. 

*To be more precise, double-clicking selects all characters of the same class (e.g., alphanumeric characters). By de- 
fault, punctuation characters and whitespace are in a different class from letxers or digits--hence, the observed be- 
havior. However, character classes can be changed. For example, if you wanted to double-click to select email ad- 
dresses, you'd want to include the punctuation characters I, %, @, and. in the same class as leuers and digits. How- 
ever, redefining the character classes is not something you'd do every day. See the xterm reference page in Part 
Three of this guide for detaih. 

The xterm Terminal Emulator 95 



Each selection replaces the previous contents of CUT_BUFFER0 and the previous PRIMARY 
text selection. You can make only one selection at a time. (The xclipboard client, described 
later in this chapter, can be used to store multiple text selections.) 

Once you have made a selection with the fast button, you can extend that selection with the 
third button. This example shows how this works: 

Bring up v/(or any other text editor with which you are familiar) in an xterm window, 
and type in this sample sentence: 

2. Place the pointer on the word graphics in the sample sentence and select it by double- 
clicking the first button. 
3. Then press and hold down the third pointer button. Move the pointer away from the word 
graphics to the left or right. A new selection now extends from the last selection (graph- 
ics) to the pointer's location and looks something like this: 
was developed at MIT in 1984. 
O. 
The X Window System is a network-based graphics window system that 
was developed at MIT in 1984. 

Remember that the extension always begins fom the last selection. By moving the pointer 
up or down, or to the right or left of the last selection, you can use this technique to select 
part of one line or add or subtract several lines of text. 
To select text that fills more than one screen, select the first screenful. Use the scrollbar to 
view the additional text. Then use the third pointer button to extend the selection. The origi- 
nal selection does not need to be in view; clicking the third button will extend it to the point 
you choose. 
To clear the highlighting, move the pointer off the selection and click the first button any- 
where else in the window. Note, however, that the text still remains in memory until you 
make another selection. 
Complications can arise if you're copying text that includes tabs. With the current imple- 
mentation of tlm copy and paste feature, tabs are saved as spaces. If you're copying a large 
amount of text with many tabs from one text file to another, having tabs converted to spaces 
can create problems. A possible workaround is to change all tabs in the first file to some 
unique character or string (using a global command provided by your text editor); copy and 
paste the text into the second file; convert the unique swings back to tabs in both files using 
your text editor. 

96 X Window System User's Guide, Mot# Edition 



To open an xclipboard, type: 
 xca.:L#>oaxd  
You can paste text into the xclipboard window using the pointer in the manner described pre- 
viously and then copy and paste it elsewhere but this is not its intended use. To use the xclip- 
board most effectively, you must do some customization involving a resource file, such as 
.Xresources. The necessary steps are described in detail in Chapter 10. For now, suffice it to 
say that you want to set up the xclipboard so that you can select text to be made the CLIP- 
BOARD selection and have that text automatically pasted in the xclipboard window, as illus- 
trated in Figure 5-6. 
Since the xclipboard client is intended to be coordinated with the CLIPBOARD selection, the 
X server allows you to run only one xclipboard at a time. 
In order to illustrate how the clipboard works, let's presume it has been set up according to 
the guidelines in Chapter 10. According to those guidelines, you make text the CLIPBOARD 
selection by selecting it with the first pointer button (as usual) and then, while holding down 
the first button, clicking the third button. (You could specify another button combination or a 
button and key combination but we've found this one works pretty well.) The first pointer 
action makes the text the PR/MARY selection (and it is available to be pasted in another 
window using the pointer); the second pointer action additionally makes the text the CLIP- 
BOARD selection (and it is automatically sent to the xclipboard window). 
These guidelines still allow you to select text with the first pointer button alone and that text 
will be made the PRIMARY selection; however, the text will not automatically be sent to the 
xclipboard. This enables you to make many selections but to direct to the xclipboard only 
those selections you consider important (perhaps those you might want to paste several 
times). 

,,text 

Figure 5-6. Selected text appears automatically in the xclipboard window 

In order to allow you to store multiple text selections, the seemingly tiny xclipboard actually 
provides multiple screens, each of which can be thought of as a separate buffer. (However, as 
we'll see, a single text selection can span more than one screen.) Each time you use the 
pointer to make text the CLIPBOARD selection, the xclipboard advances to a new screen in 
which it displays and stores the text. 

102 X Window System User's Guide, Motif Edition 



Tek Opt=ons 
Large Characters 
#2 Size Characters 
#3 Size Characters 
Small Characters 

PAGE 
RESET 
COPY 

Show VT Window 
Switch to VT Mode 
Hide Tek Window 

Figure 5-13. The Tek Options menu 

The xterm Terminal Emulator 

115 



6 

Font Specification 

This chapter describes what you need to know in order to select display fonts 
for the various client applications. After acquainting you with some of the 
basic characteristics of a font, this chapter describes the rather complex font 
naming conventions and how to simplify font specification. This chapter also 
describes how to use the xlsfonts, xfd, and xfontsel clients to list, display, 
and select available screen fonts. 

In This Chapter: 

Font Naming Conventions .................................................................... 120 
Font Families ................................................................................. :. 121 
Stroke Weight and Slant .................................................................. 124 
Font Sizes ....................................................................................... 124 
Other Information in the Font Name ................................................. 127 
Font Name Wildcarding ........................................................................ 129 
The Font Search Path .......................................................................... 131 



-adobe-new centtu    -schoolbook-medium-r-: 
-adobe-new century schoolbook-n 

Fure 6-6. The l O0-dpi version of a 24-point font appears larger on a 75-dpi monitor 

Other Information in the Font Name 

What we've already shown summarizes the most importam information in the font name. 
The remaining fields axe explained below: 
Foundry Font mamdacture m'e still ref to as fouadries, from the days vhen 
type was cast from lead. The X font naming convention spees the fo- 
dr/as the company that digitized or last modified the font, raher tl'_n its 
For the fonts contained in the standard X distrilxttion, the foundry, is not 
temly sign/ficant since there are no cases v,h,= the same font family is 
avm'lable from different foundries. However, there m'e numerous commer- 
cial font families available from more than one foundS.. In ge.-'al, the 
appearar, ce of the fonts should be quite  since  font family de.nes 
the design of the typeface. However, there may be some small dJ.ffe.'aces 
in the quality of some of the characters, and  may be more 
differences in the font mewics (the vertical or horizontal measurements of 
the characters). This might be significant for a publL",ing atplicafion that 
was using the bitmupped font for a w)'s/,?,'g" 'reen d2splay that n g,., 
match the fonts in a particular laser printer or t2,.'pesec. 
Set width A value bmg a font's propornate widga, accord2ng to the fou"y. 
double width. All of the Release 3 fonts and most of the Release . fonts 
have the set width normal A few of the Release 4 fonts have the set 
Spacing All standard Release 3 fonts are ei m (monospace, i.e., fixed-widr.h) or p 
(prortional, i.e., variable-vAdth). In Release ., fonts may also have tie 
spacing cham:teristic c (character cell, a fixed-widga font based on the 
ditional typev, zitea" model, in which each charter can be thought to take 
up the space of a "box" of the same height and wkkh). As mentioned ear- 
tier, the original R2 fonts were this t-pe. 

Font Speccation 127 



If you would still like to emulate Release 2 conventions in Releases 3 or 4, you must expli- 
citly assign every font name an alias corresponding to the name of the file in which it is 
stored without the .snf extension. This could actually be done rather easily by editing a copy 
of each fonts.dir file and appending the copy to the fores.alias file in the same directory. (If 
you are running Release 3, remember that neither the 75dpi nor the lOOdpi directory has a 
defadt fonts.alias file. You may need to create one, rather than append to an existing one. 
These aliases could also be appended to the fores.alias file in the misc directory, since the 
server searches all directories in the font path.) 

Once the server is made aware of aliases, you can stxif'y an alias on the command line. For 
example, you can use a font name alias as an argument to x/'d. If you've used an alias file or 
files to emulate the Release 2 font naming conventions, you can display the font stored in the 
file courR12.snf using the command: 

 xcl-n oour12 

A stxial note about the ndsc directory:, when X was configured for your system, a 
fores.alias file should have been created in this directory. The first two entries in this file are 
shown below: 

fixed -misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso8859-1 
variable -*-helvetica-bold-r-normal-*-*-120-*-*-*-*-*-* 

The default file contains an additional 56 entries but the entries pictared above are particu- 
larly important. The aliases called "fixed" and "variable" are invoked as the default fonts for 
many clients. The "fixed" font can be thought of as a system-wide default. The "variable" 
font, described in the right column as a 12-point bold Helvetica font, is used as the default 
font by bitmap, as well as by other clients. If this file is removed or replaced, when you run 
bitmap, you'll get an error message that the server cannot open the variable font, and text in 
the b/tmap window will display in the smaller, somewhat less readable "fixed"font. 
If you do choose to edit the fonts.alias file in the ndsc directory, it is important to preserve at 
least these two aliases. (As we've said, it's probably a bettor idea to keep all the default 
entries and merely append any new ones.) 
If you're running Release 3, the fonts.alias file in the misc directory will be somewhat differ- 
ent. The Release 3 version of the fores.alias file in the misc directory comprises only these 
two lines: 
fixed 6x13 
variable *-helvetica-bold-r-normal-*-*-I 4 0-* 
Regardless of what edits you make to the file, the line specg the variable alias must not 
be changed. 
The variable font is slightly larger in Rdease 3 (14-poin0 than in Release 4 (12-point). If 
you examine the Release 3 alias file a tittle more closely, you may notice that the first line 
contims an incorrect alias specification. Remember, in Release 3, fixed is actually the name 
of the default system font--it is not an alias. The first column should contain aliases; the sec- 
ond column should contain proper font names. However, 6x13 is not a proper font name. It 
is actually the name of the file that contains the font named fixed. You can specify fixed as a 
font on the command line and it will work---but as a font name, not an alias. 

Font Specification 

135 



7 

Graphics Utilities 

This chapter describes how to use the major graphics clients included with X, 
notably the bitmap editor. 

In Tiffs Chapter: 

Creating Icons and Other Bitmaps ....................................................... 147 
Bitmap Editing Commands ............................................................... 150 
Pointer Commands ........................................................................ 151 
Bitmap Command Boxes ............................................................... 151 
Acting on the Entire Grid: Clear All, Set All, Invert All .................... 151 
Acting on an Area: Clear Area, Set Area, Invert Area .................... 153 
Copy Area, Move Area, Overlay Area ............................................ 154 
Drawing: Line, Circle, Filled Circle ................................................. 155 
Filling in a Shape: Flood Fill .......................................................... 156 
Hot Spots: Set Hot Spot, Clear Hot Spot ....................................... 156 
Saving and Quitting: Write Output, Quit ......................................... 156 

Dialog Boxes and Command Buttons ............................................. 157 
Creating a Bitmap from a Cursor ...................................................... 158 
Magnifying Portions of the Screen: xmag ........................................ 162 
Quitting xmag ................................................................................ 163 
What xmag Shows You .................................................................. 163 
Dynamically Choo.sing.a Different Source Area .............................. 165 
The Portable Bitmap Toolkit ............................................................. 165 



4. Move the pointer to the desired location and click any button. 
OR: 
Press and hold any button to see the outline of the destination rectangle, move the pointer 
to the desired location, then release the button. 
5. To cancel an overlay, copy, or move command, move the pointer outside the grid and 
release the button. 

Drawing: Line, Circle, Filled Circle 
When you use a drawing command, the drawing is always done in the foreground color. 
Line Draws a line between any two points you selecL 
Circle Draws a circle. You specify the center and the radius. 
Filled Circle Draws a filled circle. You specify the center and the radius. 

Clear All 
Set All 
[ InvertAII ] 
Clear Area 
l SetArea 
I InvertArea I 
I CopyArea 
I MoveArea I 
Overlay Area 

Line I 

Circle 

I Filled Circle I 

Figure 7-8. Selecting center and radius of circ/e 

To draw a line or circle: 
1. Click the pointer over the command Line, Circle, or Filled Circle. The pointer changes to 
the dot cursor shape (-). 
2. Move the pointer to the first point of the line or to the center of the circle. Click any but- 
ton. An X falls the square which is the starting point of the line or center of the circle. 
3. Move the pointer to the end point of the line or to the outside circumference of the circle. 
Click any button. The graphic is drawn. 

Graphics Utilities 

155 



Figure 7-12. /tmp/gumby.array 

You can then use the atobm client to convert this array to a bitmap. Use the gumby.array file 
as an argument and redirect the output to a bitmap file: 
Figure 7o13 shows the Gumby bitrnap. As you can see from the bitmap, the Gumby character 
of the cursor font is considerably smaller than the Gumby we created ( Figure 7-3) with bit- 
map. 
If you want, you can then edit the gumby.bitmap file using the bitmap client. 
If you specify the unedited bitmap as the root window pattern, you'll nodce that there is vir- 
tually no space between the Gumby figures. This is because the array file had no extra 
hyphens (representing empty bitmap squares) padding it. If you want, you can add some 
hyphens to the gumby.array file (keeping the image symmetrical) and then use atobm to cre- 
ate a more padded version of the bitmap. Figure 7-14 shows the gumby.array file after it was 
padded with hyphens. 
See the bitmap reference page in Part Three of this guide for more information on the atobm 
and bmtoa conversion clients. 

160 X Window System User's Guide, Motif Edition 



Clear All I 

Set All I 

Invert All I 

I Clear Area I 

Set Area 

Invert Area 

I Cop/Area I 
I Move Area I 

Overlay Area I 

I Line I 

Circle I 

I Filled Circle I 

Figure 7-13. Bitmap of the Gumby cursor 

! .... 
If--! .... 
-If--! ..... 
II--I-III-I 
IIIII ..... 
Ill ..... 
I ..... I--III 
I ..... I--III 
I--I--I-IIII 
I--I--I--III 
I--I--I 
I---I---I 

Figure 7-14. gumby.array padded by hyphens 

Graphics Utilities 161 



8 

Other Clients 

This chapter gives an overview of other clients available with X, including 
window and display information clients, printing utilities, the xkill program, 
and several "desk accessories." It also examines some of the features com- 
mon to applications written with the Motif Toolkit. 

In This Chapter: 

Desk Accessories ................................................................................ 172 
Clock Programs: xclock and oclock ................................................. 172 
Removing an xclock or oclock ........................................................ 174 
A Scientific Calculator: xcalc ........................................................... 175 
Terminating the calculator .............................................................. 176 
Mail Notification Client: xbiff ............................................................ 176 
Monitoring System Load Average: xload ......................................... 177 
Browsing Reference Pages: xman .................................................. 178 
The xedit Text Editor ........................................................................ 183 
Printing Utilities: xwd, xpr, xdpr ........................................................... 189 
Killing a Client Window with xkill ........................................................... 191 
Problems with Killing a Client ........................................................... 192 
Window and Display Information Clients .............................................. 194 
Displaying Information about a Window: xwininfo ............................ 194 
Listing the Window Tree: xlswins ..................................................... 196 
Listing the Currently Running Clients: xlsclients .............................. 198 
Generating Information about the Display: xdpyinfo ........................ 200 
User-contributed Clients ...................................................................... 200 
Previewing Colors for Your Monitor: xcol ......................................... 201 
Working with Motif Applications ............................................................ 204 
Dialog Boxes and Push Buttons ....................................................... 204 
Menu Bars and Pull-down Menus ..................................................... 206 
File Selection Box ............................................................................ 208 



Selecting a File from the Files Box ................................................. 210 
Choosing a File from another Directory in the Directories Box ........ 210 
Choosing a File from Another Directory on the System .................. 210 
The Motif Scrollbar ........................ '. .................................................. 212 
Drawn Buttons ................................................................................. 213 
Radio Boxes and Toggle Buttons ..................................................... 214 



This sample listing indicates that there is one xterm window and one xclock window running 
on the display colorful. (The option -is following the xerm command reveals that the 
shell running in this window is a login shell.) 
You can use xlsclients to create an .xsession or .xinitrc file, which specifies the clients you 
want to be run automatically when you log in. In order to do this, you must have set up client 
windows in an arrangement you like using command line options alone (that is, without hav- 
ing moved or reshed windows via the window manager). You can then run xlsclients to print 
a summary of the command lines you used to set up the display and include those command 
lines in your .xsession or .xinitrc file. See Appendix A, System Management, for information 
on setting up a user session. 
By default, xlsclients lists the clients running on the display corresponding to the DISPLAY 
environment variable, almost always the local display. You can list the clients running on 
another display by using the -display command line option. See Chapter 3, Working in 
the X Environment, for more information about the -display option. 
With the option -1 (indicating long), xlsclients generates a more detailed listing. Figure 
8-19 shows the long version of the listing on the previous page. 
Window 0x3O000e: 
Machine : colorful 
Name : xterm 
Icon Name : xterm 
Command: xterm-geometry 80x24+i0+i0 -is 
Instance/Class : xterm/XTerm 
Window 0x40000b: 
Machine : colorful 
Name : xclock 
Icon Name : xclock 
Command: xclock -geometry -0-0 
Instance/Class : xclock/XClock 

Figure 8-19. Long xlsclients listing 

For each client, xlsclients displays six items of information: the window ID number, machine 
name, client name, icon name, command line used to run the client, and the instance and 
class resource names associated with the client. 
As we'll see in Chapter 9, many clients, including xterm, allow you to specify an alternate 
name for a client and a title for the client's window. If you've specified a tide, it will appear 
in the xlsclients Name field. }f you haven't specified a tide but have specified a name for the 
application, the name will appear in this field. Neither of the clients in the sample display 
has been given an alternate name or tide. 
You use the instance and class resource names to specify default window characteristics, gen- 
erally by placing them in a file in your home directory. This is described in detail in Chapter 
10, Setting Resources. 

Other Clients 199 



Filter 
J- lwork/motifldem0mre/* 

Directories .:. 
motif/demos/mre/.. 

-' Selection 
- I - two rk/motifldemos/m re/ 
. 

Files 
Imakefile 
Makefile 
Makefile.bak 
README 
mre 
mre.c 
mre.h 
:.....:.. ::: .-.. : ..:..:........: 

Figure 8-24. A file selecb'on box 

The file selection box allows you to select a file fxom any directory on the system, using vari- 
ous procedures. You can select a file from the list currently in the Filos box; you can list the 
files in another directory currently displayed in the the Directories box and select one of those 
files; or you can list the contents of an entirely different directory and select a file from that 

Other Clients 209 



Drawn Buttons 

A drawn button is a push button decorated with a pixmap rather than a text label. Figure 
8-26 shows four drawn buttons from mre's main window. 

_File E_dit View _Options 

drawn  
buttons 

Items 

Mwm*UselconBox: True 
Mwm*iconBoxGeometry: 2x2 
xcalc*rpn: on 
xedit*enableBackups: on 
xfd*foreground: white 
xfd*background: black 
xfd*borderColor: MediumPurple 

Figure 8-26. Four drawn buttons 

The image on a drawn button should signal its function. If a program uses drawn buttons 
effectively, they can enhance an application's aesthetics. 

mre uses drawn buttons well. The button decorated with an artist's palette tells mre to place 
resource specifications relating to color in the application's editing window. The button 
showing the letter "A"phat resources specifying fonts in the editing window. The button 
featm'ing the mirror image of the arrows in reverse colors is a rather clever graphical repre- 
sentation of a difficult concepL The image is a sort of technical yin-yang symbol: it tells rare 
to place resources that can be toggled (turned on or off; set to be true or false, yes or no, etc.) 
in the editing window. Finally, the button featuring the eternity symbol tells rare to put all of 
the resources in the user's resource file in the editing window. 

Other Clients 213 



Part Two: 

Customizing X 

X has been designed to put the user in the driver's seat. Everything from the 
colors and sizes of windows to the contents of mwm menus can be custom- 
ized by the user. This part of the book tells you how to reshape X to your 
liking. 

Command Line Options 
Setting Resources 
Customizing mwm 
Setup Clients 



9 

Command Line Options 

This chapter describes command line options that are common to most cli- 
ents. Some arguments to command line options can also be specified as the 
values of resource variables, described in Chapter 10, Setting Resources. 
For example, the format of a geometry string or a color specification is the 
same whether it is specified as an argument to an option or as the value of a 
resource definition. 

In This Chapter: 

Window Title and Application Name ..................................................... 221 
Starting a Client Window as an Icon ..................................................... 221 
Specifying Fonts on the Command Line ............................................... 222 
Reverse Video ..................................................................................... 222 
Specifying Color .................................................................................. 222 
The rgb.txt File ................................................................................. 223 
Release 4 Color Names ................................................................... 223 
Alternative Release 4 Color Databases ............................................ 225 
Hexadecimal Color Specification ...................................................... 226 
The RGB Color Model .................................................................... 226 
How Many Colors are Available? ................................................... 227 
Border Width ....................................................................................... 229 



10 

Setting Resources 

This chapter describes how to set resource variables that determine applica- 
tion features such as color, geometry, fonts, and so on. It describes the syn- 
tax of resource definition files such as .Xresources, as well as the operation 
of xrdb, a client that can be used to change resource definitions dynamically 
and make resources available to clients running on other machines. 

In This Chapter: 

Resource Naming Syntax .................................................................... 234 
Syntax of Toolkit Client Resources ................................................... 235 
Tight Bindings and Loose Bindings .................................................. 236 
Instances and Classes ..................................................................... 236 
Precedence Rules for Resource Specification .................................. 237 
Some Common Resources .............................................................. 239 



of which is generally a modifier key. If you want to modify a command, you should use an 
alternative key combination, rather than a single key. 
For example, the following table offers two suitable wanslaxions: 
*Text*Translations : |override\ 
Meta<Key>f : next-page ( ) \n\ 
Meta<Key>b: previous-page ( ) 
The first translation specifies tlmt pressing the key combination Meta-f moves the cursor 
ahead one page in the file (scrolls the file forward one window); the second translation speci- 
fies that Meta-b moves the cursor back one page. The actions performed are fairly obvious 
from their names. For a complete list of actions recognized by the Text widget, see Appen- 
dixG. 
For more information about events, actions, and translation table syntax, see Appendix 
F, Translation Table Syntax, and Volume Four, X Toolkit Programming Manual. 
Though mwm does not provide actions that can be modified using a wanslation table, you can 
change the key and pointer button events used to invoke window manager functions by edit- 
ing a special file called .mwmrc in your home directory. See Chapter 11, Customizing mwm, 
for details. 

How to Set Resources 

Learning to write resource specifications is a fairly manageable task, once you understand the 
basic rules of syntax and precedence. In contrast, the multiple ways you can set 
resources--for a single system, for multiple systems, for a single user, for all users--can be 
confusing. For our purposes, we are primarily concerned with specifying resources for a 
single user running applications both on the local system and on remote systems in a net- 
work 
As we've said, resources are generally specified in files. A resource file can have any name 
you like. Resources are generally "loaded" into the X server by the xrdb client, which is nor- 
mally run from your startup file or run automatically by xdm when you log in. (See Appendix 
A, System Management, for information about startup files and xdm.) Prior to Release 2 of 
X, there was only one resource file called .Xdefaults, placed in the user's home directory. If 
no resource file is loaded into the server by xrdb, the .Xdefaults file will still be read. 
Remember that X allows clieiats to run on different machines across a network, not just on 
the machine that supports the X server. The problem with the older .Xdefaults mechanism 
was that users who were running clients on multiple machines had to maintain multiple .Xde- 
fau/ts files, one on each machine. By contrast, xrdb stores the application resources directly 
in the server, thus making them available to all clients, regardless of the machine on which 
the clients are nmning. As we'll see, xrdb also allows you to change resources without edit- 
ing files. 
Of course, you may want certain resources to be set on all machines and others to be set only 
on particular machines. See the section "Other Sources of Resource Definition" later in this 

Setting Resources 247 



11 

Customizing mwm 

This chapter describes the syntax of the .mwmrc startup file that can be used 
to customize the operation of the mwm window manager. It describes how to 
bind functions to keys and how to define your own mwm menus. This chap- 
ter also explains how to set up mwm to use an icon box, a window in which 
icons on the display can be organized. 

In This Chapter: 

Activating Changes to the Window Manager .................................... 260 
The system.mwmrc File ................................................................... 260 
mwm Functions ............................................................................. 263 
Menu Specifications ....................................................................... 263 
Key Bindings ................................................................................. 265 
Button Bindings ............................................................................. 266 
Customizing the Root Menu ........................................................... 268 
Creating New Menus ..................................................................... 269 
Cascading Menus .......................................................................... 269 
Setting mwm Resources .................................................................. 271 
Component Appearance Resources ............................................... 271 
mwm-Specific Appearance and Behavior Resources ..................... 272 
Client-Specific Resources .............................................................. 273 
Setting the Focus Policy ................................................................ 274 
Using an Icon Box ......................................................................... 275 



12 

Setup Clients 

This chapter describes three useful setup clients that can be used to custom- 
ize the appearance of your display, and the operation of your keyboard and 
pointer. 

In This Chapter: 

xset: Setting Display and Keyboard Preferences ................................. 283 
Keyboard Bell ................................................................................ 283 
Bug Compatibility Mode ................................................................. 284 
Keyclick Volume ............................................................................ 284 
Enabling or Disabling Auto-repeat .................................................. 285 
Changing or Rehashing the Font Path ........................................... 285 
Keyboard LEDs ............................................................................. 285 
Pointer Acceleration ....................................................................... 286 
Screen Saver ................................................................................. 286 
Color Definition .............................................................................. 287 
Help with xset Options ................................................................... 287 
xsetroot: Setting Root Window Characteristics .................................... 288 
Setting Root Window Patterns .............................................  ........... 288 
Foreground, Background Color and Reverse Video .......................... 289 
Changing the Root Window Pointer .................................................. 290 
xmodmap: Modifier Key and Pointer Customization ............................ 291 
Keycodes and Keysyms ................................................................... 293 
Procedure to Map Modifier Keys ...................................................... 294 
Displaying the Current Modifier Key Map ......................................... 294 
Determining the Default Key Mappings ............................................ 295 
Matching Keysyms with Physical Keys Using xev ............................ 296 
Changing the Map with xmodmap .................................................... 297 
Expressions to Change the Key Map ............................................. 298 
Key Mapping Examples. ................................................................ 299 
Displaying and Changing the Pointer Map ........................................ 301 



The -mot option sets a plaid-like grid pattern on the root window. You specify the horizon- 
tal (x) and vertical (y) dimensions in pixels of each square in the grid. The syntax of the 
option is: 
-rood x y 
where the parameters x and y are integers ranging from 1 to 16 (pixels). (Zero and negative 
numbers are taken as 1.) 
The larger the x and y values you specify, the larger (and more visible) each square on the 
root window grid pattern. Try the command: 
% xstroot -md 16 16 
for the largest possible grid squares. Then test different x and y specifications. 
The xsetroot option: 
-solid color 
sets the color of the root window to a solid color. This can be a color from the color name 
database or a more exact color name specified by its RGB value. 
The command: 
% xtroot -olid lightblu 
sets the color of the root window to light blue.* See Chapter 9, Command Line Options, for 
more information on how to specify colors. 

Foreground Color, Background Color, and Reverse Video 

In addition to specifying a solid color for the root window pattern, xsetroot allows you to 
specify foreground and background colors if you set the pattern with -bitmap or -mot. 
The standard Toolkit options are used to set foreground and background colors: -fg and 
-bg. The defaults are black and white. 

Colors can be specified as names from the color name database, or as RGB values. See 
Chapter 9, Command Line Options for more instructions on how to specify color. 

If you specify reverse video (-rv), the foreground and background colors are reversed. 

*For technical reasons, colors set with x s e t r o o t -s o i i d may change unexpecmdly. When you set a color with 
the -solid option to xsetroot, the client allocates a colorcell, sets the color, and deallocates the colorcelL The root 
window changes to that color. If another client is started that sets a new color, it allocates the next available color- 
cell--which may be the same one xsetroot just deallocated. This results in that color changing to the new color. The 
root window also changes to the new color. If this happens, you can run xsetroot again and if there are other color- 
cells available, the root window changes to the new color. If all colorcells are allocated, any call to change a colorcell 
results in an error message. 
While this behavior may seem to be a serious bug, it is actually an optimization designed to ensure applications don't 
run out of colors unnecessarily. Free colon'nap cells can be a scarce resource. See Volume One, Xlib Programming 
Manual, for more information. 

Setup Clients 289 



modl Meta L (Ox7f), Meta R (0x81) 
mod2 
mod3 
mod4 
mod5 
The key with the kcysym Conuol_L functions as a Lock key and the key with the kcysym 
Caps_Lock functions as a Conuol key. 
Second, zmodm allows you to assign any kcysym to any other key. For example, you 
might make the Backspace key function as a Delete key: 
Then when you display the keymap table and grep for the Delete kcysym, you'll see that it is 
assigned twice. On the command line of an xerm window, type: 
and you'll get two lines from the current keymap table, similar to these: 
50 Oxffff (Delete) 
73 Oxffff (Delete) 
The 50 and 73 are keycodes representing two physical keys. As you can see, both of these 
keys .now function as Delete keys. 
This example suggests some of the confusion you can experience using xmodmap. We know 
that one of these keys previously functioned as the Backspace key. But how can we tell 
which one? Here is an instance when our default keymap table comes in handy. If you've 
run xmodmap -pk and redirected it to a file before changing any mappings, you can check 
the file for the keysyms originally associat with the keycodes 50 and 73. In this case, the 
file tells us 50 originally was Backspace and 73 was Delete. 
Of course, you could also figure out the original assignments by remapping one of the key- 
codes to Backspace. Then, if the key marked Backspace functions as marked, you know 
you've mapped the keysym to the original keycode. But, as you can see, the default keymap 
table can greatly simplify mae. 
This example also implies that there are advantages to using expressions of the form: 
keycode number = keysymname 
This expression syntax requires you to be aware of default keycode/keysym assignments. 
Also, if you explicitly assign a keysym to a particular keycode, it's much easier to keep track 
of what you're doing and retrace your steps if necessary. On the down side, though keysyms 
are portable, keycodes may vary from server to server. Thus, expressions using this syntax 
cannot be pormd to other systems. 

300 X Window System User's Guide, Motif Edition 



Motif window manager (continued) mwm 

mwm recognizes the following functions: 
f. beep 
Causes a beep from the keyboard. 
f.circle down[icon I window] 
-- 
Causes the window or icon on the top of the stack to be lowered to the bottom of the 
stack. If the icon argument is specified, the function applies only to icons. If the 
window argument is specified, the function applies only to windows. 
This function is invoked by the Shuffle Down item on the default Root Menu. 
f.circle_up [icon I window] 
Causes the window or icon on the bottom of the stack to be rinsed to the top. If the 
icon argument is specified, the function applies only to icons. If the window argu- 
ment is specified, the function applies only to windows. 
This function is invoked by the Shuffle Up item on the default Root Menu. 

f. exec [command] 

command] 
Executes command using the shell specified by the MWMSHELL environment vari- 
able. (If MWMSHELL isn't set, the command is executed using the shell specified by 
the SHELL environment variable; otherwise, using/bin/sh). 

f.focus color 
Sets the colormap focus to a client window. If this function is invoked in the root 
context, the default colormap (specified by X for the screen where mwm is running) is 
installed and there is no specific client window colormap focus. For the 
f. focus_color function to work, the colormapFocust:'olicy should be speci- 
fied as explicit; otherwise the function is treated as f. hop. 

f. focus_key 
Sets the input focus to a window or icon. For the f. focus_key function to work, 
the keyboardFocusPolicy should be specified as explicit. If keyboard- 
FocusPolicy is not explicit, or if the function is invoked in the root context, 
it is treated as f. nop. 

f. kill 
Terminates a client. Specifically, sends the WM_DELETE_WlN[X)W message to the 
selected window if the client application has requested it through the WM_PROTO- 
COLS property. The application is supposed to respond to the message by removing 
the indicated window. If the WM_SAVE_YOURSELF protocol is set up and the 
WM_DELETE_W[NDOW protocol is not, the client is sent a message, indicating that 
the client needs to prepare to be terminated. If the client does not have the 
WM_DELETE_WINDOW or WM_SAVE_YOURSELF protocol set, the f. kill function 
causes a client's X connection to be terminated (usually resulting in termination of the 
client). 

X Window System User's Guide Copyright@ 1990 O'Reilly & Associates 351 



xmh (continued) X Interface to mh 

MenuButton sequenceButton 
MenuButton viewButton 
MenuButton optionButton 
Grip grip 
Label folderTitlebar 
Grip grip 
Viewport.Core folders.clip 
Box folders 
MenuButton inbox 
MenuButton drafts 
SimpleMenu menu 
SmeBSB <folder name> 

Grip grip 
Label tocTitlebar 
Grip grip 
Text toc 
Scrollbar vScrollbar 
Grip grip 
Label viewTitlebar 
Grip grip 
Text view 
Scrollbar vScrollbar 
Scrollbar hScrollbar 

The hierarchy of the Create Folder popup dialog box: 

transientShell prompt 
Dialog dialog 
Label label 
Text value 
Command okay 
Command cancel 

The hierarchy of the Notice dialog box, which reports messages.from mh: 

transientShell notice 
Dialog dialog 
Label label 
Text value 
Command confirm 

The hierarchy of the Conftrmalion dialog box: 

transientShell confirm 
Dialog dialog 
Label label 

474 X Window System User's Guide Copyright@ 1990 O'Reilly & Associates 



Part Four-. 

Appendices 

This part of the book contains useful reference information. 

System Management 
Release 4 Standard Fonts 
Standard Bitmaps 
Standard Cursors 
xterm Control Sequences 
Translation Table Syntax 
Athena Widget Resources 
Glossary 

Index 



A 

System Management 

This appendix discusses various tasks involved in X Window System man- 
agement, mostly from the UNIX point of view. 

In This Appendix: 

Including X in Your Search Path ........................................................... 556 
Setting the Terminal Type .................................................................... 556 
A Startup Shell Script ........................................................................... 557 
What Should Go in the Script ........................................................... 557 
Starting X ............................................................................................ 562 
Starting X with the Display Manager, xdm ........................................ 562 
Getting Started with xdm on a Single Display ................................. 563 
Setting Up the Configuration File and Other Special Files ............... 563 
The Standard Login Session .......................................................... 566 
Customizing xdm ............................................................................. 567 
The Xservers File ........................................................................... 568 
The Xsession File and .xsession Scripts ........................................ 570 
The Xresources File ....................................................................... 570 
The Error Log File .......................................................................... 570 
The xdm-pid File ............................................................................ 570 
Xstartup and Xreset ....................................................................... 571 
Security and the authorize Resource ............................................. 571 
Stopping xdm and the Server ........................................................... 571 
X Terminals and the XDM Control Protocol ...................................... 571 
Starting X with xinit .......................................................................... 572 
Server Access Control ......................................................................... 573 
Host-based Access and the xhost Client .......................................... 573 
User-based Access: xdm and the .Xauthority File ........................... 574 
Font Management ................................................................................ 575 
Adding a Font to Your Server ........................................................... 576 



Converting Fonts and Updating fonts.dir ........................................ 576 
Making the Server Aware of Font Changes .................................... 576 
Console Messages .............................................................................. 577 
Log Files .............................................................................................. 578 
Changing the Color Name Database .................................................... 578 



A C shell script that starts up a few xterms and then exits will probably work because the 
xterm's parent process (the script) has exited by the time the xterms start defining their 
Idevltty. If, however, there is a sleep or another command that takes a long time in the script 
after the line invoking the xterm, the parent may still be around when the xterm defines 
/dev/tty. Then, when the script finally exits, Idevltty becomes undefined for those xterms. 
If you want to use a C shell script, this problem can be avoided by enclosing commands in 
parentheses. This causes the shell to fork an extra time before executing the command, and 
thus disassociates the process from the controlling terminal before the process begins. 
Whether you are using a C shell or Bourne shell script, you should make the last command in 
the script be one that opens a window, and run that command in the foreground. Then the 
script will not terminate until that final foreground command terminates--that is, when you 
kill the window. In this case, all the xterms will have the script's controlling tty but since the 
script is guaranteed to hang around, this causes no problem. 
If you want to run remote processes in your startup script, it's a good idea to set the DISPLAY 
variable inside the script. You can then run a client on a remote machine, but specify that the 
window be created on your local display by by using the DISPLAY variable as the argument 
to the -display option. 
As explained in Chapter 3, Working in the X Environment, clients running on the local 
machine access the DISPLAY variable to determine on which physical display to create win- 
dows. Without explicit settings, both xdm and xinit will automatically set DISPLAY to 
unix : 0.0 (or some variation thereof), which defaults to the local host. 
If you only run processes on the local host, you don't have to deal with issues involving the 
DISPLAY setting. However, if you want to run a process on a remote machine and display the 
results locally, things become more complicated. A client running on a remote machine does 
not have access to the DISPLAY variable on the local machine. By default a client running on 
a remote machine checks the DISPLAY setting on that machine. 
You can override the DISPLAY environment variable that a client accesses by using the 
-display option when you run the command. Think of -display as a pointer to the 
physical display on which you want the window to appear. In order to tell a client to connect 
to a display, you must identify it by its unique name on the network. (You cannot identify 
your display by the setting given to it by xinit or xdm--unix : 0.0, : 0.0, or some varia- 
tion.) 
We suggest you set the DISPLAY explicitly to the display's unique network name. For a 
workstation or other single-user system, you should determine the appropriate host name 
with the hostname command, as shown in the script below. 
Note that the hostname command is a BSD command. For a System V equivalent, see your 
UNIX documentation. Note also that in this script, sed is used to strip domained-based host- 
names such as isla.ora.com back to their initial term, the actual system name. If you are run- 
ning in a standalone environment, this is not necessary. 
Once DISPLAY is set, you can easily run a client on a remote machine and specify that the 
window be created on the local display, using a command line similar to: 
% rsh oz xtrm -display $DISPLAY 

558 X Window System User's Guide, Motif Edition 



Example A-2. Startup Bourne shell script for an X terminal (continued) 

xset c off s 420 
mwm & 
xterm -geometry 80x22+0-0 & 
xterm -geometry 80x22+530-0 & 
rsh ora xterm -geometry 80x28+0+135 -display $DISPLAY & 
xclock -digital -update 1 -geometry -0+0 & 
xcalc -geometry -0+75 & 
xload -geometry -0+350 & 

Use this line with xinit; comment out if you use xdm 

exec xterm -C -geometry 80x5+0+0 

| Uncomment this line if you use xdm 
| exec xterm -C -Is -geometry 80x5+0+0 

% % 

Figure A- 1. Display after running either sample script 

Note that all programs that create windows (and hence don't run quickly and then go away) 
are run in the background, with the exception of the final xterm window. This will cause the 
script to simulate the behavior of the console xterm normally started by xinit or xdm. The -C 
option specified with the console xterm window redirects messages sent to Idevlconsole to 
that xterm window. This option is only supported in some implementations of X; see your 
documentation. For additional information, see the section "Console Messages" later in this 
appendix. 

System Management 561 



However, xdm has far more powerful and versatile capabilities. Users can design their own 
login sessions, using .xsession files. You can also customize special xdm files to manage sev- 
eral connected displays (both local and remote), and to set system-wide and user-specific X 
resources. 
A not-so-obvious limitation of xdm is that it does not work well if you are using other win- 
dow systems (in addition to X). If you want to use multiple window systems on the same 
hardware, you should continue to use xinit for the time being. Future releases of xdm should 
overcome these limitations. 
The functionality of xdm has been expanded in Release 4, though many features have not 
changed since Release 3. The following sections describe the Release 4 version of xdm. 
Release 4 specific features are noted. 
First, we'll give you the basics of using xdm to run X on a single display and then give you 
some tips on how to design your own user session and manage multiple displays. 

Getting Started with xdm on a Single Display 

To have xdm run X on a single display, the system administrator should perform three simple 
tasks: 
1. Set up the xdm configuration file and other special files, as described in the next section. 
2. Put the line iusribiniXllixdm at the end of letclrc or other similar system startup file. 
3. It's also a good idea to turn off the "console" in letcittys on a single-user workstation, 
although this is discretionary. (As we'll see, the display manager provides its own login 
window. Turning off the console prevents the standard UNIX prompt from being simulta- 
neously displayed on the full screen when xdm is started. Keep in mind this will also pre- 
vent system messages from being sent to the console but they should still be saved in 
iusrladmimessages.) How you'd turn off the "console" depends on the version of UNIX 
you are running. The procedur and the system file you edit may differ from system to 
system. Seg the getty(8) and irdt(8) reference pages in your UNIX documentation for 
details. 

Once you perform these steps, as long as UNIX is running, xdm should keep the X server run- 
ning, allow users to log on and off, and manage a simple login session. The following sec- 
tions describe the steps you need to get started with xdm in greater detail. 

Setting Up the Configuration File and Other Special Flies 

In order to run X, xdm uses a configuration file and several special files that specify such 
things as the server, basic login session, and an error log file. 

System Management 563 



Be aware that xdm should be able to work in a very rudimentary fashion without any special 
files. However, a problem with Release 4 may require that at least two of the special files be 
present (namely, xdm-con.lig and Xservers). These limitations should be removed by patches 
to the release. If this bug has been patched and xdm finds no special files, it will still start the 
server and a login xterm window. This default action can be very helpful, because it allows 
you to log in even if the special files have been inadvertently removed or corrupted. 

Despite the potential to work in a rudimentary fashion without special files, xdm was not 
intended to be run in this way. For most purposes, system administrators will want to use and 
very likely customize the special files to have xdm run X in a manner more suitable for the 
particular system. 

The configuration file and some prototypical special files can be found in the con.fig directory 
under the xdm source directory. (Starting from the top of the X11 source tree, the directory is 
mit/clients/xdm/con.lig.) Table A-I lists some of the more commonly used special files for 
Release 4. 

Table A- 1. xdm Special Files 

File 

xdm-confg 
Xservers 
xdm-errors 
xdm-pid 

Xresources 
Xsession 
Xstartup 
Xreset 

What it specifies 

Configuration parameters. 
List of displays to manage. 
xdm error log file. 
Contains ID of the xdm parent process 
(Available as of Release 4). 
Resources to load (with xrdb). 
Default login session. 
Startup procedure. 
Reset procedure. 

As you can see, the file xdm-pid has been added in Release 4; it represents new functionality. 
The Xstartup and Xreset files can still be used to affect xdm in Release 4 but there are no 
default files. We'll discuss these and some of the other special files in greater detail later in 
this appendix. 
Each of the special files can be specified by an xdm command" line option. However, it's 
more efficient to specify the files--other than the single xdm configuration file--as resources 
and put those resources in the configuration file itself. The configuration file shipped with the 
standard version of X is called xdm-con.lig and is shown in Figure A-2. 

DisplayManager.servers: 
DisplayManager.errorLogFile: 
DisplayManager.pidFile: 
DisplayManager*resources: 
DisplayManager*session: 
DisplayManager. O.authorize: 
DisplayManager*authorize: 

/usr/lib/Xll/xdm/Xservers 
/usr/lib/Xll/xdm/xdm-errors 
/usr/lib/Xll/xdm/xdm-pid 
/usr/lib/Xll/xdm/Xresources 
/usr/lib/Xll/xdm/Xsession 
true 
fise 

Figure A-2. Default xdm-config file 

564 X Window System User's Guide, Motif Edition 



present.) Since setting up an Xservers file is fairly simple to do and a good way to avoid 
potential problems, we recommend that you do so before placing the xdm command in one of 
the system startup files. 
Most workstations can be run using an Xservers file made up of this line: 
:0 local /usr/bin/Xll/X 
This Xservers file is probably adequate for most workstations. However, if X does not run 
properly on your single display, you should edit the Xservers file. See "The Xservers File" 
later in this appendix and the xdm reference page in Part Three of this guide for more infor- 
mation about file syntax. 

The Standard Login Session 

Once you copy the special files to/usrlliblXlllxdm and create a single-entry Xservers file, if 
you want xdm simply to run the X server on the local display, prompt for username and pass- 
word, and run a simple login session, you should simply be able to add this line to the end of 
the letclrc file: 
/usr/bin/Xl l/xdm 
(Depending on your version of UNIX, you may want to add this line to letclrc.local, letclrc2 
or some other file. Consult your operating system documentation. Regardless of the file to 
which it is added, the display manager should be the last process run.) 
After this simple modification, when UNIX is put into multiuser mode, xdm automatically 
starts the X server and keeps it running. 
xdm also takes over the login procedure for displays specified in the Xservers file, supplying 
username and password prompts normally provided by the getty and login programs. With- 
out modification, xdm provides the login window pictured in Figure 2-1 of Chapter 2, Get- 
ting Started. 
This login procedure is controlled by the authentication widget (part of the xdm program), 
which in effect "authenticates" the user and password. You can customize the login window 
by setting resources for the authentication widget in the Xresources file. (These resources 
must be set in the Xresources file in the directory lusrlliblX111xdm to take effect. They can- 
not be set in a resources file in a user's home directory, since that file is not loaded into the 
resource manager until after the login procedure.) Among the customizable features are the 
login greeting (by default, Welcome to the X Window System), the size and position of the 
window, and colors and fonts of the text displayed or typed in the window. See the xdm ref- 
erence page in Part Three of this guide for a complete list of resources. 
Each time a user successfully logs on, xdm looks for a file called .xsession in the user's home 
directory. If that file exists and is an executable script, xdm runs it as the user's login session. 
The .xsession file should follow the general guidelines for startup scripts described earlier in 
this appendix. 

566 X Window System User's Guide, Motif Edition 



If you've just set up xdm, users may not have written .xsession scripts. If xdm finds no 
.xsession file in a user's home directory, it provides a default session, consisting of these 
commands (excerpted from the standard Xsession file): 
resources=$HOME/. Xresources 
xrdb -load $resources 
twin & 
exec xterm -geometry 80x24+i0+i0 -Is 
This default session has three elements. First, xdm checks the user's home directory for a file 
called .Xresources. If that file exists, it is loaded into the resource manager with xrdb. Sec- 
ond, the window manager, twm, is started. Third, the console xterm window is started with a 
login shell (-ls) in the foreground. In Motif environments, system administrators will want 
to edit the standard Xsession file so that the mwm window manager is automatically invoked. 
After this basic session has been started, the screen looks something like Figure 2-3 and the 
user is ready to work. 

Customizing xdm 

The display manager can do far more than run the simple session described above. Any of 
the special files can be edited to customize the display manager for your site. For example, 
by editing the Xservers file, you can set up xdm to run multiple displays, such as X 
terminals.* 
Remember that, if xdm has been modified with the proper Release 4 patches, none of the spe- 
cial files (not even the xdm-con]ig file) is absolutely necessary to run X on a single display. 
In a worst-case scenariooif all the special files are removed or corrupted--xdm has reason- 
able defaults that will allow you to log in and work. Depending on your system configura- 
tion, you may elect not to use some of the special files. For example, the Release 4 xdm 
works well without Xstartup and Xreset files in many environments. As we've said, if no 
Xsession is specified, xterm is executed, etc. (If you decide not to use one of the special files 
listed in the default xdm-config file, remember to remove the pointer to it from the file!) 
What the special files provide is the flexibility to configure xdm for your site, perhaps running 
X on several displays, each possibly with a different default session, different resources for 
the authentication widget, etc. 
If you examine the default configuration file, you'll notice most of the resources are specified 
with loose bindings. This means that the specified resource (for example, Xsession) will 
apply to all displays being run by xdm. By using tight bindings in the configuration file, you 

*Generally, this modification is required for xdm to run sessions on X terminals. However, as we'll see, an increas- 
ing number of X terminals do not require an Xservers file entry in order to be controlled by xdm. See "X Terminals 
and the XDM Control Protocol" later in this appendix. 

System Management 567 



can also specify resources that only take effect on a specific display. To specify a resource 
for a particular display, just insert the name of the display between DisplayManager and 
the final resource variable. For example, say xdm is running X on a workstation (named : O) 
and a connected X terminal (visual : 0). You could specify two different default sessions 
by using resource definitions (in the configuration file) similar to this: 
DisplayManager. O.session: /usr/lib/Xll/xdm/Xsession.ws 
DisplayManager.isual_O.session: /usr/lib/Xll/xdm/Xsession.visual 

Note that an xdm resource specification uses an underscore in place of the colon in a display 
name. (As discussed earlier, the use of underscores has been introduced in Release 4.) You 
should match the display name syntax for resources intended to be used on the same display. 
For example, you might have these reaourcea variable settings to match the aeasion 
resource specifications above: 
DisplayManager o_0. resources : /usr/lib/Xl 1/xdm/Xresources. ws 
DisplayManager. visual_0, resources : /usr/lib/Xl 1/xdm/Xresources. visual 

The following sections discuss some possible customizations of the default special files. 
With the vast number of possible system configurations and user preferences, you should 
consult the xdm reference page in Part Three of this guide for more information. 

The Xservers File 

As of Release 4, the xdm source directory contains two sample Xservers files, Xservers.ws 
and Xserversfs, which illustrate file entries for workstations and file servers (such as X 
terminals), respectively. To run xdm on a single workstation, you should create an Xservers 
file using the Xservers.ws file as a guide. As we'll see later, in most circumstances, you must 
edit the Xservers file to specify additional displays for xdm to manage. 
Each entry in the Xservers file usually has three or four elements: the display name, an 
optional display class, the display type, and the server program name (and its arguments, typ- 
ically the display number). (Since an X terminal runs its own server, the final argument can 
be a comment, such as "Joe's X terminal.") Possible display types are described on the xdm 
reference page in Part Three of this guide. 
Most workstations have a single display numbered 0 of the type local, as illustrated by the 
typical Xservers file entry for a workstation: 
:0 local /usr/bin/Xll/X 
The display class part of the Xservers entry is new as of Release 4. The sample entry above 
does not contain a display class but it would normally be the second part, between the display 
name and type, as in: 
:0 display_class local /usr/bin/Xll/X 
The display class is determined by the machine you are using and should be provided by the 
hardware vendor. The use of the display class is related to an underlying feature of the 
Release 4 xdm, the X Display Manager Control Protocol (XDMCP), which is described later 
in this appendix. For now suffice it to say that, in most circumstances, you do not have to 
supply a class name within an Xservers file entry. 

568 X Window System User's Guide, Motif Edition 



For xdm to run sessions on most X terminals, you must add specifications for these displays 
to the Xservers file, using the sample file Xserversfs from the xdm source directory as a tem- 
plate. For instance, say you have two X terminals hooked up to a workstation. (As of 
Release 4, most X terminals are of the display type foreign. In Release 3, most X terminals 
are of the display type transient.) Your Xservers file might look like this: 
:0 local /usr/bin/Xll/X 
vlsua1:0 foreign Lucy's Visual 
ncd:0 foreign Ricky' s NCDI6 
Notice that the final element of each X terminal entry is a comment. Using this Xservers file, 
xdm provides login windows on the two X terminals, as well as the workstation, and runs a 
session for any user who logs on. 
If you edit the Xservers file while the server is running, xdm will not be aware of the changes. 
You can make xdm reread the Xservers file (or another file specified by the resource 
DisplayManager. servers) by sending the xdm parent process a SIGHUP. Use the 
UNIX ldll command with the -HUP option (for SIGHUP) and the process ID number of xd, n. 
It's likely there will be multiple xdm processes, since the program forks a child process for 
every display it's managing. As of Release 4, the ID of the parent process is stored in the file 
specified by the resource Di spl ayManage r. pidFi 1 e Dusually lusrlliblX111xdmlxdm- 
pid. 
% kill -IIU process-ID 
If a new entry was added, the display manager starts a session on that display. If an entry has 
been removed, the display manager terminates any session on that display without notice and 
no new sessions will be started. 
Once you edit the Xservers file to reflect the different displays you want to manage, you can 
enter other display-specific resources in the configuration file. 
Be aware that communication problems can arise between the display manager and many 
autonomous displays (primarily X terminals). If the main display is powered off or reset, 
xdm may not detect that the server has been stopped and restarted, and thus may not send new 
login windows to connected displays. In the spring of 1989, the X Consortium proposed a 
standard protocol between displays and display managers that would avert these problems. 
The X Display Manager Control Protocol (XDMCP) was adopted and implemented by the 
Release 4 xdm but not all X terminals implement it yet. We'll discuss the goals of this proto- 
col at greater length in "X Terminals and the XDM Control Protocol" later in this appendix. 
For now, be aware that the XbMCP will eventually eliminate the need for Xservers file entries 
for X terminals. Currently, however, chances are that your X terminal does not understand 
the XDMCP and requires an Xservers file entry. 

System Management 569 



The Xsession File and .xsession Scripts 

Depending on the needs of your site, you can edit the Xsession file to make the default ses- 
sion anything you want. You can specify an alternative window manager, perhaps even use 
another program to load resources, and execute any combination of clients. 
Another strength of xdm is that it provides for each user to design his or her own .xsession 
file. See "A Startup Shell Script" earlier in this appendix for more information on writing a 
.xsession file. 
Be aware that if you're testing a .xsession script and it doesn't work, by default xdm will not 
let you log in (using the normal method) to fix it. However, xdm does provide an escape 
hatch for these situations, which is explained in the following section. 

The Xresources File 

The Xresources file is where you should specify resources for the authentication widgeL See 
the xdm reference page in Part Three of this guide for a complete list of resource variables. 

As of Release 4, the default Xresources file contains these event translations, which allow 
users to log in if a .xsession script doesn't work: 

xlogin*login.translations: #override\ 
<Key>Fl: set-session-argument(failsafe) finish-field()\n\ 
<Key>Return: set-session-argument() finish-field() 

This translation table specifies that if you type the F1 key (rather than Return) after your 
password when logging in, a "failsafe" session, consisting of a simple login xterm window, 
will be executed. This will enable you to edit the non-functioning .xsession file. See the 
xdm reference page in Part Three of this guide for more information. (See Chapter 10, Set- 
ting Resources, and, for a discussion of event translations.) 

The Error Log File 

xdm errors are normally printed to the console. It's wise to redirect them to a file. The 
default configuration file sets the resource DisplayManager.errorLogFile to 
/usr/liblXlllxdm/xdm-errorso The xdm-errors file can be very helpful if you are testing vari- 
ous xdm configurations. 

The xdm-pid File 

Added to xdm as of Release 4, the xdm-pid file stores the ID number of the xdm parent pro- 
cess. If you edit the Xservers file while the server is running, xdm will not be aware of the 
changes. You can make xdm reread the xdm-conftg file and the Xservers file (or another file 
specified by the resource DisplayManager. servers) by sending the xdm parent pro- 
cess a SIGHUP. 

To make xdm aware of changes to the Xservers file, use the UNIX la'll command with the 
-HUP option (for SIGHUP) and the process ID number ofxdm stored in the xdm-pid file. (See 
"The Xservers File" earlier in this appendix for an example.) 

570 X Window System User's Guide, Motif Edition 



Xstartup and Xreset 

As stated previously, the Xstartup and Xreset files mentioned in Table A-3 can still be used to 
affect xdm in Release 4 but there are no default files; thus, they are not specified in the 
default configuration file. 
The Xstartup file is intended to be a script that is run as root before starting the user session. 
You might want to write a script containing commands to make fake entries in letclutmp, 
mount users' home directories from file servers, display a message of the day, or abort the 
session if logins are not currently allowed. 
The Xreset file is intended to be a script that is run as root after a user session has been ended. 
You might want to write a script to undo the effects of commands in Xstartup, perhaps 
removing fake entries from letclutmp, or unmounting directories from file servers. 
See the xdm reference page for more information about the Xstartup and Xreset files. 

Security and the authorize Resource 

In addition to pointers to several special files, the xdm-config file contains these resource 
specifications: 
DisplayManager. 0.authorize : true 
DisplayManager*authorize : false 
Available as of Release 4, the authorize resource represents a new method of security for 
X, which xdm can be set up to provide. The first resource specification above sets a user- 
based server access scheme to work on the local display. The second one turns the scheme 
off on all other displays. These defaults should be compatible with running X on the local 
display and most X terminals that might be connected to it. See "User-based Access: xdm 
and the .Xauthority File" later in this appendix and the xdm reference page in Part Three of 
this guide for more about authorization. 

Stopping xdm and the Server 

By default, xdm automatically restarts the server if the server is killed. If you don't want this 
boomerang effect, set this resource in the xdm-conJig file: 
DisplayManager. DISPLAY.terminateServer: true 
Then if you kill the server and all xdm processes, X will exit. 

X Terminals and the XDM Control Protocol 

The X Display Manager Control Protocol (XDMCP), introduced at Release 4, facilitates the 
connection of X terminals to remote hosts via xdm. From a user's standpoint, the main 
advantage of XDMCP is that it allows you to turn an X terminal off and on again, while main- 
taining the connection to the remote host. When you turn on an X terminal, xdm should auto- 
matically display a login window. The exchange of information between the X terminal and 

System Management 571 



the remote host is invisible to the user. In fact, XDMCP and xdm are intended to make X 
terminals as easy to use as traditional character terminals. Under the X Display Manager 
Control Protocol, an X terminal basically requests a connection to a remote host, is recog- 
nized by the host, and is sent a login prompt by xdm. 
Prior to the adoption of this protocol, xdm was not equipped to reconnect to X terminals that 
had been turned off and on again. In most cases, X terminals had to be left on at all times. If 
a terminal was turned off, it was often necessary to kill the associated xdm process; xdm 
would then restart itself and reestablish the connection, again displaying the login window. 
XDMCP is intended to solve problems like this. Be aware, however, that the X terminals in 
question must be programmed to interpret XDMCP or modified to do so. At the time of 
Release 4, virtually no X terminals in the market supported XDMCP. Protocol-compatible X 
terminals should become available in increasing numbers by the fall of 1990. If you're using 
an older X terminal, chances are that the programs controlling it must be upgraded to com- 
municate via XDMCP. 
If you are using X terminals at your site, the way you set up xdm partially depends on 
whether the terminals can communicate via the XDMCP. If a terminal can't communicate in 
this way, the Xservers file must include an entry for it and the terminal must be left on at all 
times to maintain the connection to the host via xdm. If a terminal can communicate via the 
protocol, no Xservers file entry is necessary and the terminal can be turned on and off, while 
still maintaining the connection to the host. Refer your X terminal documentation to find out 
whether it's XDMCP compatible. 
The XDMCP helps clarify the actual purpose of the Xservers file. The file is actually a list of 
displays to which xdm must perpetually maintain a connection. By contrast, the XDMCP is a 
dynamic mechanism whereby connections are made when requested by a display, such as a 
workstation or a newer X terminal, that can communicate via the protocol. 
XDMCP also affects the Xservers file entry for the host. If you are running Release 4, it is 
recommended that the Xservers file entry for the host include a display class name, which 
should be provided by the hardware manufacturer. You can use this name in the xdm-con./ig 
file to specify resources by display class, rather than by individual display. 

Starting X with xinit 

The xinit program is used to start the server and a first client program, by default an xterm 
window. Starting X manually with xinit is described in Chapter 2, Getting Started. You can 
also use xinit to start X automatically. 

The easiest way to do this is to run xinit from your .login or .profile file. (If you are using 
System V, this may be the only reliable way to run xinit.) 

xinit will look in your home directory for a file called .xserverrc to run as a shell script to 
start up the server. If there is no such script, xinit will start the server X on the display : 0. 

xinit will also look in your home directory for a file called .xinitrc to run as a login script, 
such as the one described earlier in this appendix. If no such script is found, it will execute a 
login xterm window. 

572 X Window System User's Guide, Motif Edition 



With System V only, you might try to run xinit from the/etc/inittab terminal initialization 
file. This file is analogous to the BSD 4.3 letc/ttys. The letclinittab file normally has an entry 
for each serial port on a system, plus several entries that are used during the boot process. 
Note that the concept of pseudo-terminals, or ptys (which X relies on) is foreign to System V. 
All System V servers will have had to do some system hacking to add support for ptys. How 
this is done will vary from system to system. As a result, we're going to beg off on describ- 
ing inittab in detail, and refer you to your system documentation. Again, it is also possible 
that there will be problems with the controlling tty. 

See the xinit reference page in Part Three of this guide for more information. 

Server Access Control 

X runs in a networked environment. Because of X's design, your workstation is no longer 
your private preserve but hypothetically can be accessed by any other host on the network. 
This is the true meaning of the server concept: your display can serve clients on any system, 
and clients on your system can display on any other screen. 
The possibilities for abuse are considerable. However, there are two access control mecha- 
nisms, one host-based and one user-based. The host-based scheme involves a system file 
(letc/Xn.hosts) and can be controlled using the xhost client. The user-based scheme involves 
authorization capabilities provided by the display manager, xdm, as of Release 4, and 
depends upon the newly introduced X Display Manager Control Protocol (XDMCP). As we'll 
see, since most X terminals cannot interpret the XDMCP at this time, the usefulness of this 
latter access control mechanism is currently somewhat limited. 
These two access control methods are discussed briefly in the following sections. For more 
information, see the Xserver, xhost, xdm, and xauth reference pages in Part Three of this 
guide. 

Host-based Access and the xhost Client 

The letc/Xn.hosts file (where n is the number of the display) contains a list of systems that are 
allowed to access the server. By default, this file contains only the name of the local host. 
Edit this file so that it contains the list of systems you want to have access to your server on a 
regular basis. 

The xhost client can be used to give (or deny) systems access to the. server interactively, pos- 
sibly overriding the contents of letclXn.hosts. (The xhost client can also be run from a startup 
script.) Note that this is really only sufficient for a single-user workstation environment, 
however. 

Specifying a host name with an optional leading plus sign (+) allows the host to access the 
server, and specifying a host name with a leading minus sign (-) prevents a previously 
allowed host from accessing the server. Multiple hosts can be specified on the same line. 
Running xhost without any arguments prints the current hosts allowed to access your display. 

System Management 573 



For example, to add the hosts jupiter and saturn, and remove neptune: 
% xhot +Jupiter aturn -nptun 
It is possible to remove the current host from the access list. Be warned that you can't undo 
this without logging out. 
Note that when a remote system is denied access to your display, it means two things: that a 
person working on the remote system can't display on your screen, and that you can't use 
that remote system for running clients you want displayed on your screen. 

User-based Access: xdm and the .Xauthority File 

As of Release 4, the display manager and its control protocol (XDMCP) provide a user-based 
access control mechanism, which can be used to supplement or replace the host-based access 
mechanism discussed in the previous section. The Release 4 xdm can be set up to provide 
user authorization on a particular display (see "Security and the authorize Resource" earlier 
in this appendix). If authorization is enabled, when you log in, xdm places a machine-read- 
able access code, known as a magic cookie, in a file called .Xauthority in your home direc- 
tory. xdm also makes this magic cookie available to the server. 
The magic cookie defined in a user's .Xauthority file is basically a secret code shared by the 
server and a particular user logged in on a particular display. When the user runs a client on 
the local display, the server checks to see whether the client program has access to the magic 
cookie. All processes started by the user in question have that access, and thus the server 
allows the client to be run on the display. Basically, under the magic cookie authorization 
scheme, a display becomes user-controlled. Once xdm creates an .Xauthority file for a user, 
each time the user logs on, xdm merges in authorization codes (magic cookies). 
The access afforded by magic cookies is not as broad as that afforded by the host-based 
mechanism. When a system relies entirely on host-based access, any machine on the list of 
approved hosts can connect to the system. Thus, generally, any user logged on to an 
approved host can access any display connected to the system. This is somewhat feeble secu- 
rity. User-based access control is a little safer. 
Be aware, however, that, currently, user-based access control cannot provide security for all 
X terminal users. This method of access control relies on the X Display Manager Control 
Protocol and few X terminals in the current market are programmed to understand the proto- 
col= However, user-based access can be used effectively on workstations running Release 4 
and on many of the newer X terminals. 
The security mechanism provided by the magic cookie is evident in a situation in which 
another user tries to run a client on your machine. The server requires the client run by the 
other user to have access to the magic cookie shared exclusively between you and the server. 
The other user cannot provide the proper authorization code and thus cannot run a client on 
your hosL 
Of course, in many cases, users in a network will want to run clients on several machines 
(while displaying the client window on their local displays). This can be done if a user sup- 
plies authorization information associated with his local machine (or X terminal display) to 

574 X Window System User's Guide, Motif Edition 



the remote host. X developers have provided a new client, xauth, to allow users to transfer 
this information. Basically, xauth is a utility to manipulate .Xauthority files. 
The most common use for xauth is to extract a user's authorization information for the cur- 
rent display, copy it to another machine, and merge it into the server's authorization records 
on the remote machine like this: 
% xauth extract - $DISPLAY I rsh host2 xauth merge - 
The dash (-) arguments indicate that extracted authorization records should be written to the 
standard output and that the xauth merge function should accept records from standard input. 
This command supplies the remote server with authorization information, allowing the user 
to run a remote shell on that host. See the xauth reference page in Part Three of this guide for 
more information. 
If an installation is using remote file sharing, such as NFS, then sharing authorization records 
may not be an issue. If every user has a single home directory that is accessible to all 
machines, the machines have access to the necessary .Xauthority files at all times. In such an 
environment, users should be able to run programs on any of the networked machines without 
using xauth. 
When user-based access control fails (for example, when a null or invalid magic cookie is 
offered to the server), host-based access lakes over. To be more specific, say for example a 
user is logged on at an X terminal that is not XDMCP-compatible, and thus the user has no 
.Xauthority file (i.e., magic cookie). If that user tries to open a window on the remote console 
display, the client window cannot access a magic cookie. (The host interprets this as a null 
cookie.) Then host-based access control takes over. If the user in question is working on a 
system authorized in the letclXn.hosts file, he or she should be authorized to run a client on 
the console display. 

Font Management 

In Release 3, the X Consortium adopted the Bitmap Display Format (BDF) as the (non-exclu- 
sive) standard font format. (These files generally have a .bdf extension.) BDF font files are 
portable: they represent the characters of a font in ASCII. 
In order to use BDF font files on a particular server, the files must be compiled to produce 
SNF (Server Natural Format) font files. (These files generally have a .snfextension.) Server 
Natural Format is particularto agiven server. The server vendor must provide a program to 
convert BDF font files to SNF font files. 
If you are using the standard version of X from MIT, the fonts shipped with X should be com- 
piled when you build X. If you subsequendy add BDF font files to the system, the files must 
be converted to SNF format. In the standard X environment, you convert BDF font files to 
SNF format using the program bdftosnf. The showsnf program displays the SNF font file so 
you can check that it compiled properly. See the bdftosnf and showsnf reference pages in 
Part Three of this guide for details. 

System Management 575 



Log Files 

The X server creates log files useful in fixing a problem that might occur. These files are 
located in lusrladm. 
You should make provisions to trim these files periodically. As with all log files, you can do 
this automatically with an entry in the crontab file. 

Changing the Color Name Database 

The X Window System comes with a predefined set of colors, listed in the file 
lusrllib/X111rgb.txt. You can use these color names to specify colors either on the command 
line or in a resources file. If you have the X sources, you can customize the color name data- 
base using this procedure. 
1. Edit the rgb.txt source file, which is located in the mitlrgb directory, to change or add 
colors. The format of a line in the rgb.txt file is: 
red green blue color_name 
The red, green, and blue values are integers in the range 0 to 255; the color name is case- 
insensitive but must not include any special symbols. A typical entry in the rgb.txt file is: 
127 255 212 aquamarine 
See Chapter 9, Command Line Options, for more information about color specifications. 
2. Run the rgb program using the makefile also located in the mit/rgb directory. This pro- 
gram converts the text file (rgb.txt) to a UNIX dbm(1) format file (rgb.dir), which is used 
as the color database. Just type: 
% make 

3. Then install the new rgb.dir file in lusrlliblX11 by typing: 
% make install 

If the color name database gets corrupted in some way (e.g., written to accidentally), the 
server may not be able to find any colors with which to display. On a black and white work- 
station, you may get error messages similar to this: 

X Toolkit Warning: 
X Toolkit Warning: 
X Toolkit Warning: 
X Toolkit Warning: 

Cannot allocate colormap entry for White 
Cannot allocate colormap entry for Black 
Cannot allocate colormap entry for white 
Cannot allocate colormap entry for black 

If you get errors of this sort, perform steps 2 and 3 in the procedure described above. This 
will overwrite the corrupted rgb.dir file. 

578 X Window System Users Guide, Motif Edition 



B 

Release 4 Standard Fonts 

This appendix shows the standard display fonts available in Release 4 of the 
MIT X distribution. The images contained in this appendix are window 
dumps created with our own program, called xshowfonts, the code for which 
is included. 



Table B-1. Fonts in the misc Directory 

Filename 

7xl3B.snf 
8x13B.snf 
9xl5B.snf 
6xl3B.snf 
6xl0.snf 
7xl3.snf 
8xl3.snf 
kl4.snf 
7xl4.snf 
7xl4rk.snf 
9xl5.snf 
10x20.snf 
5x8.snf 
6x9.snf 
6xl2.snf 
6xl3.snf 
clB6xl0.snf 
clB8xl0.snf 
clB6xl2.snf 
clB8xl2.snf 
clB8xl3.snf 
clB8xl4.snf 
clB9xl5.snf 
clB8xl6.snf 
clB8X8oSnf 
clI6xl2.snf 
clI8x8.snf 
clR5xl0.snf 
clR6xl0.snf 
clR7xl0.snf 
clR8xl0.snf 
clR6xl2.snf 
clR7xl2.snf 
clR8xl2.snf 
clR6"x 13.snf 
clR8xl3.snf 
clR7xl4.snf 
clR8xl4.snf 
clR9xl5.snf 
clR8xl6.snf 
clR4x6.snf 
clR5x6.snf 
clR6x6.snf 
clR5x8.snf 

Font name 

-misc-fixed-bold-r-normal- - 13-120-75-75-c-70-iso8859-1 
-misc-fixed-bokl-r-normal- - 13-120-75-75-c-80-iso8859-1 
-misc-fixed-bold-r-normal- - 15-140-75-75-c-90-iso8859-1 
-misc-fixed-bold-r-semicondensed- - 13-120-75-75-c-60-iso8859-1 
-misc-fixed-medium-r-normal- - 10-100-75-75-c-60-iso8859-1 
-misc-fixed-medium-r-normal- - 13-120-75-75-c-70-iso8859-1 
-misc-fixed-medium-r-normal- - 13-120-75-75-c-80-iso8859-1 
-misc-fixed-medium-r-normal- - 14-130-75-75-c- 140-jisx0208.1983-0 
-misc-fixed-medium-r-normal- - 14-130-75-75-c-70-iso8859-1 
-misc-fixed-medium-r-normal- - 14-130-75-75-c-70-jisx0201.1976-0 
-misc-fixed-medium-r-normal- - 15-140-75-75-c-90-iso8859-1 
-misc-fixed-medium-r- normal- -20-200-75-75-c- 100-iso8859-1 
-misc-fixed-medium-r-normal- -8-80-75-75-c-50-iso8859-1 
-misc-f'Lxed-medium-r-normal- -9-90-75-75-c-60-iso8859-1 
-misc-fixed-medium-r-semiconden sed- - 12-110-75-75-c-60-iso8859-1 
-misc-fixed-medium-r-semicondensed- - 13-120-75-75-c-60-iso8859-1 
-schumacher-clean-bold-r-normal- - 10-100-75-75-c-60-iso8859-1 
-schumacher-clean-bold-r-normal- - 10-100-75-75-c-80-iso8859-1 
-schumacher-clean-bold-r-normal- - 12-120-75-75-c-60-iso8859-1 
-schumacher-clean-bold-r-normal- - 12-120-75-75-c-80-iso8859-1 
-schumacher-clean-bold-r-normal- - 13-130-75-75-c-80-iso8859-1 
-schumacher-clean-bold-r-normal- - 14-140-75-75-c-80-iso8859-1 
-schumacher-clean-bold-r-normal- - 15-150-75-75-c-90-iso8859-1 
-schumacher-clean-bold-r-normal- - 16-160-75-75-c-80-iso8859-1 
-schumacher-clean-bold-r-normal- -8-80-75-75-c-80-iso8859-1 
-schumacher-clean-medium-i-normal- - 12-120-75-75-c-60-iso8859-1 

-schumacher-clean-medium-i-normal- 
-schumacher-clean-medium-r-normal- 
-schumacher-clean-medium-r-normal- 
-schumacher-clean-medium-r-normal- 
-schumacher-clean-medium-r-normal- 
-schumacher-clean-medium-r-normal- 
-schumacher-clean-medium-r-normal- 
-schumacher-clean-medium-r-normal- 
-schumacher-clean-medium-r-normal- 
-schumacher-clean-medium-r-normal- 
-schumacher-clean-medium-r-normal- 
-schumacher-clean-medium-r-normal- 
-schumacher-clean-medium-r-normal- 
-schumacher-clean-medium-r_normal. 
-schumacher-clean-medium-r-normal- 
-schumacher-clean-medium-r-normal_ 
-schumacher-clean-medium-r-normal. 
-schumacher-clean-medium-r-normal_ 

-8-80-75-75-c-80-iso8859-1 
- 10-100-75-75-c-50-iso8859-1 
- 10-100-75-75-c-60-iso8859-1 
- 10-100-75-75-c-70-iso8859-1 
- 10-100-75-75-cz80-iso8859-1 
- 12-120-75-75-c-60-iso8859-1 
- 12-120-75-75-c-70-iso8859-1 
- 12-120-75-75-c-80-iso8859-1 
- 13-130-75-75-c-60-iso8859-1 
- 13-130-75-75-c-80-iso8859-1 
- 14-140-75-75-c-70-iso8859-1 
o 14-140-75-75-c-80-iso8859-1 
- 15-150-75-75-c-90-iso8859-1 
- 16-160-75-75-c-80-iso8859-1 
-6-60-75-75-c-40-iso8859-1 
-6-60-75-75-c-50-iso8859-1 
-6-60-75-75-c-60-iso8859-1 
-8-80-75-75-c-50-iso8859-1 

582 X Window System User's Guide, Motif Edition 



Table B-2. Fonts in the 75dpi Directory (continued) 

Filename 

courR 18.mr 
courR24.snf 
courR08.snf 
helvBO10.snf 
helvBOl2.snf 
helvBO14.srtf 
helvBO18.snf 
helvBO24.mf 
helvBOOS.snf 
helvB10.srtf 
helvB12.snf 
helvB 14.snf 
helvB18.snf 
helvB24.snf 
helvB08.snf 
helvO 10.snf 
helvO12.snf 
helvO14.snf 
helvO 18.snf 
helvO24.snf 
helvOOS.snf 
helvR10.snf 
helvR12.snf 
helvR14.snf 
helvR 18.snf 
helvR24.snf 
helvR08.snf 
ncenBI10.snf 
ncenBI12.snf 
ncenBI14.snf 
ncenBI18.snf 
ncenBI24.snf 
ncenBI08.snf 
ncenB 10.snf 
ncenBl2.snf 
ncenB 14.snf 
ncenB 18.snf 
ncenB24.snf 
ncenB08.snf 
ncenI10.snf 
ncenI12.snf 
nccnI 14.snf 
ncenI18.mr 
ncenI24.snf 

Font name 

-adobe-courier-medium -r-normal-- 18 - 180-75-75 -m - 110-iso8859 - 1 
-adbe-courier-medium-r-normal--24-240-75-75-m-150"iso8859-1 
-adobe-courier-medium-r-normal--8-80-75-75-m-50-iso8859-1 
-adobe-helvetica-bold-o-norm al-- 10-100-75-75 -p-60-iso8859-1 
-adobe-helvetica-bold-o-normal-- 12-120-75-75-p-69-iso8859-1 
-adobe-helvetica-bold-o-normal--14-1 40-75-75-p-82-iso8859-1 
-adobe-helvetica-bold-o-normal--18-180-75-75-p-104-iso8859-1 
-adobe-helvetica-bold-o-normal--24-240-75-75-p-138-iso8859-1 
-adobe-helvetica-bold-o-normal--8-80-75-75-p-50-iso8859-1 
-adobe-helvetica-bold-r-normal-- 10-100-75-75-p-60-iso8859-1 
-adobe-helvetica-bold-r-normal--12-120-75-75-p-70-iso8859-1 
-adobe-helvetica-bold-r-normal--14-140-75-75-p-82-iso8859-1 
-adobe-helvetica-bold-r-normal- - 18-180-75-75-p- 103-iso8859-1 
-adobe-helvetica-bold-r-normal--24-240-75-75-p- 138-iso8859-1 
-adobe-helvetica-bold-r-normal- -8 -80-75-75-p-50-iso8859-1 
-adobe-helvetica-medium-o-normal--10-100-75-75-p-57-iso8859-1 
-adobe-helvetica-medium-o-normal--12-120-75-75-p-67-iso8859-1 
-adobe-helvetica-medium-o-normal--14-140-75-75-p-78-iso8859-1 
-adobe-helvetica-medium-o-normal- -18-180-75-75-p-98-iso8859-1 
-adobe-helvetica-medium-o-normal--24-240-75-75-p- 130-iso8859-1 
-adobe-helvetica-medium-o-normal- -8-80-75-75-p-47-iso8859-1 
-adobe -helvetica-medium -r-normal-- 10-100-75-75-p-56-iso8859 - 1 
-adobe-helvetica -medium -r-normal-- 12-120-75-75-p-67 -iso8859 - 1 
-adobe-helvetica-medium -r-norm al-- 14-1 40-75-75-p-77 -iso8859 - 1 
-adobe -helvetica-medium -r-normal-- 18 - 180-75 -75 -p-98 -iso8859 - 1 
-adobe-helvetica-medium-r-normal--24-240-75o75-p-130-iso8859-1 
-adobe-helvetica-medium-r-normal--8-80-75-75-p-46-iso8859-1 
-adobe-new century schoolbook-bold-i-normal--10-100-75-75-p-66-iso8859-1 
-adobe-new century schoolbook-bold-i-normal--12-120-75-75-p-76-iso8859-1 
-adobe-new century schoolbook-bold-i-normal--14-140-75-75-p-88-iso8859-1 
-adobe-new century schoolbook-bold-i-normal--18-180-75-75-p-111-iso8859-1 
-adobe-new century schoolbook-bold-i-normal--24-240-75-75-p-148-iso8859-1 
-adobe-new century schoolbook-bold-i-normal--8-80-75-75-p-56-iso8859-1 
-adobe-new century schoolbook-bold-r-normal--10-100-75-75-p-66-iso8859-1 
-adobe-new century schoolbook-bold-r-normal--12-120-75-75-p-77-iso8859-1 
-adobe-new century schoolbook-bold-r-normal--14-140-75-75-p-87-iso8859-1 
-adobe-new century schoolbook-bold-r-normal-- 18 - 180-75-75-p- 113-iso8859-1 
-adobe-new century schoolbook-bold-r-normal--24-240-75-75-p-149-iso8859-1 
-adobe-new century schoolbook-bold-r-normal--8-80-75-75-p-56-iso8859-1 
-adobe-new century schoolbook-medium-i-normal--10-100-75-75-p-60-iso8859-1 
-adobe-new century schoolbook-medium-i-normal--12-120-75-75-p-70-iso8859-1 
-adobe-new century schoolbook-medium -i-normal-- 14-1 40-75-75-p-8 l-iso8859 - 1 
-adobe-new century schoolbook-medium-i-normal--I 8-180-75-75-p-104-iso8859-1 
-adobe-new century schoolbook-medium-i-normal--24-240-75-75-p-136-iso8859-1 

584 X Window System User's Guide, Motif Edition 



Table B-2o Fonts in the 75dpi Directory (continued) 

Fenrne 

luBS10.snf 
luBSl2.snf 
luBS14.snf 
luBS 18.s'rff 
luBS19.snf 
luBS24.srff 
luBS0$.snf 
lulS 10.snf 
lulS 12.snf 
lulS14.srff 
lulS 18.snf 
luIS 19.s'rff 
luIS24.snf 
luIS08.snf 
luRS 10.snf 
luRSl2.snf 
IuRS 14.s'rff 
IuRS 18.snf 
IuRS 19.snf 
luRS24.snf 
luRS08.snf 
lubBIl0.snf 
lubBI 12.snf 
lubBI14.snf 
lubBIl8.snf 
lubBIlg.snf 
lubBI24.snf 
lubBI08.snf 
lubB 10.snf 
lubB12.snf 
lubB 14.snf 
lubB 18.snf 
lubB 19.snf 
lubB24.snf 
lubB08.s-rff 
lubI10.snf 
lubI 12.s'rff 
lubI14.snf 
lubI18.snf 
lubI19.snf 
lubI24.mf 
lubI08.snf 
lubR 10.snf 
lubR12.snf 

Font name 

-b&h-lucida-bold-r-normal-sans - I O- 100-75 -75 -p-66-iso8859 - I 
-b&h-lucida-bold-r-normal-sans-12-120-75-75-p-79-iso8859-1 
-b&h-lucida-bold-r-normal-sans - 14-140-75 -75 op-92-iso8859- I 
-b&h-lucida-bold-r-normal-sans- 18-180-75-75-p-120-iso8859- I 
-b&h -lucida-bold-r-normal-s arts - 19 - 190-75 -75 -p- 122-iso8859 - I 
-b&h-lucida-bold-r-normal-sans-24-240-75-75-p-152-iso8859- I 
-b&h-lucida-bold-r-normal-sans-8-80-75-75-p-50-iso8859- I 
-b&h-lucida-rnedium-i-normal-sans- I O- 100-75-75-p-59-iso8859- I 
-b&h-lucida-mexlium-i-normal-sans- 12-120-75-75-p-71 -iso8859- I 
-b&h-lucida-rnexlium-i-normal-sans- 14-140-75 -75 -p-82-iso8859 - I 
-b&h-lucida-rnexliurn-i-normal-sans-I 8-I 80-75-75-p-I 05-iso8859- I 
-b&h-lucida-rnedium -i-normal-sans - 19-190-75-75-p- 108-iso8859- I 
-b&h-lucida-rnexlium-i-normal-sans-24-240o7575-p- 136-iso8859- I 
-b&h-Iucida-rnexliurn-i-normal-sans-8-80-75-75-p-45-iso8859- I 
-b&h -lucida-rnexliurn-r-normal-sans - I O- 100-75-75 -p-58-iso8859- I 
-b&h -lucida-rnexlium-r-normal-sans- 12-120-75 -75 -i>-7 I-iso8859- I 
-b&h-lucida-rnexliurn -r-normal-sans - 14-1 40-75-75-p-81 -iso8859-I 
-b&h -lucida-rnedium-r-normal-sans - 18-180-75 -75 -p- 106-iso8859 - I 
-b&h-lucida-rnexlium -r-normal-sans - 19-190-75 -75 -p- 108 -iso8859 - I 
-b&h-lucida-mexlium -r-normal-sans -24-240-75 -75 -p- 136-iso8859- I 
-b&h-lucida-mexliurn-r-normal-sans-8-80-75-75-p-45-iso8859. I 
-b&h-lucidabright-demibold-i-normal--10-100-75.75_p.59_iso8859.1 
-b&h-lucidabright-demibold-i-normal-- 12-120-75 -75-p-72-iso8859-1 
-b&h-lucidabright-demibold -i-normal-- 14-1 40-75 -75 -p-84-iso8859 - 1 
-b&h -lucidabright-demibold-i-normal-- 18-180-75 -75 -p- 11-iso8859-1 
-b&h-lucidabright-demibold-i-normal-- 19-190-75-75-p-114-iso8859-1 
-b&h-lucidabright-demibold-i-normal--24.240.75_75_p.143.iso8859_ 1 
-b&h-lucidabright-demibold-i-normal- -8-80-75-75-p-48-iso8859-1 
-b&h-lucidabrigh t-demibold-r-normal-- 10-100-75-75-p-59-iso8859-1 
-b&h-lucidabright-demibold-r-normal-- 12-120-75-75-p-71 -iso8859-1 
-b&h-lucidabright-demibold-r-normal.. 14-1 40-75 -75-p-84-iso8859 - 1 
-b&h-lucidabright-demibold-r-normal-- 18-180-75 -75 -p- 107-iso8859-1 
-b&h-lucidabright-demibold -r-normal-- 19 - 190-75 -75-p- 114-iso8859 - 1 
-b&h -lucidabright-demibold-r-normal--24.240_75 -75 -p- 143-iso8859 - 1 
-b&h-lucidabright-demibold-r-normal._8.80.75.75.p.47.iso8859.1 
-b&h-lucidabright-medium-i-normal.. 10-100-75 -75-p-57 -iso8859 - 1 
-b&h-lucidabright-rnedium.i_normal.. 12 - 120-75 -75 -p-67 -iso8859-1 
-b&h-lucidabright-rnedium -i-normal-- 14-1 40-75-75-p-80-iso8859 - 1 
-b&h-lucidabright-rnedium-i-normal.. 18 - 180-75 -75 -p- 102-iso8859-1 
-b&h-lucidabdght-medium-i-normal._19.190-75-75-p- 109-iso8859-1 
-b&h-lucidabright-mediurn-i-normal..24.240.75_75.p.136_iso8859_l 
-b&h-lucidabdght-rnediurn-i-normal..8_80.75.75_p.45_iso8859.1 
-b&h-lucidabright-rnediurn-r-normal.. 1 O- 100-75-75-p-56-iso8859 - 1 
-b&h-lucidabright-rnedium-r-normal._ 12-120-75-75-p-68-iso8859-1 

586 

X Window System User's Guide, Motif Edition 



Table B-3. Fonts in the l OOdpi Directory (continued) 

Filename 

lulS24.snf 
luRS08.snf 
IuRS I 0.snf 
IuRS 12.snf 
IuRS 14.snf 
IuRS 18.snf 
luRS19.snf 
luRS24.snf 
lubBI08.snf 
lubBI10.snf 
lubBI12.snf 
lubBI14.snf 
lubBll8.snf 
lubBI19.snf 
lubB124.snf 
lubB08.snf 
lubB10.snf 
lubB12.snf 
lubBl4.snf 
lubB 18.snf 
lubB 19.snf 
lubB24.snf 
lubI08.snf 
lubI10.snf 
lubI12.snf 
lubll4.snf 
lubllS.snf 
lubIl9.snf 
hbI24.snf 
lubR08.snf 
hbRl0.snf 
lubR12.snf 
lubRl4.snf 
lubRl 8.snf 
lubR 19.snf 
lubR24.snf 
lutBS08.snf 
lutBS 10.snf 
lutBS 12.snf 
lutBS 14.snf 
lutBS 18.snf 
lutBS 19.snf 
lutBS24.snf 
lutRS08.snf 

Font name 

-b&h-lucida-medium-i-norma1-sans-34-240-100-100-p-192-iso8859-1 
-b&h-lucida-medium-r-norma1-sans-11-80-lOO-100-p-63-iso8859-1 
-b&h-lucida-medium-r-norma1-sans-14-100-100-100-p-80-iso8859-1 
-b&h-lucida-medium-r-norma1-sans-17-120-100-100-p-96-iso8859-1 
-b&h-lucida-medium-r-normal-sans-20-140-100-100-p- 114-iso8859-1 
-b&h-lucida-medium-r-normal-sans-25-180-100- lO0-p-142-iso8859-1 
-b&h-lucida-medium-r-norma1-sans-26-190-100-100-p- 147-iso8859-1 
-b&h-lucida-medium-r-norma1-sans-34-240-100-100-p-191-iso8859-1 
-b&h-lucidabright-demibold-i-normal--I 1-80-100-100-p-66-iso8859-1 
-b&h-lucidabright-demibold-i-norma1--14-100-100-100-p-84-iso8859-1 
-b&h-lucidabright-demibold-i-normal--17-120-100-100-p-101-iso8859-1 
-b&h-lucidabright-demibold-i-norma1--20-140-100-100-p- 119-iso8859-1 
-b&h-lucidabright-demibold-i-norma1--25-180-100- lO0-p- 149-iso8859-1 
-b&h-lucidabright-demibold-i-norma1--26-190-100- lO0-p- 156-iso8859-1 
-b&h-lucidabright-derm]old -i-normal- -34-240-100-100-p-203-iso8859-1 
-b&h-lucidabright-demibold-r-normal-- 11-80-100- I O0-p-66-iso8859-1 
-b&h-lucidabright-demibold-r-norma1--14-100-100-100-p-84-iso8859-1 
-b&h-lucidabright-demibold-r-norma1--17-120-100-100-p- 101-iso8859-1 
-b&h-lucidabright-demibold-r-norma1--20-1 40-100-100-p- 118 -iso8859-1 
-b&h-lucidabright-derm]old-r-norma1--25-180-100-100-p- 149-iso8859-1 
-b&h-lucidabright-demibold-r-norma1--26-190-100-100-p- 155-iso8859- I 
-b&h-lucidabright-demibold-r-normal- -34-240-100-100-p-202-iso8859-1 
-b&h-lucidabright-medium-i-normal-- 11-80-100-100-p-63-iso8859-1 
-b&h-lucidabright-medium-i-norma1--14-100-100-100-p-80-iso8859-1 
-b&h-lucidabright-medium-i-normal-- 17-120-100-100-p-96-iso8859-1 
-b&h-lucidabright-medium-i-norma1--20-140-100-100p-113-iso8859-1 
-b&h-lucidabright-medium-i-norma1--25-180-100-lOO-p-142-iso8859-1 
-b&h-lucidabright-medium-i-norma1--26-190-100-100-p- 148-iso8859-1 
-b&h-lucidabright-medium-i-normal--34-240-100- lO0-p- 194-iso8859-1 
-b&h-lucidabright-medium-r-norma1--11-80-100-lOO-p-63-iso8859-1 
-b&h-lucidabright-medium-r-norma1--14-100-100-100-p-80-iso8859-1 
-b&h-lucidabright-medium-r-norma1--17-120-100-100-p-96-iso8859-1 
-b,gh-lucidabright-medium-r-norma1--20-140-100-100-p-114-iso8859-1 
-b&h-lucidabright-medium-r-norma1--25-180-100-100-p- 142-iso8859-1 
-b&h-lucidabright-medium-r-norma1--26-190-100-100-p- 149-iso8859-1 
-b&h-lucidabright-medium-r-normal--34-240-100- lO0-p- 193-iso8859-1 
-b&h-lucidatypewriter-bold-r-normal-sans- 11-80-100-100-m-70-iso8859-1 
-b&h-lucidatypewriter-bold-r-norma1-sans-14-100-100-100-m-80-iso8859-1 
-b&h-lucidatypewriter-bold-r-norma1-sans-17-120-100-100-m-100-iso8859-1 
-b&h-lucidatypewriter-bold-r-normal-sans-20-1 40-100-100-m- 120-iso8859-1 
-b&h-lucidatypewriter-bold-r-norma1-sans-25-180-100-100-m-150-iso8859-1 
-b,gh-lucidatypewriter-bold-r-norma1-sans-26-190-100-100-m-159-iso8859-1 
-b&h-lucidatypewriter-bold-r-norma1-sans-34-240-100-100-m-200-iso8859-1 
-b&h-lucidatypewriter-medium-r-normal-sans- 11-80-100-100-m-70-iso8859-1 

Release 4 Standard Fonts 591 



Foundry: adobe 
Family: courier 

Release 4 Standard Fonts 593 



Foundry: adobe 
Family: helvetica 

594 

X Window System User's Guide, Motif Edition 



Foundry: adobe 
Family: new century schoolbook 

Release 4 Standard Fonts 595 



Fo ui3dry : 
Fami/y: 

b&h 
lucida 

596 X Window System User's Guide, Motif Edition 



Foundry: b&h 
Family: lucidabright 

Release 4 Standard Fonts 597 



Foundry: adobe 
Family: times 

598 X Window System User's Guide, Motif Edition 



Foundry: adobe 
Family: symbol 

Foundry: bh 
Family: iucidatypewriter 

Release 4 Standard Fonts 599 



Foundry: bitstream 
Family: charter 

6OO 

X Window System User's Guide, Motif Edition 



Foundry: mist 
Family; fixed 

602 X Window System User's Guide, Motif Edition 



Foundry: schumacher 
Family: clean 

Release 4 Standard Fonts 603 



Encoding: adobe-fontspecific 

604 X Window System User's Guide, Motif Edition 



Encoding: iso8859 

606 X Window System User's Guide, Motif Edition 



Encoding: jisx0201.1976 

Release 4 Standard Fonts 607 



o ," --AV  

Encoding: jisx0208.1983 

608 X Window System User's Guide, Motif Edition 



I R nL 

Encoding: jisx0201.1976 

Release 4 Standard Fonts 609 



Encoding: sunolglyph 

6 lO X Window System User's Guide, Motif Edition 



Encoding: SunOLcursor 

Release 4 Standard Fonts 611 



Example B-1 is the source code for the xshowfonts program, which we used to create most of 
the illustrations in this appendix. If you don't want to type it in, you can find instructions for 
getting it online in the Preface. 

Examp B-1. xshowfontsoue ting 
/* Dan Heller <argv@sun.com>, based on a design by Tim O'Reilly 
* xshowfonts.c - 
* Displays a set of fonts specified on the command line, from 
* a pipe, or typed into stdin. Fonts can be specified as specific 
* or wildcard character strings. A pixmap is created to 
* display all the fonts. This is done by using the pixmap as the 
* pixmap image for a label widget. Each font prints its own name 
* in its own font style -- the -phrase option prints the phrase 
* instead. 
* All fonts are loaded first and scanned to determine the total 
* width and height of the pixmap first. Then the fonts are 
* reopened again to actually render the fonts into the pixmap. 
* All this could be avoided by using XListFontsWithInfo() 
* rather than XListFonts() but since the list is potentially 
* very large, I didn't want to overload the server and client 
* with all those fonts + a very large pixmap. 
* Usage: xshowfonts 
* -s sorts the fonts in alphabetical order before displaying 
them. 
* -v verbose mode for when input is redirected to stdin. 
* -w width of viewport window 
* -h height of viewport window 
* -fg foreground_color 
* -bg background_color 
* -phrase "text string" (otherwise, name of font is used) 
* -indicates to read from stdin. Piping doesn't require 
the "-' argument. With no arguments, xshowfonts reads 
* from stdin anyway. 
* Neat ways to use the program: 
* xshowfonts -fg green -bg black "*adobe*" 
* xshowfonts -sort "*" 
* xshowfonts -phrase "The quick brown fox jumps over the lazy 
* dog" "*times*" 
* xlsfonts [ xshowfonts -sort 
* xshowfonts "*helvetica*" 
* compile: (triple click and paste next line) 
cc -O -s xshowfonts.c -iXaw -iXt -iXmu -IXll -o xshowfonts 
./ 
#include <stdio.h> 
#include <Xll/Intrinsic.h> 
#include <Xll/StringDefs.h> 
#include <Xll/Xaw/Label.h> 
#include <Xll/Xaw/Viewportoh> 
struct resrcs { 
int sort; 

612 X Window System User's Guide, Motif Edition 



Example B-1. xshowfont source listing (continued) 

int verbose; 
Pixel fg, bg; 
char *phrase; 
int view_width, view_height; 
} Resrcs; 
static XtResource resources[] = { 
{ "sort", "Sort", XtRBoolean, sizeof (int), 
XtOffsetOf(struct resrcs,sort), XtRImmediate, 
False }, 
{ "verbose", "Verbose", XtRBoolean, sizeof (int), 
XtOffsetOf(struct resrcs,verbose), XtRImmediate, 
False }, 
{ "foreground", "Foreground", XtRPixel, sizeof (Pixel), 
XtOffsetOf(struct _resrcs, fg), XtRString, 
XtDefaultForeground }, 
{ "background", "Background", XtRPixel, sizeof (Pixel), 
XtOffsetOf(struct _resrcs,bg), XtRString, 
XtDefaultBackground }, 
{ "phrase", "Phrase", XtRString, sizeof (String), 
XtOffsetOf(struct _resrcs,phrase), XtRImmediate, NULL }, 
{ "view-width", "View-width", XtRInt, sizeof (int), 
XtOffsetOf(struct _resrcs,view_width), XtRImmediate, 
(char *)500 }, 
{ "view-height", "View-height", XtRInt, sizeof (int), 
XtOffsetOf(struct _resrcs,view_height), XtRImmediate, 
(char *)300 }, 

:i.-.... . static XrmOptionDescRec options [ ] = { 
.- ! ,, 
ilii { "-sort", "sort", XrmoptionNoArg, "True }, 
{ "-v", "verbose", XrmoptionNoArg, "True" }, 
ii! { "-fg", "foreground", XrmoptionSepArg, NULL }, 
!iiiii!i i { "-bg", "background", XrmoptionSepArg, NULL }, 
.:i.:.:....i. " { "-phrase", "phrase", XrmoptionSepArg, NULL }, 
ii.-ii!ii::ii-"ii { "-w", "view-width", XrmoptionSepArg, NULL }, 
-::i:.-::-[--:.i { "-h", "view-height", XrmoptionSepArg, NULL }, 
. .:.:.:.:.: 
iii!iiiii /* sort font according to these parameters. 
::!iiiii * font specs we're interested in: 
. .: 
-:..iii * -fndry-fmly-wght-slant-*swdth-*adstyl-*pxlsz-ptsz- . . . . 
:.:::::::: 
i:ili::i!!i ..... * foundry -- sort by foundry first; similar ones are always 
::i!!i::::i.ii * grouped together 
::!!::!ii * weight--medium, demi-bold, bold 
iii * slant -- roman, italic/oblique, reverse italic/oblique 
:-:!:-ii * (i or o, r, ri, ro) 
!ijiiiii i * ptsize -- increase numerical order 
i......!ili font_cmp (fl, f2) 
i:{!ii : char **fl, **f2; 
..:.:.:.:..-..- 
iii!ill char fndryl[16], fmlyl[64], wghtl[32], slantl[3]; 
i!i char fndry2[16], fmly2164], wght2132], slant2[3]; 
:i.:i i char *font fret str = "-% ['-]-% ['-]-% ['-]-% ['-]-%* ['0-9] % 
'':-:":: * d - % d -- " ; 

Release 4 Standard Fonts 613 



Examp B-1. xshowfont souse ting (continued) 
n = sscanf(*fl, font fmt str, fndryl, fmlyl, wghtl, slantl, 
&ptsizel); 
m = sscanf(*f2, font_fmt_str, fndry2, fmly2, wght2, slant2, 
&ptsize2); 
if (m < 5 I n < 5) 
/* font not in correct format -- just return font names 
* in order */ 
return strcmp(*fl, *f2); 
if (n = strcmp(fndryl, fndry2)) 
return n; /* different foundries -- return alphabetical 
* order */ 
if (n = strcmp(fmlyl, fmly2)) 
return n; /* different families -- return alphabetical 
* order */ 
if (n = strcmp(wghtl, wght2)) 
return -n; /* weight happens to be correct in reverse 
* alpha order */ 
if (n = strcmp(slantl, slant2)) 
return n; /* slants happen to be correct in alphabetical 
* order */ 
/* sort according to point size */ 
return ptsizel - ptsize2; 
main(argc, argv) 
int argc; 
char *argv[]; 
Widget topLevel, vp; 
char **list = (char **)NULL, **tmp; 
char buf[128]; 
extern char **XListFonts(); 
extern int strcmp(); 
XFontStruct *font; 
Pixmap pixmap; 
GC gc; 
Display *dpy; 
int istty = isatty(0), redirect = !istty, i, j, total = 0; 
unsigned int w, width = 0, height = 0; 
topLevel = XtInitialize(argv[0], argv[0], options, 
XtNumber(options), &argc, argv); 
dpy = XtDisplay(topLevel); 
XtGetApplicationResources(topLevel, &Resrcs, 
resources, XtNumber(resources), NULL, 0); 
if (!argv[l] I !strcmp(argv[l], "-")) { 
printf("Loading fonts from input. "); 
if (istty) { 
puts("End with EOF or ."); 
redirect++; 
} else 
puts("Use -v to view font names being loaded."); 
} else if (!istty && strcmp(argv[l], "-")) 
printf("%s: either use pipes or specify font names -- 
not both.\n", 

614 X Window System User's Guide, Motif Edition 



Examp B-1. xshowfont souse ting Continued) 
} 
if ((w = XTextNidth(font, list[i], 
strlen(list[i]))) > width) 
width = w; 
height += font->ascent + font->descent; 
XFreeFont(dpy, font); 
} 
width += 6; 
height += 6; 
/* Create pixmap + GC */ 
printf("Creating pixmap of size %dx%d\n", width, height); 
if (!(pixmap = XCreatePixmap(dpy, DefaultRootWindow(dpy), 
width, height, DefaultDepth(dpy, DefaultScreen(dpy))))) 
XtError("Can't Create plxmap"); 
if (!(gc = XCreateGC(dpy, pixmap, NULL, 0))) 
XtError("Can't create gc"); 
XSetForeground(dpy, gc, Resrcs.bg); 
XFillRectangle(dpy, pixmap, gc, 0, 0, width, height); 
XSetForeground(dpy, gc, Resrcs.fg); 
XSetBackground(dpy, gc, Resrcs.bg); 
height = 0; 
for (i = 0; i < total; i++) { 
if (!(font = XLoadQueryFont(dpy, list[i]))) 
continue; /* it's already been reported */ 
XSetFont(dpy, gc, font->fid); 
height += font->ascent; 
if (Resrcs.phrase) 
XDrawString(dpy, pixmap, gc, 0, height, 
Resrcs.phrase, strlen(Resrcs.phrase)); 
else 
XDrawString(dpy, pixmap, gc, 5, height, list[i], 
strlen(list[i])); 
height += font->descent; 
XFreeFont(dpy, font); 
} 
vp = XtVaCreateManagedWidget("viewport-, viewportWidgetClass, 
topLevel, 
XtNallowHoriz, True, 
XtNallowVert, True, 
XtNwidth, Resrcs.view width, 
XtNheight, Resrcsoview_height, 
NULL); 
XtVaCreateManagedWidget(-_foo-, labelWidgetClass, vp, 
XtNbitmap, pixmap, 
NULL); 
if (!redirect) 
XFreeFontNames(list); 
XtRealizeWidget(topLevel); 
XtMainLoop(); 

616 X Window System User's Guide, Motif Edition 



C 

Standard Bitmaps 

This appendix shows the bitmaps included with the standard distribution of 
the X Window System. These can be used for setting window background, 
cursor symbols, pixmaps, and possibly for application icon pixmaps. 



C 
Standard Bitmaps 

A number of bitmaps are included with the standard distribution of the X Window System. 
These bitmaps can be used for setting window background pixmaps and possibly for applica- 
tion icon pixmaps. 
The standard bitmaps are generally located in the directory lusr/include/X11/bitmaps. Each 
bitmap is in standard X11 bitmap format in its own f'de. The bitmap application can be used 
to view these bitmaps in larger scale and to edit them (though their permissions normally do 
not allow overwriting). 
You can use these bitmaps to set the background pattern of a window in any application that 
allows it. For example, if you wanted to change the root window background pixmap, you 
could do so using xsetroot: 
xsetroot -bitmap /usr/include/Xll/bitmaps/wide_weave 
Note that the bitmaps that come in pairs, such as cntr__ptr and cntr__ptrmsk, are 
intended for creating pointer shapes. See Chapter 12, Setup Clients, for information on spec- 
ifying a bitmap as the root window pointer. 
The 63 bitrnaps pictured on the following pages are included in the Release 4 standard distri- 
bution of X. Table C-I lists those bitmaps that have been added to the standard distribution 
in Release 4. 

Table C-1. Standard Bitmaps Available as of Release 4 

calculator 
escherknot 
keyboard16 
mailemptymsk 
menul0 
menu8 
terminal 
xlogo 11 

dropbar7 
hlines2 
letters 
mail full 
menul2 
noletters 
vlines2 

opbar8 
hlines3 
mailempty 
mailfullmsk 
menul6 
plaid 
vlines3 

Standard Bitmaps 619 



e scher nno : I mense :manu s 

woman 

Fgure C-1. The standard bit[naps (contJ'nued) 

Standard B/t/naps 621 



D 

Standard Cursors 

This appendix shows the standard cursor images that can be used by X 
programs. 



D 
Standard Cursors 

Table D-1 lists the cursors available in the standard distribution of X from MIT; the cursor 
shapes themselves are pictured in Figure D-1. 
To specify a cursor as an argument to a command line option, as the value of a resource vari- 
able, etc., strip the xc_ prefix from the symbol name. For example, to specify the 
XC_sailboat: cursor as the xterm pointer, you could enter the command: 

Each cursor has an associated numeric value (to the right of the symbol name in the table). 
You may notice that the values skip the odd numbers. Each cursor is actually composed of 
two font characters: the character that defines the shape (pictured in Figure D-l), and a mask 
character (not shown) that sets the cursor shape off from the root (or other) window. (More 
precisely, the mask selects which pixels in the screen around the cursor are disturbed by the 
cursor.) The mask is generally the same shape as, the character it underlies but is one pixel 
wider in all directions. 

To get an idea of what masks look like, display the entire cursor font using the command: 

% xfd -fn cursor 

The mwm window manager uses several of the standard cursor symbols. In addition, mwm 
uses some Motif-specific cursors, which are illustrated in Figure 1-3 in Part One of this 
guide. 

Standard Cursors 625 



r > 

X X X X X X X 

Figure D-1. The Standard Cursors 

Standard Cursors 627 



Same as non-escaped SI 
Select GO Character Set (SCS) 
C = ] --) Special Character and Line Drawing Set 
C = [i]  Alternate Character ROM Standard Set 
C = []  Alternate Character ROM Special Set 
C--[] --) United Kingdom (UK) 
C = I-B-] -- United States (USASCII) 
Select G1 Character Set (SCS) 
C = ] --) Special Character and Line Drawing Set 
C = [i] --) Alternate Character ROM Standard Set 
C = [] --) Alternate Character ROM Special Set 
C = [] --) United Kingdom (UK) 
C = I-B-] -- United States (USASCII) 
Select G2 Character Set (SCS) 
C = ] --) Special Character and Line Drawing Set 
C = [i] --) Alternate Character ROM Standard Set 
C = [] --) Alternate Character ROM Special Set 
C = [] --) United Kingdom (UK) 
C = I-B-] -- United States (USASCII) 
Select G3 Character Set (SCS) 
C = ] --) Special Character and Line Drawing Set 
C = [i] --) Alternate Character ROM Standard Set 
C = [] --) Alternate Character ROM Special Set 
C--[] --) United Kingdom (UK) 
C = I-B-] -- United States (USASCII) 
Save Cursor (DECSC) 
Restore Cursor (DECRC) 
Application Keypad (DECPAM) 
Normal Keypad (DECPNM) 
Index (IND) 
Next Line (NEL) 
Tab Set (HTS) 
Reverse Index (RI) 
Single Shift Select of G2 Character Set (SS2) 
Single Shift Select of G3 Character Set (SS3) 
Return Terminal ID (DECID) 

xterm Control Sequences 633 



Same as non-escaped BEL 
Same as non-escaped BS 
Same as non-escaped HT 
Same as non-escaped NL 
Same as non-escaped VT 
Same as non-escaped NP 
Same as non-escaped CR 
Same as non-escaped SO 
Same as non-escaped SI 
Same as non-escaped BEL 
Same as non-escaped BS 
Same as non-escaped HT 
Sane as non-escaped NL 
Same as non-escaped VT 
Same as non-escaped NP 
Same as non-escaped CR 
Same as non-escaped SO 

Same as non-escaped SI 
Insert P, (Blank) Character(s) (default = 1) (ICH) 
Cursor Up P, Times (default = 1) (CUU) 
Cursor Down P, Times (default = 1) (CUD) 
Cursor Forward P, Times (default = 1) (CUF) 
Cursor Backward P, Times (default = 1) (CUB) 
Cursor Position [row;column] (default = [1,1]) (CUP) 
Erase in Display (ED) 
P, = ]  Clear Below (default) 
P, = [] --)Clear Above 
= -> Clear All 
Erase in Line (EL) 
P, = [] --) Clear to Right (defaulO 
P, = [] ---) Clear to Left 
= -> Clear All 
Insert P, Line(s) (default = 1) (IL) 
Delete P, Line(s) (default = 1) (DL) 
Delete P, Character(s) (default = 1) (DCH) 
Track mouse 

634 

X Window System User's Guide, Motif Edition 



Restore DEC Private Mode 
Ps = ]  Normal/Application Cursor Keys (DECCKM) 
Ps = []  80/132 Column Mode (DECCOLM) 
Ps = ]  Jump (Fast)/Smooth (Slow) Scroll (DECSCLM) 
Ps = [] -- Normal/Reverse Video (DECSCNM) 
P = [-6-]  Normal/Origin Cursor Mode (DECOM) 
P =  -- No Wraparound/Wraparound Mode (DECAWM) 
P = []  Auto-repeat/No Auto-repeat Keys (DECARM) 
Ps = ]  Don't Send/Send MIT Mouse Row & Column on Button 
Press 

Disallow/Allow 80 -) 132 Mode 

 Off/On curses(5) fix 
 Turn Off/On Margin Bell 
 No Reverse-wraparound/Reverse-wraparound Mode 
 Stop/Start Logging 
P = 1]1-]  Use Normal/Alternate Screen Buffer 
P = [i]0-]0-]0-]  Don't send/send VT200 Mouse Row & Column on 
Button Press 
P = ]0-]0-][]  Don't send/send VT200 Hilite Mouse Row & 
Column on Button Press 
Save DEC Private Mode 
P = ]  Normal/Application Cursor Keys (DECCKM) 
P = []  80/132 Column Mode (DECCOLM) 
P = 1]  Jump (Fast)/Smooth (Slow) Scroll (DECSCLM) 
P = l]  Normal/Reverse Video (DECSCNM) 
P = l-6-]  Normal/Origin Cursor Mode (DECOM) 
P =   No Wraparound/Wraparound Mode (DECAWM) 
P --   Auto-repeat/No Auto-repeat Keys (DECARM) 
P =  -- Don't Send/Send MIT Mouse Row & Column on Button 
Press 
g = 1]0-]  Disallow/Allow 80 -) 132 Mode 
g = 1]]  Off/On curses(5) fix 
P --1]1]  Turn Off/On Margin Bell 
Ps -- []l] -- No Reverse-wraparound/Reverse-wraparound Mode 
P = 1]1-6-]  Stop/Start Logging 
P -1]1-]  Use Normal/Alternate Screen Buffer 

xterm Control Sequences 637 



P, = [0"]0"]0"] --) Don't send/send VT200 Mouse Row & Column on 
Button Press 
P, = [0]0]] --) Don't send/send VT200 nilite Mouse Row & 
Column on Button Press 
Set Text Parameters 
P, = -] --) Change Window Name and Title to Pt 
P, =  --) Change Window Name to Pt 
P, = [] --) Change Window Title to Pt 
P, = ][-6] --) Change Log File to Pt 
P, = ]0] --) Change Font to Pt 
Full Reset (RIS) 
Locking Shift Select of G2 Character Set (LS2) 
Locking Shift Select of G3 Character Set (LS3) 

Tektronix 4014 Mode 

Most of these sequences are standard Tektronix 4014 control sequences. The major features 
missing are the alternate (APL) character set and the write-thru and defocused modes 

Bell (Ctrl-G) 
Backspace (CIrI-H) 
Horizontal Tab (Ca'l-I) 
Line Feed or New Line (Ctrl-J) 
Vertical Tab (CIrI-K) 
Form Feed or New Page (Ca'l-L) 
Carriage Return (Ca'l-M) 
Switch to VT102 Mode 
Return Terminal Status 
PAGE (Clear Screen) 
COPY (Save Tektronix Codes to File) 
Bypass Condition 
GIN mode 
Special Point Plot Mode 
Graph Mode (same as [) 
Incremental Plot Mode (same as [) 
Alpha Mode (same as [-) 
Select Large Character Set 

638 X Window System User's Guide, Motif Edition 



Select #2 Character Set 
Select #3 Character Set 
Select Small Character Set 
Set Text Parameters 
Ps = [-0"] -- Change Window Name and Title to Pt 
Ps = [  Change Icon Name to Pt 
Ps = ] -- Change Window Title to Pt 
Ps --[-]-] -- Change Log File to Pt 
Normal Z Axis and Normal (solid) Vectors 
Normal Z Axis and Dotted Line Vectors 
Normal Z Axis and Dot-Dashed Vectors 
Normal Z Axis and Short-Dashed Vectors 
Normal Z Axis and Long-Dashed Vectors 
Defocused Z Axis and Normal (solid) Vectors 
Defocused Z Axis and Dotted Line Vectors 
Defocused Z Axis and Dot-Dashed Vectors 
Defocused Z Axis and Short-Dashed Vectors 
Defocused Z Axis and Long-Dashed Vectors 
Write-Thru Mode and Normal (solid) Vectors 
Write-Thru Mode and Dotted Line Vectors 
Write-Thru Mode and Dot-Dashed Vectors 
Write-Thru Mode and Short-Dashed Vectors 
Write-Thru Mode and Long-Dashed Vectors 
Point Plot Mode 
Graph Mode 
Incremental Plot Mode 
Alpha Mode 

xterm Control Sequences 639 



F 

Translation Table Syntax 

This appendix describes the basic syntax of translation table resources, 
described in Chapter 10, Setting Resources. 

In This Appendix: 

Event Types and Modifiers ................................................................... 643 
Detail Field ...................................................................................... 645 
Modifiers .......................................................................................... 646 
Complex Translation Examples ........................................................ 646 



F 
Translation Table Syntax 

This appendix explains some of the more complex aspects of translation table syntax. It 
probably gives more detail than the average user will need but we've included it to help clar- 
ify this rather complicated topic. 

Event Types and Modifiers 

The syntax of the translation table is sufficiently general to encompass a wide variety of 
events and circumstances. Event translations can be specified to handle characteristic user 
interface idioms like double clicking, dragging, or combining keyboard modifiers with 
pointer button input. To specify translations that use these features, it is necessary to learn 
more about the detailed syntax used to specify translations. 

An activity susceptible to translation is a sequence of events and modifiers (that perform an 
action). Events are specified in angle brackets and modifiers precede the event they modify. 
The legal events that can be specified in a translation are as shown in Table F-1. 

Table F-1. Event Types and Their Abbreviations 

Event Name 

KeyPress 
KeyUp 
ButtonPress 
ButtonRelease 
BtnlDown 

Btn5Down 
BtnlUp 

Btn5Up 

Event Type 

Keyboard 
Keyboard 
Mouse Button 
Mouse Buuon 
Mouse Button Press 

Mouse Button Release 

Abbreviations/Synonyms 

Key, KeyDown 
KeyRelease 
BtnDown 
BtnUp 

Translation Table Syntax 643 



Table F-I. Event Types and Their Abbreviations (continued) 

Event Name 

MotionNotify 
ButtonMotion 
ButtonlMotion 

Button5Motion 
EnterNotify 
LeaveNotify 
FocusIn 
FocusOut 
KeymapNotify 
ColormapNotify 
Expose 
GraphicsExpose 
NoExpose 
VisibilityNotify 
CreateNotify 

Event Type 

Mouse Motion 

Motion w/any Button Down 
Motion w/Button Down 

Mouse in Window 

Keyboard Input Focus 
Changed Key Map 
Changed Color Map 
Related Exposure Events 

Window Management 

Abbreviations/Synonyms 

Motion, MouseMoved, 
PtrMoved 
BtnMotion 
BtnlMotion 

Btn5Motion 
Enter, EnterWindow 
LeaveWindow, Leave 

Keymap 
Clrmap 

GrExp 
NoExp 
Visible 
Create 

DestroyNotify 
UnmapNotify 
MapNotify 
MapRequest 
ReparentNotify 
ConfigureNotify 
ConfigureRequest 
GravityNotify 
ResizeRequest 
CirculateNotify 
CirculateRequest 
PropertyNotify 
SelectionClear 
SelectionRequest 
SelectionNotify 

Intra-client Selection 

Destroy 
Unmap 
Map 
MapReq 
Reparent 
Configure 
ConfigureReq 
Grav 
ResReq 
Circ 
CircReq 
Prop 
SelClr 
SelReq 
Select 

The possible modifiers of an event are listed in the table. The modifiers Mod 1 through Mod5 
are highly system-dependent, and may not be implemented by all servers. 

644 

X Window System User's Guide, Motif Edition 



Modifiers can be closely controlled to define exactly which events can be specified. For 
example, if you want the action to be performed by pointer button clicks but not by pointer 
button clicks with the Control or Shift key down, these limitations can be specified. Simi- 
larly, if you don't care if there are modifiers present, this can also be specified. 

Table F-3 lists the available event modifiers. 

Table F-3. Event Modifiers and their Meanings 

Modifier 

None <event> 
<event> 
Modl Mod 

!Modl Mod2 <event> 
Modl -Mod2 <event> 

Meaning 

No modifiers allowed. 
Doesn't care. Any modifiers okay. 
Modl and Mod2, plus any others 
(i.e., anything that includes m 1 and m2). 
Modl and Mod2 but nothing else. 
Modl and not Mod2. 

Complex Translation Examples 

The following translation specifies that function f is to be invoked when both the Shift key 
and the third pointer button are pressed. 
Shift<Btn3Down>: f() 
To specify that both the Control and Shift keys are to be pressed use: 
Ctrl Shlft<Btn3Down>: f() 
To specify an optional repeat count for an activity, put a number in parentheses after the 
action. The number refers to the whole translation. To make the last example require a 
double-click, with both Control and Shift keys pressed, use: 
Ctrl Shlft<Btn3Down>(2) : f() 
The server distinguishes between single-clicks and double-clicks based on a pre-programmed 
timing interval. If a second click occurs before the interval expires, then the event is inter- 
preted as a double-click; otherwise the event is interpreted as two single-clicks. The variable 
cllckTime is maintained deep in the internals of X. Unfortunately, thus far there is no 
way to set this time interval to match user preference. Currently it is set to be 200 mil- 
liseconds. 
A translation involving two or more clicks can be specified as (2+) in the previous example. 
In general, a plus sign following the number n would mean n or more occurrences of the 
event. 

646 X Window System User's Guide, Motif Edition 



 e even can spec 1 y separating them with commas on the translation line. To 
indicate pressing button 1, pressing buuon 2, then releasing button 1, and finally releasing 
button 2, use: 
<Bt:nlDown>, <Bt:n2Down>, <Bt:nlUp>, <Bt:n2Up> : f { ) 
Another way to describe this acdon in English would be to say "while button 1 is down, click 
button 2." "Meaningless" pointer movement is generally ignored. In the previous case, for 
example, if pointer motion occurred while the buuons were down, it would not interfere with 
detection of the event. Thus, inadvertent pointer jiggling will not thwart even the most com- 
plex user-input sequences. 

Translation Table Syntax 647 



G 

Athena Widget Resources 

In This Appendix: 

The Widget Class Hierarchy ................................................................. 651 
Widgets in the Application .................................................................... 656 
What all this Means ............................................................................. 659 
Complications ...................................................................................... 660 
Box ...................................................................................................... 661 
Resources ....................................................................................... 661 
Command ............................................................................................ 661 
Resources ....................................................................................... 662 
Translations and Actions .................................................................. 662 
Dialog .................................................................................................. 663 
Resources ....................................................................................... 663 
Form .................................................................................................... 664 
Resources ....................................................................................... 664 
Grip ..................................................................................................... 665 
Resources ....................................................................................... 665 
Translations and Actions .................................................................. 665 
Label ................................................................................................... 666 
Resources ....................................................................................... 666 
List ........................  ............................................................................. 667 
Resources ....................................................................................... 667 
Translations and Actions .................................................................. 668 
MenuButton ......................................................................................... 668 
Resources ....................................................................................... 668 
Translations and Actions .................................................................. 669 
Parted .................................................................................................. 669 
Resources ....................................................................................... 670 



Scrollbar .............................................................................................. 672 
Resources ....................................................................................... 672 
Translations and Actions .................................................................. 673 
Simple ................................................................................................. 674 
Resources ....................................................................................... 674 
SimpleMenu ........................................................................................ 675 
Resources ....................................................................................... 675 
Translations and Actions .................................................................. 676 
Sme ..................................................................................................... 676 
Resources ....... ; ............................................................................... 677 
SmeBSB .............................................................................................. 677 
Resources ....................................................................................... 677 
SmeLine .............................................................................................. 678 
Resources ....................................................................................... 678 
StripChart ............................................................................................ 678 
Resources ....................................................................................... 678 
Text ..................................................................................................... 679 
Resources ....................................................................................... 679 
Translations and Actions .................................................................. 680 
Cursor Movement Actions .............................................................. 681 
Delete Actions ............................................................................... 682 
Selection Actions ........................................................................... 683 
New Line Actions ........................................................................... 684 
Kill Actions ..................................................................................... 684 
Miscellaneous Actions ................................................................... 684 
Event Bindings ............................................................................... 686 
Toggle ................................................................................................. 688 
Resources ....................................................................................... 688 
Translations and Actions .................................................................. 689 
Radio Groups .................................................................................. 689 
Viewport .............................................................................................. 690 
Resources ....................................................................................... 690 



G 
Athena Widget Resources 

As suggested on the reference pages for various clients, you can set not only resources 
defined by the application itself, but also resources that apply to any of the widgets that make 
up the application. The reference page for the application sometimes lists the most important 
of these resources, but for fuller customization, you need to know more about each widget. 

Unfortunately, the design of the X Toolkit is such that to really do the right thing, you proba- 
bly need to know a bit more about Toolkit programming than the average user might like. 

In this appendix, we provide both some introductory concepts about how widgets are used in 
X Toolkit programs, and reference information about each class of widgets. If you are a 
Toolkit programmer or other sophisticated user, feel free to skip right to the widget reference 
section later in this appendix. 

The Widget Class Hierarchy 

The first thing you need to know is how widgets are builL 
Rather than starting each widget from scratch, the widget programmer starts with a copy of 
another, more basic widget, and modifies iL This process is called subclassing the widget, 
and the sequence of widgets leading up to the one you see is called its class hierarchy. 
Because of the way subclassing works, a widget inherits all of the characteristics of its 
superclasses, except those that are explicidy overridden or changed. 
The class hierarchy starts with a class called Object, which defines some basic characteristics 
common to all widgetsmnamely the ability to understand resources, and to be linked to 
applications via a mechanism referred to as a callback. (When you click on a "quit" button, 
and the application quits, that is because the widget has communicated with the application 
via a callback.) 
RectObj is a subclass of Object. RectObj adds various resources having to do with the fact 
that widgets are rectangular:, width, height, borderWidth, and x, y positions. RectObj also 
adds resources for sensitivity rathe fact that a widget can be temporarily "disabled" by a cli- 
ent (so for example, not allowing you to choose an option on a menu that would close a file if 
no file was open.) 

Athena Widget Resources 651 



expect them to be Core resources, but which are not. They are defined individually by each 
of the widget classes that use them. This can be confusing, especially since they do corre- 
spond to standard X Toolkit options. But really, it is hair-splitting to worry about where they 
are defined--4hey are sufficiently standard to fall under the colloquial understanding of Core 
resources. 
We'll say more about the subject of resource conversion later. First, though, let's finish 
describing the base classes provided by the X Toolkit, which are common to all Xt-based 
widget sets (including both Modf and the Athena widgets). 
There is a special class of widgets whose job is to manage the size and/or position of other 
widgets. These are called Composite widgets, and all such geometry-managing widgets, are 
children of the Composite widget class. Composite inherits all of the characteristics of Core, 
and adds resources (settable only by the programmer) for identifying which widgets it should 
treat as its children. 
Some simple geometry-managing widgets such as the Athena Box widget are direct subc- 
lasses of Core. However, there is another, more complex class of geometry-managing widget 
defined by the X Toolkit Intrinsics, called Constraint. A constraint widget defines special 
resources, called constraint resources, that apply to its children rather than to itself. They are 
actually resources of the constraint widget, but are specified as if they were resources of the 
child. The clearest example of constraint resources is provided by the Athena Form widget, 
which allows widgets to be positioned with respect to one another, so that they always keep 
the same arrangement, even when the Form is resized. For example, xcalc is implemented 
using a Form widget. Resources such as: 
Form widget 
I Command widget child of Form 
I I Constraint resource of Form appears to be resource of child 
I I I 
XCalc. ti.buttonl2, fromHoriz : buttonll 
XCalc. ti.buttonl2, fromVert : button7 
specify that buttonl2 (label PI) should always be next to buttonl 1 (label xl), and over but- 
ton7 (label 7). We'll return to this example later, when we talk about the instance hierarchy 
of widgets in an application. 
At any rate, there is one other subclass of Composite that bears mention: the Shell widget 
class. Shell widgets are simple composite widgets; they manage only one child mthe appli- 
cation's main window, and they make themselves exactly the same size, so that they are hid- 
den behind it. Even though you never see them, though, Shell widgets are extremely impor- 
tant, since they are the widgets that know how to interact with the window manager. Shell 
introduces several resources of importance to the application programmer, but only one of 
importance to the user:, geometry (class Geometry). 
There are actually seven subclasses of Shell, three of which are for internal toolkit purtx)ses 
and four of which are used by application programmers in different circumstances. For 
example, there is one kind of shell widget used for the main window of an application (class 
TopLevelShell) and another used as the parent of a popup widget like a dialog box (class 
OverrideShell) that should never be manipulated by the window manager. (Nodce that mwm 

Athena Widget Resources 653 



Commercial Motif applications should document all of the appropriate resources for the 
Motif widgets they use. 

Box 

The Box widget provides geometry management of arbitrary widgets in a box of a specified 
dimension. Box moves but does not resize its children. The children are rearranged when 
the Box is resized, when its children are resized, or when children are managed or 
unmanaged. The Box widget always attempts to pack its children as closely as possible 
within the geometry allowed by its parent. 
Box widgets are commonly used to manage a related set of Command widgets and are fre- 
quently called ButtonBox widgets, but the children are not limited to buttons. 
The children are arranged on a background that has its own specified dimensions and color. 

Resources 

The following new resources are associated with the Box widget: 
hSpace (class HSpace) 
Number of pixels to the left or to the right of each child. Default is 4. 
orientation (class Orientation) 
Specifies whether the preferred shape of the box is tall and narrow (vertical, the 
defaul0 or short and wide (horizontal). 
vSpace (class VSpace) 
Number of pixels above or below each child. Default is 4. 

Command 

The Command widget is an area, often rectangular, that contains a text or pixmap label and 
calls an application function when "pressed" with a pointer button. This selectable area is 
sometimes referred to as a 'butt0n." When the pointer cursor is on the button, the button bor- 
der is highlighted to indicate that the button is ready for selection. When a pointer button is 
pressed, the command widget indicates that it has been selected by reversing its foreground 
and background colors. 

Athena Widget Resources 661 



Resources 

The following new resources are associated with the Command widget: 
highllghtThickness (class Thickness) 
The thickness of the line drawn by the highlight action. 
shapeStyle (class ShapeStyle) 
Nonrectangular buttons may be created using this resource. Nonrcctangular buttons 
are supported only on a server that supports the Shape Extension. If nonrectangular 
buttons are specified for a server lacking this extension, the shape is ignored and the 
widgets will be rectangular. The following shape names are currently supported: 
Rectangle, Oval, Ellipse, and roundedRectangle, in any case. 
cornerRoundPercent (class CornerRoundPercent) 
When a ShapeStyle of roundedRectangle is used, this resource controls the 
radius of the rounded corner. The radius of the rounded corners is specified as a per- 
centage of the length of the shortest side of the widget 

Translations and Actions 

The following are the default translation bindings that are used by the Command widget: 
<EnterWindow> : highlight ( ) 
<LeaveWindow> : reset ( ) 
<BtnlDown> : set ( ) 
<BtnlUp>: notify() unset () 
With these bindings, the user can cancel the action before releasing the button by moving the 
pointer out of the Command widget 
The full list of actions supported by Command is as follows: 
highlight() Displays the internal highlight border in the color (foreground or 
background) that contrasts with the interior color of the Command 
widget. This is normally bound to <EnterWindow> events, so the 
widget border is highlighted when the pointer enters the window. 
unhighlight () Displays the internal highlight border in the color (foreground or 
background) that matches the interior color of the Command 
widget This action is called internally by reset(), and does not need an 
explicit translation. 
set() Enters the set state, in which notify is possible and displays the 
interior of the button, including the highlight border, in the foreground 
color. The label is displayed in the background color. This usually hap- 
pens when a pointer button (button 1 by default) is pressed in the 
widget 
unset ( ) Cancels the set state and displays the interior of the button, including 
the highlight border, in the background color. The label is displayed in 

662 X Window System User's Guide, Motif Edition 



fromVert (class Widget) 
vertDistance (class Thickness) 
Similar to previous resources, except that fromVert and vertDistance position 
a child widget by a specified number of pixels vertically away from a specified widget. 
If no widget is specified for fromvert, then vertDistance is measured from the 
top of the Form. 
resizable (class Boolean) 
TRUE if children are allowed to resize themselves. Default is FALSE. 

Grip 

The Grip widget provides a small region that allows button presses and button releases. The 
Grip widget is typically used as an attachment point for visually reposidoning an object (for 
example, the pane border in a Paned widget). 

Resources 

The following Core resources may be useful with the Grip widget: 
foreground, width, height, borderWidth. 

Translations and Actions 

The Grip widget does not declare any default event translation bindings, but it does declare a 
single action routine named GripAction in its action table. The client specifies an arbi- 
Wary event translation table, giving parameters to the GripAction roudne. 

The following is an example of a GripAction translation table: 

<BtnlDown>: 
<BtnlMotion>: 
<BtnlUp>: 

GripAction (press) 
GripAct ion (move) 
GripAct ion (release) 

Athena Widget Resources 665 



numberStrings (class NumberSt rintzjs) 
Specifies the number of strings in the current list. If a value is not specified, the list 
must be NULL-terminated. This value is not typically set in resource files. 
pasteBuffer (class Boolean) 
If this i True, then the value of the sting selected will be put into X cut buffer 0. 
The default is FALSE. (Normally, the selected item is simply passed to the application. 
For example, a filename might be passed to the application's "open" routine.) 
verticalList (class Boolean) 
If this is True, the elements in the list are arranged vertically; if False, the elements 
are arranged horizontally. 

Translations and Actions 

The List widget has three predefined actions: Set, Unset, and Notify. Set and Unset 
allow switching the foreground and background colors for the current list item. Notify 
allows processing application callbacks. 

The following is the default translation table used by the List widget: 

<BtnlDown>,<BtnlUp>: Set() Notify() 

These translations should not typically be modified by users, and may be hardcoded by the 
application. 

MenuButton 

The MenuButton widget is a subclass of the Command widget that is used to pop-up a menu. 
It is an area, often rectangular, that contains a text or pixmap label. This selectable area is 
referred to as a button. When the pointer cursor is on the button, the button border is high- 
lighted to indicate that the button is ready for selection. When pointer button 1 is pressed, 
the MenuButton widget pops up the menu that has been named in the menuName resource. 

Resources 

MenuButton widgets have no new user-settable resources. 

668 X Window System User's Guide, Motif Edition 



rightCursor (class Cursor) 
Cursor used when resizing the pane to the fight of the grip. Default is 
sb_right_a rrow. 
upperCursor (class Cursor) 
Cursor used when resizing the pane above the grip. Default is sb_up_arrow. 
vertlcalBetweenCursor (class Cursor) 
Cursor to use for the grip when changing the boundary between two panes. Default is 
sb left arrow. 
vertlcalGrlpCursor (class Cursor) 
Cursor to use for the grips when they are not active. Default is 
sb v double arrow. 
Paned supports the following constraint resources. They can be specified to the Paned widget 
to indicate where a child widget should be positioned within the Paned widget. 
allowReslze (class Boolean) 
A Boolean that specifies whether to accept a child's request to resize. The default, 
FALSE, is tO ignore such requests. 
max (class max) 
Maximum height for pane. Default is to allow unlimited height. 
rain (class min) 
Minimum height for pane (in pixels). Default is 1. 
preferredPaneSize (class PreferredPaneSize) 
Preferred size of pane. This default is dependent on the application. 
resizeToPreferred (class Boolean) 
A Boolean that specifies whether to resize each pane to its preferred size when the 
Paned widget is resized. Default is False. 
showGrip (class ShowGrip) 
A Boolean that specifies whether to show a gdp for this pane. Default is T rue. 
skipAdjust (class Boolean) 
By default, this resource is FALSE, meaning that the Paned widget will resize a pane 
automatically, whenever necessary. If this resource is TRUE, the Paned widget will 
skip the adjustment of the pane. 

The Paned widget has no action routines of its own, as all actions are handled through the 
grips. The grips are each assigned a default Translation table. 

<BtnlDown>: GripAction(Start, UpLeftPane) 
<Btn2Down>: GripAction(Start, ThisBorderOnly) 
<Btn3Down>: GripActlon(Start, LowRightPane) 
<BtnlMotlon>: GrlpAction(Move, UpLeftPane) 
<Btn2Motion>: GrlpAction(Move, ThlsBorderOnly) 
<Btn3Motion>: GripActlon(Move, LowRightPane) 
Any<BtnUp>: GrlpAction(Commit) 

Athena Widget Resources 671 



orientation (class Orientation) 
Orientation of scrollbar. This value can be either XtOrientVertical (the default) 
or XtOrientHori zontal. Not usually set in resource files. 

scrollDCursor (class Cursor) 
Cursor for scrolling down. Default is XC_sb_down_a rrow. 
scrollHCursor (class Cursor) 
Idle horizontal cursor. Default is xc sb h double arrow. 
scrollLCursor (class Cursor) 
Cursor for scrolling left. Default is XC_sb_left_arrowo 
scrollRCursor (Class Cursor) 
Cursor for scrolling fight. Default is XC_sb_right_arrow. 
scrollUCursor (class Cursor) 
Cursor for scrolling up. Default is XC_sb._up_arrow. 
scrollVCursor (class Cursor) 
Idle vertical cursor. Default is xc sb v double arrow. 
shown (class Shown) 
Percentage the thumb covers. Default is 0.0o 

thickness (class Thickness) 
Specifies the width for a vertical Scrollbar and the height for a horizontal Scrollbar. 
Default is 14 (pixels). 

thumb (class Thumb) 
Thumb pixmap. Default is GrayPixmap. 

topOfThumb (class TopOfThumb) 
Position on scroll bar. Default is 0.0. 

Translations and Actions 

The actions supported by the Scrollbar widget are: 

StartScroll(value) 
The possible values are Forward, Backward, or Continuous. 
This must be the first action to begin a new movement. 

Not i fyScrol l (va I ue) 
The possible values are Proportional or FullLength. If the 
argument to StartScroll was Forward or Backward, 
NotifyScroll executes the XtNscrollProc callbacks and 
passes either the position of the pointer if its argument is Propor- 
tional or the full length of the scroll bar if its argument is Full- 
Length. If the argument to StartScroll was Continuous, 
Noti fyScroll returns without executing any callbacks. 

Athena Widget Resources 673 



required. This will happen either every time the text string is saved or whenever the 
value of the string is queried. 
displayCaret (class Output) 
A Boolean that specifies whether to display the text caret. Default is True. 
displayPosition (class TextPosition) 
Character position of first line. Default is 0. 
insertPosition (class TextPosition) 
Character position of caret. Default is 0. 
le ftMargin (class Ma rgin) 
Left margin in pixels. Default is 2. 
r i gh tMa rg in (class Ma rgi n) 
Amount of space, in pixels, between the edge of the window and the corresponding 
edge of the text within the window. Default is 2. 
scrollHorizontal 

scrollVertical 
Control the placement of scrollbars on the left and bottom edge of the text widget. 
Possible values are XawtextScrollAlways, XawtextScrollWhenNeeded, 
and XawtextScrollNever (the default). Not settable from a resource file. 
topMargin (class Ma rgin) 
Amount of space, in pixels, between the edge of the window and the corresponding 
edge of the text within the window. Default is 2. 
useStringInPlace 
If True, will disable the memory management provided by the Text widget, updating 
the string resource instead. Default is False. 

Translations and Actions 

Many standard keyboard editing facilities are supported by the event bindings. The follow- 

ing actions are supported: 
Cursor Movement 

Forward-character 
Backward-character 
Forward-word 
Backward-word 
Forward-paragraph 
Backward-paragraph 
Beginning-of-line 
End-of-line 
Next-line 
Previous-line 
Next-page 

Delete 

Delete-next-character 
Delete-previous-character 
Delete-next-word 
Delete-previous-word 
Delete-selection 

Selection 
Insert-selection 
Select-word 
Select-all 
Select-start 

680 X Window System User's Guide, Motif Edition 



beginning-of-line ( ) 
end-of-line ( ) These actions move to the beginning or end of the current line. If the 
insert point is already at the end or beginning of the line, no action is 
taken. 

next-line ( ) 
prevlous-llne ( ) 

next-page() 
previous-page() 

These actions move the insert point up or down one line. If the insert 
point is currently n characters from the beginning of the line then it will 
be n characters from the beginning of the next or previous line. If n is 
past the end of the line, the insert point is placed at the end of the line. 

These actions move the insert point up or down one page in the file. 
One page is defined as the current height of the text widget. These 
actions always place the insert point at the first character of the top line. 
beginning-of-file ( ) 
end-of-file ( ) These actions place the insert point at the beginning or end of the cur- 
rent text buffer. The text widget is then scrolled the minimum amount 
necessary to make the new insert point location visible. 
scroll-one-line-up ( ) 
scroll-one-line-down ( ) 
These actions scroll the current text field up or down by one line. They 
do not move the insert point. Other than the scrollbars, this is the only 
way that the insert point may be moved off of the visible text area. The 
widget will be scrolled so that the insert point is back on the screen as 
soon as some other action is executed. 

Delete Actions 

delete-next-character ( ) 
delete-previous-character ( ) 
These actions remove the character immediately after or before the 
insert point. If a carriage return is removed, the next line is appended to 
the end of the current line. 

delete-next-word ( ) 
delete-previous-word ( ) 
These actions remove all characters between the insert point location 
and the next word boundary. A word boundary is defined as a space, a 
tab or a carriage return. 
delete-selection ( ) 
This action removes all characters in the current selection. The selec- 
tion can be set with the selection actions. 

682 X Window System Users Guide, Motif Edition 



:Meta<Key>[: backward-paragraph() \n\ 
-Shift Meta<Key>Delete: delete-previous-word() \n\ 
Shift Meta<Key>Delete: backward-kill-word() \n\ 
-Shift Meta<Key>Backspace: delete-prevlous-word() \n\ 
Shift Meta<Key>Backspace: backward-kill-word() \n\ 

<Key>Right: 
<Key>Left: 
<Key>Down: 
<Key>Up: 
<Key>Delete: 
<Key>BackSpace: 
<Key>Linefeed: 
<Key>Return: 
<Key>: 
<FocusIn>: 
<FocusOut>: 
<BtnlDown>: 
<BtnlMotlon>: 
<BtnlUp>: 
<Btn2Down>: 
<Btn3Down>: 
<Btn3Motion>: 
<Btn3Up>: 

forward-character() \n\ 
backward-character() \n\ 
next-llne() \n\ 
previgus-llne() \n\ 
delete-prevlous-character() \n\ 
delete-prevlous-character() \n\ 
newllne-and-lndent() \n\ 
newllne() \n\ 
Insert-char() \n\ 
focus-ln() \n\ 
focus-out() \n\ 
select-start() \n\ 
extend-adjust() \n\ 
extend-end(PRIMARY, CUT BUFFER0) \n\ 
Insert-selectlon(PRIMARY, CUT BUFFER0) \n\ 
-- 
extend-start() \n\ 
extend-adjust() \n\ 
extend-end(PRIMARY, CUT BUFFER0)"; 

A user-supplied resource entry can use application-specific bindings, a subset of the supplied 
default bindings, or both. The following is an example of a user-supplied resource entry that 
uses a subset of the default bindings: 

Xmh*Text.Translations: \ 

<Key>Right: 
<Key>Left: 
Meta<Key>F: 
Meta<Key>B: 
:Meta<Key>]: 
:Meta<Key>[: 
<Key>: 

forward-character() \n\ 
backward-character() \n\ 
forward-word() \n\ 
backward-word() \n\ 
forward-paragraph() \n\ 
backward-paragraph() \n\ 
Insert-char() 

An augmented binding that is useful with the xclipboard utility is: 
*Text .Translations: #override \ 
Buttonl <Btn2Down>: extend-end (CLIPBOARD) 
The Text widget fully supports the X selection and cut buffer mechanisms. The following 
actions can be used to specify button bindings that will cause Text to assert ownership of one 
or more selections, to store the selected text into a cut buffer, and to retrieve the value of a 
selection or cut buffer and insert it into the text value. 
Insert-select lon(name[.name .... ]) 
Retrieves the value of the first (left-most) named selection that exists or 
the cut buffer that is not empty and inserts it into the input stream. The 
specified name can be that of any selection (for example, PRIMARY or 
SECONDARY) or a cut buffer (i.e., CUT_BUFFER0 through CUT_BUF- 
FER7). Note that case matters. 
select-start ( ) Unselects any previously selected text and begins selecting new text. 

Athena Widget Resources 687 



select-adjust ( ) 
extend-adjust ( ) Continues selecting text from the previous start position. 
start-extend ( ) Begins extending the selection from the farthest (left or right) edge. 
select-end(namer,name .... ]) 
extend-end(namer,name .... ]) 
Ends the text selection, asserts ownership of the specified selection(s), 
and stores the text in the specified cut buffer(s). The specified name can 
be that of a selection (for example, PRIMARY or SECONDARY) or a cut 
buffer (i.e., CUT_BUFFER0 through CUT_BUFFER7). Note that case is 
significant. If CUT_BUFFER0 is listed, the cut buffers are rotated 
before storing into buffer 0. 

Toggle 

The Toggle widget is an area, often rectangular, containing a text or pixmap label. This 
widget maintains a Boolean state (e.g. True/False or On]Off) and changes state whenever it 
is selected. When the pointer is on the button, the button border is highlighted to indicate 
that the button is ready for selection. When pointer button 1 is pressed and released, the 
Toggle widget indicates that it has changed state by reversing its foreground and background 
colors, and its notify action is invoked. If the pointer is moved out of the widget before 
the button is released, the widget reverts to its normal foreground and background colors, and 
releasing the button has no effect. This behavior allows the user to cancel an action. 
Toggle buttons may also be part of a radio group. A radio group is a list of Toggle buttons in 
which no more than one Toggle may be set at any time. A radio group is identified by the 
widget ID of any one of its members. 
The difference between a Command widget and a Toggle widget is that a Command widget 
typically invokes an application function when it is invoked. A Toggle widget simply 
changes its state (and presumably the state of some application data.) Toggles are thus useful 
for mailing configuration settings, which can then be applied by an associated Command 
widget. 

Resources 

The following new resources are associated with the Toggle widget: 

radtoGroup (class Widget) 
Specifies another Toggle widget that is in the radio group to which his Toggle widget 
should be added. A radio group is a group of Toggle widgets, only one of which may 
be set at a time. If this value is NULL (the default), then the Toggle is not part of any 
radio group and can change state without affecting any other Toggle widgets. If the 
widget specified in this resource is not already in a radio group, then a new radio group 
is created containing these two Toggle widgets. No Toggle widget can be in multiple 
radio groups. 

688 X Wtndow System User's Guide, Motif Edition 



state (class State) 
Specifies whether the Toggle widget is set (True) or unset (False). The default is 
False. 

Translations and Actions 

The following default translation bindings are used by the Toggle widget: 
<Enterwindow> : highlight (Always) 
<LeaveWlndow> : unhlghllght { ) 
<BtnlDown>,<BtnlUp>: toggle() notify() 
The actions supported by Toggle are listed below: 
hi ghl i ght(condi t i on) 
Displays the internal highlight border in the color (foreground or 
background) that contrasts with the interior color of the Toggle 
widget The conditions WhenUnset and Always are understood by 
this action procedure. If no argument is passed, WhenUnset is 
assumed. 
unhighlight () Displays the internal highlight border in the color (foreground or 
background) that matches the interior color of the Toggle widget 
set ( ) Enters the set state, in which notify is possible, and displays the inte- 
rior of the button in the foreground color. The label or pixmap is 
displayed in the background color. 
unset ( ) Cancels the set state and displays the interior of the button, including 
the highlight border, in the background color. The label or pixmap is 
displayed in the foreground color. 
toggle ( ) Changes the current state of the Toggle widget, setting the widget if it 
was previously unset, and unsetting it if it was previously set If the 
widget is to be set and is in a radio group, then this action procedure 
may unset another Toggle widget, causing all routines on its callback 
list to be invoked. The callback routines for the Toggle to be unset are 
called before those for the Toggle to be set 
reset ( ) Cancels any set or highlight action and displays the interior of 
the button in the background color, with the label displayed in the fore- 
ground color. 

Radio Groups 

Two types of radio groups are typically desired by applications. In the first type, the default 
translations for the Toggle widget implement a "zero, or one of many" radio group. This 
means that no more than one buUon can be active, but no buttons need to be active. 

Athena Widget Resources 689 



Glossary 

X uses many common terms in unique ways. A good example is "children." 
While most, if not all, of these terms are defined where they are first used in 
this manual, you will undoubtedly find it easier to refresh your memory by 
looking for them here. 



border 

client 

colorceli 

colormap 

console xterm window 

default 

depth 
device-dependent 

display 

A window can have a border that is zero or more pixels wide. If a 
window has a border, the border can have a solid color or a tile pat- 
tern, and it will be repainted automatically by the server whenever 
its color or pattern is changed or an v.xpose event occurs on the 
window. 
An X application program. There are client programs to perform a 
variety of tasks, including terminal emulation and window manage- 
ment Clients need not run on the same system as the display server 
program. 
An entry in a colormap is known as a colorceli. An entry contains 
three values specifying red, green, and blue intensities. These val- 
ues are always 16-bit unsigned numbers, with zero being minimum 
intensity. The values are truncated or scaled by the server to match 
the display hardware. See also colormap. 
A colormap consists of a set of colorcells. A pixel value indexes 
into the colormap to produce intensities of red, green, and blue to be 
displayed. Depending on hardware limitations, one or more color- 
maps may be installed at one time, such that windows associated 
with those maps display with true colors. Regardless of the number 
of installable colormaps, any number of virtual colormaps can be 
created. When needed, a virtual colormap can be installed and the 
existing installed colormap may have to be uninstalled. The color- 
map on most systems is a limited resource that should be conserved 
by allocating read-only colorcells whenever possible, and selecting 
RGB values from the predefined color database. Read-only cells 
may be shared between clients. See also RGB. 

This xterm window is the first window to appear on your display. 
Exiting the console window kills the X server program and any 
associated applications. Also called the login xterm window. 

A function-dependent value assigned when you do not specify a 
value. For example, specifying the --,e option with xterm reverses 
the foreground and background colors for the xterm window. If you 
do not specify this option, the default foreground and background 
colors are used. 

The depth of a window or pixmap is the number of bits per pixel. 
Aspects of a system that vary depending on the hardware. For 
example, the number of colors available on the screen (or whether 
color is available at all) is a device-dependent feature of X. 

A set of one or more screens driven by a single X server. The DIS- 
PLAY environment variable tells programs which servers to connect 
to, unless it is overridden by the -d-i sp].ay command line option. 
The default is always screen 0 of (display) server 0 on the local 
node. 

694 

X Window System User's Guide 



property 

reverse video 
RGB 

root window 

screen 

scrolibar 

select 

selection 

play. A pointer usually has buuons that can be pressed to send sig- 
nals that in turn accomplish certain functions. A mouse is one type 
of pointer device. 
The pointer also refers to the symbol on your display that tracks 
pointer movement on your desk. Pointers allow you to make selec- 
tions in menus, size and position windows and icons, and select the 
window where you want to focus input. A pointer can be repre- 
sented by a variety of symbols. (See text cursor.) Some typical X 
pointer symbols are the I-beam and the skull and crossbones. 
Windows have associated properties, each consisting of a name, a 
type, a data format, and some data. The X protocol places no inter- 
pretation on properties; they are intended as a general-purpose data 
storage and intercommunication mechanism for clients. There is, 
however, a list of predefined properties and property types so that 
clients can share information such as resize hints, program names, 
and icon formats with a window manager. In order to avoid passing 
arbitrary length property-name strings, each property name is asso- 
ciated with a corresponding integer value known as an atom. 
Reversing the default foreground and background colors. 
An additive method for defining color in which tenths of percent- 
ages of the primaries red, green, and blue are combined to form 
other colors. 
A shaded area (also called the background window) that covers the 
entire screen and upon which other windows are displayed. 
A server may provide several independent screens, which may or 
may not have physically independent monitors. For instance, it is 
sometimes possible to treat a color monitor as if it were two screens, 
one color and one black and white. 
A bar on the side of an xterm window that allows you to use the 
pointer to scroll up and down through the text saved in the window. 
The number of lines saved is usually greater than the number of 
lines displayed and can be controlled by the :aver,5.ne: resource 
.variable. 
A process in which you move the pointer to the desired menu item 
or window and click or hold down a pointer buuon in order to per- 
form some action. 
Selections are a means of communication between clients using pro- 
perties and events. From the user's perspective, a selection is an 
item of data that can be highlighted in one instance of an application 
and pasted into another instance of the same or a different applica- 
tion. The client that highlights the data is the owner, and the client 
into which the data is pasted is the requestor. Properties are used to 
store the selection data and the type of the data, while events are 

Glossary 697 



Index 



using pointer, 77 
resource database manager, 25, 233 
(see also xrdb.) 
resources, class names of, 236 
client-specific, 273 
component appearance, 271 
files of, 233 
instance names of, 236 
management of, 233 
setting with mwm, 271 
specific appearance, 272 
specification of, 233, 235 
syntax of, 234-235 
Restart. Root Menu, 86 
restartlng mwm, 86 
-reverse optlon (X Toolklt), 222 
reverse vldeo. 222. 289 
glossary definition, 697 
RGB. color model. 226-227 
glossary clef'tuition, 697 
values, 289 
rgb.txt file. display colors, 201,225 
Root Menu, New Window command, 86 
Refresh command. 86 
Restart command, 86 
Shuffle Down command, 86 
Shuffle Up command. 86 
root window, 288 
det-mition, 6 
glossary det-mifion, 697 
setting (xsetroot), 288 
-rv option (X Toolkit), 222 

screen, glossary det-mition, 697 
magnifying, 162 
resolution, 125-127 
saver option (xset), 286 
screen fonts. (see fonts) 
scripts. Bourne shell, 558 
C shell, 558 
startup, 557-561,570 
scrollbar, creating in xterm window, 92 
glossary det-mition, 697 
VT Options menu, 92 
scrolibar (Athena). 18 
scrollbar (Motif), 18 
scrollbar widget (Athena), 180 
scroilbar widget (Motif). 180 

ScrolledWindow widget (Motif), 180 
search path, including X in, 556 
setting, 33 
security Issues,/etc/%n.hosts file, 573 
user-based access, 574 
xdm, 574 
XDMCP, 574 
xhost, 573 
select, glossary definition, 697 
selections, copying, 94 
glossary definition, 697 
manipulating, 98 
pasting, 97 
saving multiple, 101 
text, 95 
vs. cut buffers, 98 
Send CONT signal command (Main Options 
menu), 110 
Send HUP Signal command (Main Options 
menu), 110 
Send INT Signal command (Main Options 
menu), 110 
Send KILL Signal command (Main Options 
menu), 110 
Send STOP signal command (Main Options 
menu). 110 
Send TERM Signal command (Main Options 
menu), 110 
server, closing connection, 191 
control access (xdm), 574 
control access (xhost), 573 
det-mition, 20 
display, 20 
glossary det-mition, 698 
reference page for, 326-332 
starting, 29, 557 
Server Natural Format (SNF) for fonts, 576 
set width (fonts), 127 
shell scripts, (see scripts) 
Shell widget class (Athena), 653-654 
showsnf (display compiled font). 576 
reference page for. 371 
Shuffle Down command, Root Menu, 86 
Shuffle Up command, Root Menu, 86 
SNF, (see Server Natural Format) 
-solid option (xsetroo0. 289 
spacing (fonts), 127 
starting X. 29-36 
bringing up window manager, 34 
setting search path, 556 
setting terminal type, 556 

7'06 

X Window System User's Guide, Motif Edition