About X: Frequently Asked Questions

This file contains answers to frequently asked questions about X. Here is a list of the questions that are answered:
  1. What is the client-server model?
  2. Explain the term "remote display"?
  3. How do I run a program on one machine and display it on another?
  4. Does the DISPLAY environment variable work for GL applications?
  5. The DISPLAY variable doesn't seem to work. Why?
  6. What are resources?
  7. How do I set resources?
  8. How do I know what resources I can set for an application?
  9. How do I run the same program twice with different attributes?
  10. Does the GL recognize resources now?
  11. How do I find out what fonts are available?
  12. Does Silicon Graphics provide any tools to help with the customization process?
  13. What is a good approach to take in looking for resources?
  14. What is the precedence for resource files?
  15. What files affect the window manager and what is their relationship to each other?
  16. Do I need my own .4Dwmrc file?
  17. Can I run different window managers?
  18. How do I choose a different window manager as the default?
  19. Where can I learn more about the Window Manager behavior?
  20. How do I recover from a failed customization attempt?
  21. What is the difference between .xsession and .sgisession?
  22. After copying /usr/lib/X11/xdm/Xsession to .xsession, I can't login.
  23. What are the important login and resource files for IRIX 4D1-4.0?
  24. What is the sequence of events that occur at login time?
  25. What books about the X Window System and OSF/Motif do you recommend?

1) What is the client-server model?

A client is an application or program, such as a clock or a terminal emulator. A server acts as an intermediary between the client (application) and the display. It takes information from an input device, such as a mouse, and sends it to the client. It also takes information from the client and sends it to the graphics hardware.

           ------           ------        -------
          |X     |<------- |X     |----->|Screen | 
          |client|-------> |server|      |Display|
           ------  X        ------        -------
                   Protocol

2) Explain the term "remote display"?

Typically, a client and server run on the same workstation. Clients, however, can be run from other machines via a network (including machines with different operating systems and architecture). This allows you to run a compute-intensive program on one machine and render the results on your workstation screen.

3) How do I run a program on one machine and display it on another?

The DISPLAY environment variable lets you specify the machine on which you want the X client to be displayed. You can specify the local machine in one of three ways :
a) setenv DISPLAY :0
or
b) setenv DISPLAY localhost:0
or
c) setenv DISPLAY yourhost:0 where yourhost is your machine name.
Similarly, you can specify a remote host:
setenv DISPLAY remotehost:0

4) Does the DISPLAY environment variable work for GL applications?

Yes. GL programs display on the machine specified by the DISPLAY environment variable. This occurs because the GL now uses the Distributed Graphics Library (DGL) capabilities by default. It is important to remember that only Silicon Graphics' machines can displayGL. For networks running NIS (formerly yellow pages), it is important to add the compiler flag "-lsun".

5) The DISPLAY variable doesn't seem to work. Why?

Sometimes, when trying to display to a remote server, you see these messages: "permission denied" or "can't connect to server" message. To solve permission problems, you need to disable access control on the remote server using the xhost command. This is the default behavior on Silicon Graphics' machines. If you have problems connecting to a server, check to make sure you used the correct ethernet addresses and the server is up and running. Where NIS is used, also make sure the client is linked with "-lsun".

6) What are resources?

Basically, resources are "attributes" that control the look and feel of an application. Resources include color, fonts, size, location, and more. Resources can have a complex format for binding strengths. For a complete description of resources, including a description of "loose" and "tight" bindings, consult a book listed in the bibliography for question #25.

7) How do I set resources?

There are many ways to set resources. Resources may be listed in files or contained in a data base. It is recommended that you consult a Book on X as well as the man page for "xrdb" for detailed descriptions. Generally speaking, if xrdb is not used, resource files are specified through environment variables. Question #14 addresses the precedence of these files and variables.

For some examples, see the file /usr/tutor/Customize/example.Xdefaults.

8) How do I know what resources I can set for an application?

The most common place to find resource variables for a particular application is in the man page for that application.

For example, take a look at the man page for `xwsh'. Look for the section heading called `RESOURCES'. This section lists each resource for `xwsh', and in some cases, the valid values for that resource.

Also, many major applications are built on top of the Xt toolkit. There are standard resources that these applications recognize. For a more complete description, see one of the books on Xt listed in the bibliography.

9) How do I run the same program twice with different attributes?

To accomplish this task, you need to take advantage of the "instance vs class" concept. This concept is explained further in most books on Xt.

Many applications have a resource that lets you to give it a unique name. For example, from the xwsh man page :

-name instance-name
Provide a unique name for an xwsh window. This name becomes the instance name of the specific xwsh, with the class name always being "XWsh".
Using the -name option allows you to give "names" to different instances of xwsh and assign different resources to each one. So if you want two different xwsh's with different resource sets, give them two different names, say howdymom and howdydoody, for example. Add the following to your ~/.Xdefaults file (if you use .Xdefaults) :
howdymom*foreground: SeaGreen
howdydoody*foreground: SGIBeet
Now all you have to do is start them up :
xwsh -name howdymom&
xwsh -name howdydoody&

10) Does the GL recognize resources now?

Yes. For complete information see the man page for GLRESOURCES. Here is the beginning of the man page :

GLRESOURCES(3G) Silicon Graphics GLRESOURCES(3G)

NAME
GL Resources - X resources used by GL programs

DESCRIPTION
In IRIX 4.0 and later, the GL responds to several X resources, allowing run-time control over some aspects of GL programs.

This man page assumes you are somewhat familiar with X resources, if you are not, you should read some X documentation such as Volume 3 of the O'Reilly X books.

The GL uses resources names with the prefixes
appname.gl. (instance prefix)
Appname.GL. (class prefix)
where appname and Appname are derived from the argument to the GL program's first call to winopen(3G) upper case.

11) How do I find out what fonts are available?

The xfontsel and xlsfonts utilities help you find appropriate fonts. xlsfonts lists the fonts; xfontsel provides an interface for selecting a desired font. To use xfontsel, choose "Font Names" from the Customization rollover menu in the Toolchest. Please see the man pages and the IRIS Utilities Guide for further information.

12) Does Silicon Graphics provide any tools to help with the customization process?

Yes. The Customization rollover menu in the Toolchest contains three entries: Window Info, Color Names, and Font Names. Please refer to the man pages on these commands for details: xfontsel, xlsfonts, xwininfo, xdpyinfo, xprop, appres, listres, and xrdb.

Also, see the "WorkSpace User's Guide" and the example files in /usr/tutor/Customize.

13) What is a good approach to take in looking for resources?

The following is a recommended list of steps to take when searching for a resource, binding, behavior, etc.

  1. Look in the 4.0 Transition Guide.
  2. Look in /usr/tutor/Customize.
  3. Look in /usr/demos.
  4. Look in ~4Dgifts. (Available with the development option.)
  5. If the client you are interested in is a GL client, see the man page for GLRESOURCES.
  6. Look in /usr/lib/X11/app-defaults/ClientName.
  7. Look in /usr/lib/X11/system.* .
  8. Look through the man page for the client you are interested in.
  9. Look in O'Reilly & Associates Vol. III. It has many gems pertaining to standard X clients.
  10. Look in the documentation that came with your application.
  11. Look in the OSF Motif manuals.
  12. Post to comp.windows.x if you can not find an answer using steps 1 through 11.

14) What is the precedence for resource files?

The following list indicates the weight of set resources. Items at the top have the greatest weight.

  1. Hard coded values for resources.
  2. Command line arguments.
  3. Resources pointed to by $XENVIRONMENT.
  4. Resource values loaded into the Resource Data Base via xrdb.
  5. Resources pointed to by other environment variables :

    IF $XUSERFILESEARCHPATH is set
    then it contains a list of directories to search.

    ELSE IF $XAPPLRESDIR is set
    it contains a single directory, and a short list of related directories (e.g. adjusted for language) is where resource files must be found.

    ELSE
    Look in a short list of places related to $HOME (e.g. language adjusted). This includes files in $HOME that have the name of the class of the application.
  6. Resource values set in $HOME/.Xdefaults, provided that the RESOURCE_MANAGER property hasn't been set via the xrdb command. (see the third paragraph in the xrdb man page)
  7. Values set in /usr/lib/X11/app-defaults/*.
  8. Values set through through the application's fall back mechanism.

15) What files affect the window manager and what is their relationship to each other?

  1. ~/.4Dwmrc, if you have one
  2. /usr/lib/X11/system.4Dwmrc
  3. /usr/bin/X11/4Dwm
  4. /usr/lib/X11/app-defaults/4Dwm
  5. ~/.Xdefaults (or wherever you set resources)

When 4Dwm is started, it looks for ~/.4Dwmrc. If it does not exist, it looks at /usr/lib/X11/system.4Dwmrc. The definitions for button bindings, menus, etc are contained in these files. For a better description of bindings, look in /usr/tutor/Customize/example.4Dwmrc and /usr/people/4Dgifts/.4Dwmrc. Also see the man pages for 4Dwm.

The resource set for the bindings will actually "choose" which binding definition is set.

16) Do I need my own .4Dwmrc file?

Not necessarily. As mentioned in the previous question, actual bindings are determined by resource names. If there is a binding definition in /usr/lib/X11/system.4Dwmrc that you like, you may choose it by setting the appropriate resource.

17) Can I run different window managers?

In Irix 4D1-4.0, you may choose 4Dwm, mwm, twm, or uwm. Note that GL programs are guaranteed to work only under 4Dwm.

18) How do I choose a different window manager as the default?

To use another window manager at login time, you must use a .xsession file. Please see question #21.

19) Where can I learn more about the Window Manager behavior?

The man pages for 4Dwm and mwm contain a wealth of information on the window manager. There are also online files. You may want to read /usr/tutor/Customize/example.4Dwmrc as well as /usr/people/4Dgifts/.4Dwmrc (if you have the IDO option). The OSF/Motif manuals listed in the bibliography are also good places to find information. (4Dwm is based on mwm).

20) How do I recover from a failed customization attempt?

If your attempt at customization leaves you in a state where buttons and menus are no longer recognized, you can recover by pressing the <Alt><CTRL><Shift><!> keys simultaneously. A menu appears that will let you choose Motif, Iris, or user defaults. Choose either Motif or Iris defaults and then push OK. This restarts the window manager to a usable state.

21) What is the difference between .xsession and .sgisession?

From the login event sequence mentioned earlier, you will note that /usr/lib/X11/xdm/Xsession tries to exec $HOME/.xsession if it exists. This is how you would go about changing programs started by default. An example is the start of the window manager. There is a discussion on xsession files in volume 3 of the O'Reilly series. For examples of alternate xsession files look at /usr/people/4Dgifts/.xsession or /usr/demos/.xsession.

If you don't have a $HOME/.xsession file, /usr/lib/X11/xdm/Xsession starts things for you and eventually looks for $HOME/.sgisession. This is a good way to start additional programs without changing what is started by default.

22) After copying /usr/lib/X11/xdm/Xsession to .xsession, I can't login.

After copying this file to your home directory, you need to remove all references to "xsession". References to xsession cause the system to try to execute $HOME/.xsession, which will create an infinite loop.

23) What are the important login and resource files for IRIX 4D1-4.0?

The following three file groupings indicate where files that affect your login session reside.

1) /usr/lib/X11/* - This is THE starting place. Here you find the system default bindings for Motif, 4Dwm, and the Toolchest. The xdm directory lives here as well as the app-defaults directory. xdm controls the session management. Many application defaults are set in the app-defaults directory.

2) $HOME/[.Xdefaults, .4Dwmrc, .chestrc, .xsession, .sgisession] - Here you find the files that control your system set-up. You create these files; they don't exist when you first log in.

3) /usr/bin/X11 - This is where the binaries live. It makes life nice to include this directory in your path.

24) What is the sequence of events that occur at login time?

This is a bare bones synopsis of the events that occur when you log in to the console via xdm (xdm is the default method of logging in).

  1. Provide a "failsafe" (nographics) login if required/requested.
  2. Exec $HOME/.xsession if it exists. If it exists, the remaining steps should normally be included in the users .xsession file as well.
  3. Load $HOME/.Xresources if it exists.
  4. Set XUSERFILESEARCHPATH.
  5. Incorporate a "shell" environment into the "session". (man userenv)
  6. Set the root background and cursor.
  7. Start 4Dwm.
  8. Wait for 4Dwm to come up.
  9. Disable display access control (xhost +). (man xhost)
  10. Execute $HOME/.sgisession if it exists.
  11. Start WorkSpace if the user wants it.
  12. Put a Toolchest on each screen.
  13. Start the console.
  14. Exec the "reaper". (man reaper / endsession)

25) What books about the X Window System and OSF/Motif do you recommend?

Introductory Texts on the X Window System
- O'Reilly and Associates, Inc. "The Definitive Guides to the X Window System", by Adrian Nye. Vol. 1, "Xlib Programming Manual", Sebastopol, CA., 1990.

Contains the introductory elements for programming with the Xlib, the lowest level of the X window system. Discusses concepts such as X color capacities, windows, events, drawing primitives.

O'Reilly and Associates Inc., "The Definitive Guides to the X Window System", by Valerie Quercia and Tim O'Reilly. Vol. 3, "X Window System User's Guide", Sebastopol, CA., 1988, 1989.

Discusses being an end user of the X window system. Covers topics like window manages, font specifications, standard X clients and resources.
Introductory Texts on the OSF/Motif Toolkit :
- Young, Douglas A., "X Window Systems Programming and Applications with Xt" (OSF/Motif Edition). Prentice Hall. Englewood Cliffs, NJ. 1990.

A thorough book starting with the basics of programming with a toolkit though advanced topics. Contains source code for several small complete applications. (Source code for this book is also available on line in the /usr/src directory of the Motif Development option.)

- O'Reilly and Associates Inc., "The Definitive Guides to the X Window System", by Adrian Nye and Tim O'Reilly. Vol. 4, "X Toolkit Intrinsics Programming Manual", Sebastopol, CA., 1990.

Another reference for programming with the OSF/Motif toolkit. Covers topics including basic programming, widgets, resources, and more advanced topics.
Reference Texts for the X Window System :
- O'Reilly and Associates Inc., "The Definitive Guides to the X Window System", by Adrian Nye. Vol. 2, "Xlib Reference Manual", Sebastopol, CA., 1988.

Complete reference for Xlib library routines.

- Scheifler, Robert and James Gettys, X Window System, Second Edition, Digital Press, 1990. ISBN 1-55558-050-5.

Referred to as "the Bible" of Xlib and X Protocol reference.
Reference Texts for the OSF/Motif Toolkit :
- Open Software Foundation, "OSF/Motif Programmer's Guide". Release 1.1, Prentice Hall. Englewood Cliffs, NJ. 1990.

Exhaustive reference of every widget in the OSF/Motif library.

- Asente, Paul J. and Ralph R. Swick. "X Window System Toolkit". X Version 11, Release 4. Digital Press. 1990.

Very in-depth reference to the structure and operation of an X window system toolkit.

HTML-Formatierung: Burkhard Kirste, 1993/08/26