[ba.windows.x] Frequently Asked Questions about X with Answers 3/3 long monthly posting

xug@lta.com (X User's Group) (01/01/91)

[Last changed: 31 Dec 90]

This article contains the last of three parts of a set of answers to some 
Frequently Asked Questions (FAQ) often seen in comp.windows.x. 
It is posted to help reduce volume in this newsgroup and to provide 
hard-to-find information of general interest. 

		Please redistribute this article!

----------------------------------------------------------------------
Subject: 43)  What are these I/O errors running X built with gcc?
When I try to run xinit or the Xsun server I get the error 
	"Getting interface configuration: Operation not supported on socket. 
	Fatal server bug! no screens found."

	Running the gcc fixincludes script apparently didn't work. You can do 
this simple test:

	#include <sys/ioctl.h>
	SIOCGIFCONF

Run that through cc -E and gcc -E.  The last line of output is the piece of 
interest; it should be identical (modulo irrelevant differences like 
whitespace).  If the gcc version has 'x' where the cc version has 'i', your 
fixincludes run didn't work for some reason or other.  If they are identical, 
try running a make clean in mit/server and rebuilding, just to make sure 
everything gets compiled with the proper include files. 

[courtesy der Mouse, mouse@LARRY.MCRCIM.MCGILL.EDU; 9/90]

----------------------------------------------------------------------
Subject: 44)  What are these problems compiling X11R4 on the older Sun3?
In mit/server/ddx/sun/sunCG3C.c, we have found "missing" defines for 
CG3AC_MONOLEN, CG3BC_MONOLEN, CG3AC_ENBLEN, CG3BC_ENBLEN. What should these be?

	The R4 Errata list distributed after X11R4 mentions that you can add
these lines to the file on older SunOS versions (e.g. 3.5) to compile:
        #define CG3AC_MONOLEN (128*1024)
        #define CG3AC_ENBLEN  CG3AC_MONOLEN
        #define CG3BC_MONOLEN CG3AC_MONOLEN
        #define CG3BC_ENBLEN  CG3AC_MONOLEN

	However, the Sun3 should not actually ever have the CG3 device, and so 
references to it can be removed from mit/server/ddx/sun/sunInit.c and the 
Imakefile.  [11/90]

----------------------------------------------------------------------
Subject: 45)  What are these funny problems compiling X11R3 on the Sun4?

	cc -c -O -I. -I../../include -I../../.././X11 -I../mfb   cfbbitblt.c
	cc: Fatal error in iropt: Illegal instruction (core dumped)

	Known problems with the Sun4 optimizer render the -O flag unusable
on this file. 

	In addition, there is a problem in all of the procedures that return a
parameter that was never referenced.  Instead of returning the string, the 
compiler with optimization seems to be returning the last value computed.  You 
can compile lib/Xt/TMparse.c without optimization; alternatively, you can 
replace the "return str" in various routines to use that parameter [courtesy of
Jim Fulton, MIT X Consortium]:

#ifdef sparc
/*
 * The silly optimizer in SunOS 4.0.3 and below generates bogus code that
 * causes the value of the most recently used variable to be returned instead
 * of the value passed in.
 */
static String silly_optimizer_kludge;
#define BROKEN_OPTIMIZER_HACK(val) silly_optimizer_kludge = (val)
#else
#define BROKEN_OPTIMIZER_HACK(val) val
#endif

and have routines end with
    return BROKEN_OPTIMIZER_HACK(str);

Note also that the SPARCstation1 has a bug in its use of -misalign; a fix 
to cc should be obtained from Sun.

----------------------------------------------------------------------
Subject: 46)  What are these problems using R4 shared libraries on SunOS 4?
All of the executables that I try to run have the following results:
	ld.so: libXmu.so.4: not found
or even:
	ld.so: call to undefined procedure __GetHostname from 0xf776a96c

	If you are building with shared libraries on a Sun, remember that you 
need to run "ldconfig" as root after installing the shared libraries (if you've
installed X on a file-server, run it on the server's clients, too).  While 
building and installing the distribution, you need to be careful to avoid 
linking against any existing X shared libraries you might have (e.g. those 
distributed with OpenWindows).  You should make sure you do not have 
LD_LIBRARY_PATH set in your environment during the build or the installation.  
If you are going to keep xterm and xload as setuid programs, please note that 
the shared libraries must be installed in /usr/lib, /usr/local/lib, or 
/usr/5lib for these programs to work (or else those programs must be linked 
statically). [courtesy MIT X Consortium]
	Note also that the program mkfontdir is run as part of the build; it
attempts, however, to use the shared libraries before they have been installed.
You can avoid the errors by building mkfontdir statically (pass -Bstatic to
most C compilers).

----------------------------------------------------------------------
Subject: 47)+ How do I get around the SunOS 4.1 security hole?

	There is a security problem with certain X clients running under SunOS 
4.1 that have been installed setuid root and are using shared libraries; to
avoid the problem, do one of these:
	1) make the program non-setuid. You should consult your system
administrator concerning protection of resources (e.g. ptys and /dev/kmem) used
by these programs, to make sure that you do not create additional security 
problems at your site.
	2) relink the programs statically (using -Bstatic).
	3) install the libraries before linking and link with absolute paths
to the libraries.

[from rws@EXPO.LCS.MIT.EDU (Bob Scheifler), 12/90]

----------------------------------------------------------------------
Subject: 48)  What are these problems with "_XtInherit not found" on the Sun?
When I run a X program that I wrote on a SunOS 4.0.3 or 4.1 machine I get the 
error "ld.so: symbol not found _XtInherit".

	What you are seeing is a side-effect of a kludge in the R4 libXt.a to 
get Sun shared libraries working.  Apparently, you can't share a function that 
is both called and compared, as _XtInherit is. This was handled by putting 
_XtInherit in the same file as a function that is always used, thereby 
guaranteeing that it would be loaded -- that is, in Initialize.c, where 
XtToolkitInitialize() and XtInitialize() reside. These routines would normally
be called.

	You are probably seeing this error because your program is not a normal
Xt-based program and does not call XtToolkitInitialize() anywhere. 
	1) it may be a program that uses Xt functions but never opens a 
connection to the X server.  [OSF/Motif's 1.1 UIL has this problem; it calls 
XtMalloc() and other Xt functions.] The solution is to add the call to your 
program; the function does not have to be executed, just linked in.
	2) alternatively, your program doesn't need any Xt functions and is
correct in not calling XtToolkitInitialize() -- it may be an Xlib or XView 
program. In this case, you can remove -lXt from your link command. 

	It should not be necessary to link the shared libraries statically,
although this will certainly solve the problem.
	
[from jordan@morgan.COM (Jordan Hayes) and Danny Backx (db@sunbim.be); 11/90]

----------------------------------------------------------------------
Subject: 49)  Why can't I compile my R3 Xaw contrib programs under R4?
I have a program that worked well under X11R3. When I try to link it under 
X11R4, I get this message:
	Undefined:
	_XtScrollBarSetThumb
	_XtTextSetInsertionPoint
	_XtTextReplace

	There were several name changes in the Athena widget set (in addition
to the header files moving into <X11/Xaw/>); these are mentioned in the R4
release notes. In this case, these functions are not really Xt functions but
are part of the Xaw text widget and so have been renamed from Xt* to Xaw*.
[10/90]

----------------------------------------------------------------------
Subject: 50)  TOPIC: USING X IN DAY-TO-DAY LIFE
----------------------------------------------------------------------
Subject: 51)+ How do I remap the keys on my keyboard to produce a string?

	There is no method of arranging for a particular string to be
produced when you press a particular key. The xmodmap client, which is useful 
for moving your CTRL and ESC keys to useful places, just rearranges keys and 
does not do "macro expansion."
	Some clients, including xterm and several X-based editors, accept
a translation resource such as:
	xterm*VT100.Translations: #override \
		<Key>F1: string("setenv DISPLAY unix:0")
which permits the shorthand F1 to be pressed to reset the display locally
within an xterm.  However, this doesn't work across all clients.
	Window managers, which could provide this facility, do not yet; nor
has a special "remapper" client been made available.

----------------------------------------------------------------------
Subject: 52)  How do I make a screendump of the X display?

	The xwd client in the R3 and R4 distributions can be used to select a
window or the background. It produces an XWD-format file of the image of that
window. The file can be post-processed into something useful or printed with 
the xpr client and your local printing mechanism. You can use this command:
		csh% sleep 10; xwd -root > output.xwd &
and then spend 10 seconds or so setting up your screen; the entire current
display will be saved into the file output.xwd. Note that xwd also has an 
undocumented -id flag for specifying the window id on the command-line.

	Two publicly-available programs which allow interactive definition of 
arbitrary portions of the display and built-in delays are asnap and xgrabsc.
Xgrabsc was both recently [8/90] posted to comp.sources.x; asnap is on expo.
In addition, xwd2ps, also on expo, converts an xwd-format file to PostScript
with trimmings suitable for use in presentations.
	xsnap includes some asnap features and apparently supersedes it; it
also renders XPM output. It is available on expo, as well. [11/90]

	Also: some vendors' implementations of X (e.g. DECWindows and 
OpenWindows 2.0) include session managers or other desktop programs which 
include "print portion of screen" or "take a snapshot" options.

	Also: some platforms have tools which can be used to grab the 
frame-buffer directly. The Sun systems, for example, have a 'screendump' 
program which produces a Sun raster file. PBMPLUS or other packages can be used
to massage the output into a useful format.

	Also: some vendors' implementations of lpr (e.g. Sony) include direct 
support for printing xwd files.

----------------------------------------------------------------------
Subject: 53)  Is there a way for my WM to produce my .xinitrc, a la toolplaces?

	Although no known window manager directly supports such a feature, there
is a contributed application which does much of what you are looking for,
although it is not as complete as the SunView program toolplaces. Look for the
application "xplaces" on an archive-server near you. There are several versions
of this program floating around; look for a recent vintage.
[10/90]
 
----------------------------------------------------------------------
Subject: 54)  Where can I find a dictionary server for xwebster?

	Webster's still owns the copyright to the on-line copies of Webster's
Dictionary which are found at various (university) sites. After it became aware
that these sites were then acting as servers for other sites running xwebster 
and gnuemacs-webster, it asked that server sites close off external access.
	[The NeXT machine apparently is also licensed to have the dictionary.]
	Unless you want to get a legal on-line copy yourself or can find a site
which can grant you access, you are probably out of luck. 

	However, if you are a legitimate site, you'll want to pick up the
latest xwebster, as-is on expo:contrib/xwebster.tar.Z [11/90]; the file 
xwebster.README includes discussions of the availability, illegality, and 
non-availability of dictionary servers.
	
[courtesy steve@UMIACS.UMD.EDU (Steve Miller) and mayer@hplabs.hp.com (Niels 
Mayer) 11/90]

----------------------------------------------------------------------
Subject: 55)* How do I convert Mac/TIFF/GIF/Sun/PICT/Face/img/FAX images to X?

	The likeliest program is an incarnation of Jef Poskanzer's useful++ 
Portable Bitmap Toolkit, which includes a number of programs for converting 
among various image formats. It includes support for many types of bitmaps, 
gray-scale images, and full-color images. The latest version, PBMPLUS, was 
posted to the net about 11/22/89; it is also on the R4 tape under 
contrib/clients/pbmplus and is frequently updated.
	The package has been independently updated to support XPM images for
pixmaps. There are also several patches to various modules floating around.


	Useful for viewing some image-formats is Jim Frost's xloadimage, a
version of which is in the R4 directory contrib/clients/xloadimage -- there
are later versions available -- as is ImageMagick, a set of X image display 
utilities, which can be retrieved as the file contrib/ImageMagick.tar.Z from
expo.lcs.mit.edu. An alternate image-viewer is xv (X Image Viewer), written by 
bradley@halibut.cis.upenn.edu (John Bradley) and distributed as
comp.sources.x Volume 10:79. [12/90]
	xtiff is a tool for viewing a TIFF file in an X window.  It was written
to handle as many different kinds of TIFF files as possible while remaining
simple, portable and efficient.  xtiff illustrates some common problems
with building pixmaps and using different visual classes.  It is distributed
as part of Sam Leffler's libtiff package and it is also available on
expo.lcs.mit.edu, uunet.uu.net and comp.sources.x. [dbs@decwrl.dec.com, 10/90]

----------------------------------------------------------------------
Subject: 56)  How do I use another window manager with DEC's session manager?

	DEC's session manager will start dxwm up by default. To override this, 
add to your .Xdefaults file something like this line, naming the full pathname:

	sm.windowManagerName:   /usr/bin/X11/your_favorite_wm

----------------------------------------------------------------------
Subject: 57)  How can I change the titlebar of my xterm window?

	The solution involves sending an escape sequence to xterm which will
cause it to update the property which the window manager relies upon for the
string which appears in the window titlebar.
	A solution is as easy as typing this in an xterm running a shell:
		echo "ESC]2;TEXT^G"
where ESC is the escape key, TEXT is the string you wish to have displayed,
and ^G is a Control-G (the BEL character).

	Here is a more complicated csh alias which changes the titlebar to
the current working directory when you change directories:
		alias newcd 'cd \!* ; echo ESC]2\;$cwd^G'

	The digit '2' in these strings indicates to xterm that it should 
change only the title of the window; to change both the title and the name 
used in the icon, use the digit '0' instead, and use '1' to change only the 
icon name.

	These sequences work for both R3 and R4 xterm windows; the R4 xterm,
however, does not accept the looser sequences which worked under R3 and
demands a semicolon, above, for example, where the R3 xterm allowed any
character.

----------------------------------------------------------------------
Subject: 58)+ Where can I find the xterm control sequences?

The best source of such information is the file mit/clients/xterm/ctlseq.txt,
a compilation put together by Skip Montanaro (GE CR&D). It dates from R3 but is
fairly accurate.  A hardcopy version was published in the December 1989 
XNextEvent (the XUG newsletter).

Also look for mit/clients/xterm/ctlseqs.ms, which was originally done for X10R4
and which has been updated irregularly and probably incompletely.

In addition, Volume 3 (User's Guide) of the R4 flavor of the O'Reilly 
X Window System series contains an appendix listing xterm control sequences.

Neither of these documents is installed as part of the X11R4 installation.

In a pinch, a VT100 manual will do.

----------------------------------------------------------------------
Subject: 59)  How do I keep my $DISPLAY when I rlogin to another machine?

	There are several ways to avoid having to do a "setenv DISPLAY ..."
whenever you log in to another networked UNIX machine running X.
	One solution is to use the xrlogin program from der Mouse
(mouse@larry.mcrcim.mcgill.edu). You can ftp caveat-emptor versions from
132.206.1.1, in X/xrlogin.c and X/xrlogind.c. The program packages up $TERM and
$DISPLAY into a single string, which is stuffed into $TERM.  rlogin then 
propagates $TERM normally; your .cshrc on the remote machine should contain
		eval `xrlogind`
where xrlogind is a program that checks $TERM and if it is of the special 
format it recognizes, unpacks it and spits out setenv and unsetenv commands to 
recreate the environment variables. [11/90]

	In addition, if all you need to do is start a remote X process on 
another host, and you find
		rsh <HOST> -n /usr/bin/X11/xterm -display $DISPLAY 
too simple (DISPLAY must have your real hostname), then this version of xrsh 
can be used to start up remote X processes. The equivalent usage would be 
		xrsh <HOST> xterm

  #! /bin/sh
  # start an X11 process on another host
  # Date: 8 Dec 88 06:29:34 GMT
  # From: Chris Torek <chris@mimsy.umd.edu>
  # rsh $host -n "setenv DISPLAY $DISPLAY; exec $@ </dev/null >&/dev/null"
  #
  # An improved version:
  # rXcmd (suggested by John Robinson, jr@bbn.com)
  #       (generalized for sh,ksh by Keith Boyer, keith@cis.ohio-state.edu)
  #
  # but they put the rcmd in ()'s which left zombies again.  This
  # script combines the best of both.
  
  case $# in
  [01])  echo "Usage: $0 host x-cmd [args...]";;
  *)
  	case $SHELL in
  	*csh*)  host="$1"; shift
  		xhost "$host" > /dev/null
  		rsh "$host" -n \
  			"setenv TERM xterm; setenv DISPLAY `hostname`:0; \
  			exec $* </dev/null >& /dev/null" &
  		;;
  	*sh)
  		host="$1"; shift
  		xhost "$host" > /dev/null
  		rsh "$host" -n \
  			"TERM=xterm export TERM; \
  			DISPLAY=`hostname`:0 export DISPLAY; \
  			LD_LIBRARY_PATH=/usr/X11/lib export LD_LIBRARY_PATH; \
  			PATH=\$PATH:/usr/X11/bin:/usr/bin/X11:/usr/local/bin; \			export PATH; \
  			exec $* < /dev/null > /dev/null 2>&1" &
  		;;
  	esac
  	;;
  esac

----------------------------------------------------------------------
Subject: 60)* How can I design my own font?

	One way is to use the "bitmap" client or some other bitmap-editor (e.g.
Sun's icon-editor tool, post-processed with pbmplus) to design the individual 
characters and then to do some large amount of post-processing to concatenate 
them into the BDF format.
	The R3 contrib/ area (in fonts/utils/ and in clients/xtroff) contained 
a number of useful utilities, including some to convert between BDF font format
and a simple character format which can be edited with any text editor.
	An easier way is to use the "xfed" client to modify an existing font; a
recent version is on the R4 tape in contrib/clients/xfed. Xfed is available for
anonymous ftp on unido.informatik.uni-dortmund.de (129.217.64.60) as file 
/pub/windows/X/Diverse-X11-Sourcen/xfed.tar.Z.

----------------------------------------------------------------------
Subject: 61)  Why does adding a font to the server not work?

	After you have built the font using your system's font-compiler, 
installed it in some directory, and run `mkfontdir` or your system's equivalent
in that directory, be sure to use `xset +fp $dir` to add that directory to the 
server's font-path, if it is not already present, and then use `xset fp rehash`
so that the new fonts in that directory are actually found; it is this last 
step that you're probably leaving out.

----------------------------------------------------------------------
Subject: 62)+ How do I use DECwindows fonts on my X11R4 server?

	The DECwindows server stores fonts in a ".pcf" format which is not
recognized by the X11R4 server. Jordan Hayes (jordan@morgan.com) has
constructed a "font extractor" that you can use to get the .pcf files from
the DEC server and write the information to a .bdf file, which you can
then recompile to .snf fonts using the font-compiler from the MIT distribution.

----------------------------------------------------------------------
Subject: 63)* Why can't I set the backgroundPixmap resource in my defaults file?
I want to be able to do something like this:
	xclock*backgroundPixmap:      /usr/include/X11/bitmaps/rootweave

	You can't do this. The backgroundPixmap resource is a pixmap of the 
same depth as the screen, not a bitmap (which is a pixmap of depth 1). Because 
of this, writing a generic String to Pixmap converter is impossible, since 
there is no accepted convention for a file format for pixmaps. Therefore, 
neither the X Toolkit or the Athena widget set define a String to Pixmap 
converter, because there is no converter you cannot specify this value as a 
resource.

	The Athena widget set does define a String to Bitmap converter for use 
in many of its widgets, however.

[courtesy Chris D. Peterson (kit@expo.lcs.mit.edu), 4/90]

	[Note: the leading general-purpose format for pixmaps is the XPM format
used by Groupe Bull in several of its programs, including the GWM window 
manager, by AT&T in its olpixmap editor, and by ICS in its interface builder. 
XPM is being now handled by Richard Hess (rhess@cimshop.uu.net). The
XPM distribution, available on expo as contrib/xpm.tar.Z, includes read/write
routines which can easily be adapted to converters by new widgets which want
to allow specification of pixmap resources in the above manner. A new version 
of this software, XPM2, has both C-includable and Lisp-includable formats.]

----------------------------------------------------------------------
Subject: 64)  Why does the R3 xterm, et al, fail against the R4 server?

	The value given to a window's do_not_propagate mask is the likely 
culprit.  R3 allowed bogus values to be set, and early version of both Andrew 
and Interviews did, as well. Similar problems also occur in the R3 Motif
PanedWindow widget.

	If it is impossible to fix client source, use 'xset bc' to put the 
X11R4 server into bug-compatibility mode.

----------------------------------------------------------------------
Subject: 65)  Why doesn't xlock work on my R4 server?

	The version of xlock that went out on the R4 contrib tapes was not
quite R4-conformant; when built and run, it will produce an X_GrabPointer
protocol error. This can be fixed by making the R4 server run in bug-
compatibility mode; just say `xset bc`. 
	xlock has been fixed since; in addition, a major revision just came
out (to comp.sources.x) and can be used instead.  [10/90]

----------------------------------------------------------------------
Subject: 66)  Why am I suddenly unable to connect to my Sun X server?
After a seemingly random amount of time after the X server has been started, no
other clients are able to connect to it.

	The default cron cleanup jobs supplied by Sun (for 4.0.3, at least)
delete "old" (unreferenced) files from /tmp -- including /tmp/.X11-unix, which 
contains the socket descriptor used by X. The solution is to add "! -type s" to
the find exclusion in the cron job.
[10/90]

----------------------------------------------------------------------
Subject: 67)  TOPIC: PROGRAMMING PROBLEMS AND PUZZLES
----------------------------------------------------------------------
Subject: 68)  Why doesn't my program get the keystrokes I select for?

	The window manager controls how the input focus is transferred from one
window to another.  In order to get keystrokes, your program must ask the
window manager for the input focus.  To do this, you must set up what are
called "hints" for the window manager.  If your applications is Xlib-based, you
can use something like the following:

        XWMHints wmhints;
        ...
        wmhints.flags = InputHint;
        wmhints.input = True;
        XSetWMHints(dpy, window, &hints)


If your application is based on the Xt Intrinsics, you can set the XtNinput 
resource to be True (as you probably want to in any case); if you don't have
source, you can start up the application with the resource '*input:True'.

Certain window managers, notably dxwm and olwm, are very picky about having 
this done. 

	If you are using Sun's OpenWindows olwm, you can also add this resource
to your defaults file to use clients that aren't ICCCM-compliant.
	OpenWindows.FocusLenience:       true

[mostly courtesy Dave Lemke of NCD and Stuart Marks of Sun]

----------------------------------------------------------------------
Subject: 69)  Is there a skeleton X program available?
	
	There is no general framework such as the TransSkel program for the 
Macintosh which handles lots of the odds and ends and overhead of development 
under a window system and which can be used as a platform for additional 
development. In X, the problem is typically solved by using an interactive 
application builder tool or by using cut&paste on existing X applications. Good
applications which you might look to manipulate when you want to "test just 
this one little thing" include contrib/clients/xskel, a simple R4 program that 
puts up a window and allows sketching in it and offers a starting point for
quick hacks, the Xaw examples in the examples/ directory in the R3 and R4 
distributions, and the Xlib "Hello World" example in the R3 doc/HelloWorld and 
R4 doc/tutorials/HelloWorld; an updated version of this program which uses R4 
Xlib calls and current ICCCM conventions was posted in 2/90 to comp.windows.x  
by Glenn Widener of Tektronix. 	[3/90]

----------------------------------------------------------------------
Subject: 70)  Why does XtGetValues not work for me?

	The XtGetValues interface for retrieving resources from a widget is
sensitive to the type of variable. Your code may be doing something like this:
	{
	Arg args[3];
	int i;
	int sensitive;		/* oops */
	i=0;
	XtSetArg (args[i], XtNsensitive, &sensitive); i++;
	XtGetValues(widget, args, i );
	...
	}

But XtNsensitive is a Boolean, which on most machines is a single byte; 
declaring the variable "sensitive" as Boolean works properly. This problem 
comes up often when using particular toolkits that redefine the Xt types 
Dimension and Position; code that assumes they are int will have similar 
problems if those types are actually short. In general: you are safe if you
use the actual type of the resource, as it appears in the widget's man page.

[11/90]

----------------------------------------------------------------------
Subject: 71)  How do I make a "busy cursor" while my application is computing?
Is it necessary to call XDefineCursor for every window in my application?

	The easiest thing to do is to create a single InputOnly window that is 
as large as the screen; make it a child of your toplevel window and it will be 
clipped to that window, so it won't affect any other application. (It needs to 
be as big as the screen in case the user enlarges the window while it is busy.)
Substitute "toplevel" with your top-most widget here (similar code should work 
for Xlib-only applications; just use your top Window):

     unsigned long valuemask;
     XSetWindowAttributes attributes;

     /* Ignore device events while the busy cursor is displayed. */
     valuemask = CWDontPropagate | CWCursor;
     attributes.do_not_propagate_mask =  (KeyPressMask | KeyReleaseMask |
         ButtonPressMask | ButtonReleaseMask | PointerMotionMask);
     attributes.cursor = XCreateFontCursor(XtDisplay(toplevel), XC_watch);

     /* The window will be as big as the display screen, and clipped by
        its own parent window, so we never have to worry about resizing */
     XCreateWindow(XtDisplay(toplevel), XtWindow(toplevel), 0, 0,
         WidthOfScreen(XtScreen(toplevel)), HeightOfScreen(XtScreen(toplevel)),
         (unsigned int) 0, CopyFromParent, InputOnly,
         CopyFromParent, valuemask, &attributes);

When you want to use this busy cursor, map and raise this window; to go back to
normal, unmap it. This will automatically keep you from getting extra mouse
events; depending on precisely how the window manager works, it may or may not
have a similar effect on keystrokes as well.

In addition, note also that most of the Xaw widgets support an XtNcursor 
resource which can be temporarily reset, should you merely wish to change the
cursor without blocking pointer events.

[thanks to Andrew Wason (aw@cellar.bae.bellcore.com), Dan Heller (argv@sun.com),
and mouse@LARRY.MCRCIM.MCGILL.EDU] [11/90]

----------------------------------------------------------------------
Subject: 72)  Why does XtAppAddInput not work as described?
I am using XtAppAddInput to read from a file, but the function is called even
when there isn't input pending.

	XtAppAddInput is actually working as it is supposed to. When used on
files, it is called whenever the file is READY to be read, not when there is
new data to be read. The file is almost always ready to be read, however, if 
only because you can spin back to the beginning and read data you've read 
before. The result is that your function will almost always be called every
time around XtMainLoop().
	To get the type of interaction you are expecting, add this line to
the beginning of your function to test whether there is new data:
	     if (ioctl(fd, FIONREAD, &n) == -1 || n == 0) return;

[courtesy Dan Heller (argv@ora.com); 8/90]

----------------------------------------------------------------------
Subject: 73)  How do I simulate a button press/release event for a widget?

	You can do this using XSendEvent(); it's likely that you're not setting
the window field in the event, which Xt needs in order to match to the widget
which should receive the event.
	 If you're sending events to your own application, then you can use 
XtDispatchEvent() instead. This is more efficient than XSendEvent() in that you
avoid a round-trip to the server.

[courtesy Mark A. Horstman (mh2620@sarek.sbc.com), 11/90]

----------------------------------------------------------------------
Subject: 74)  Why doesn't anything appear when I run this simple program?

> ...
> the_window = XCreateSimpleWindow(the_display,
>      root_window,size_hints.x,size_hints.y,
>      size_hints.width,size_hints.height,BORDER_WIDTH,
>      BlackPixel(the_display,the_screen),
>      WhitePixel(the_display,the_screen));
> ...
> XSelectInput(the_display,the_window,ExposureMask|ButtonPressMask|
> 	ButtonReleaseMask);
> XMapWindow(the_display,the_window);
> ...
> XDrawLine(the_display,the_window,the_GC,5,5,100,100);
> ...

	You are right to map the window before drawing into it. However, the 
window is not ready to be drawn into until it actually appears on the screen --
until your application receives an Expose event. Drawing done before that will 
generally not appear. You'll see code like this in many programs; this code 
would appear after window was created and mapped:
  while (!done)
    {
      XNextEvent(the_display,&the_event);
      switch (the_event.type) {
	case Expose:	 /* On expose events, redraw */
		XDrawLine(the_display,the_window,the_GC,5,5,100,100);
		break;
	...
	}
    }

	Note that there is a second problem: some X servers don't set up the 
default graphics context to have reasonable foreground/background colors, and 
your program should not assume that the server does, so this program could 
previously include this code to prevent the case of having the foreground and 
background colors the same:
  ...
  the_GC_values.foreground=BlackPixel(the_display,the_screen);	/* e.g. */
  the_GC_values.background=WhitePixel(the_display,the_screen);	/* e.g. */
  the_GC = XCreateGC(the_display,the_window,
                GCForeground|GCBackground,&the_GC_values);
  ...
 
Note: the code uses BlackPixel and WhitePixel to avoid assuming that 1 is 
black and 0 is white or vice-versa.  The relationship between pixels 0 and 1 
and the colors black and white is implementation-dependent.  They may be 
reversed, or they may not even correspond to black and white at all.

----------------------------------------------------------------------
Subject: 75)  What is the difference between a Screen and a screen?

	The 'Screen' is an Xlib structure which includes the information about
one of the monitors or virtual monitors which a single X display supports. A 
server can support several independent screens. They are numbered unix:0.0,
unix:0.1, unix:0.2, etc; the 'screen' or 'screen_number' is the second digit --
the 0, 1, 2 which can be thought of as an index into the array of available 
Screens on this particular Display connection.
	The macros which you can use to obtain information about the particular
Screen on which your application is running typically have two forms -- one
which takes a Screen and one with takes both the Display and the screen_number.
	In Xt-based programs, you typically use XtScreen(widget) to determine 
the Screen on which your application is running, if it uses a single screen.
	(Part of the confusion may arise from the fact that some of the macros
which return characteristics of the Screen have "Display" in the names -- 
XDisplayWidth, XDisplayHeight, etc.)
	
----------------------------------------------------------------------
Subject: 76)  How do I determine the name of an existing widget?
I have a widget ID and need to know what the name of that widget is.

	R4 users are best off using the XtName() function, which will work
on both widgets and non-widget objects.

	If you are still using R3, you can use this simple bit of code to do 
what you want. Note that it depends on the widget's internal data structures 
and is not portable to future versions of Xt, including R4.

	#include <X11/CoreP.h>
	String XtName (widget)
	Widget widget;	/* will not work with non-widget objects */
	{
	return widget->core.name;
	}

[7/90]

----------------------------------------------------------------------
Subject: 77)  Why do I get a BadDrawable error drawing to XtWindow(widget)?
I'm doing this in order to get a window into which I can do Xlib graphics
within my Xt-based program:

> canvas = XtCreateManagedWidget ( ...,widgetClass,...) /* drawing area */
> ...
> window = XtWindow(canvas);	/* get the window associated with the widget */
> ...
> XDrawLine (...,window,...);	/* produces error */

	The window associated with the widget is created as a part of the 
realization of the widget.  Using a window id of NULL ("no window") could 
create the error that you describe.  It is necessary to call XtRealizeWidget() 
before attempting to use the window associated with a widget. 
	Note that the window will be created after the XtRealizeWidget() call, 
but that the server may not have actually mapped it yet, so you should also 
wait for an Expose event on the window before drawing into it.

----------------------------------------------------------------------
Subject: 78)  Can XGetWindowAttributes get a window's background pixel/pixmap?

	No.  Once set, the background pixel or pixmap of a window cannot be 
re-read by clients.  The reason for this is that a client can create a pixmap,
set it to be the background pixmap of a window, and then free the pixmap. The 
window keeps this background, but the pixmap itself is destroyed.  If you're 
sure a window has a background pixel (not a pixmap), you can use XClearArea() 
to clear a region to the background color and then use XGetImage() to read 
back that pixel.  However, this action alters the contents of the window, and 
it suffers from race conditions with exposures. [courtesy Dave Lemke of NCD 
and Stuart Marks of Sun]

	Note that the same applies to the border pixel/pixmap. This is a 
(mis)feature of the protocol which allows the server is free to manipulate the
pixel/pixmap however it wants.  By not requiring the server to keep the 
original pixel or pixmap, some (potentially a lot of) space can be saved. 
[courtesy Jim Fulton, MIT X Consortium]

----------------------------------------------------------------------
Subject: 79)  Why does the pixmap I copy to the screen show up as garbage? 

	The initial contents of pixmaps are undefined.  This means that most
servers will allocate the memory and leave around whatever happens to be there 
-- which is usually garbage.  You probably want to clear the pixmap first using
XFillRectangle() with a function of GXcopy and a foreground pixel of whatever 
color you want as your background (or 0L if you are using the pixmap as a 
mask). [courtesy Dave Lemke of NCD and Stuart Marks of Sun]

----------------------------------------------------------------------
Subject: 80)  How can my application iconify itself?

	The ICCCM provides a mechanism for this; your application sends a
client message which includes a data value indicating that it wishes to be
iconified.  Here is a sample callback that will iconify the application shell, 
wait 3 seconds, and pop it back up. Note that ApplicationShellWidget below
is global; it would make more sense in real use to walk up the tree via 
XtParent() to find the shell containing the active widget.

   void IconifyShell(w, d1, d2)
        Widget w;
        caddr_t d1, d2;
   {
     XClientMessageEvent event;
     Window win;
     Display *dpy;

     event.type = ClientMessage;
     event.send_event = True;
     dpy = event.display = XtDisplay(w);
     win = event.window = XtWindow(ApplicationShellWidget);
     event.message_type = XInternAtom(dpy, "WM_CHANGE_STATE", False);
     event.format = 32;
     event.data.l[0] = IconicState;
     XSendEvent(dpy, DefaultRootWindow(dpy), False,
                SubstructureRedirectMask | SubstructureNotifyMask, &event);
     XFlush(dpy);
     sleep(3);
     XMapWindow(dpy,win);
   }

[courtesy David Brooks (dbrooks@osf.osf.org), 4/90]

R4 users may find it easier to use this routine:

    /*
     * This function instructs the window manager to change this window from
     * NormalState to IconicState.
     */
    Status XIconifyWindow (dpy, w, screen)
        Display *dpy;
        Window w;
        int screen;

[courtesy Jim Fulton, MIT X Consortium, 6/90]

----------------------------------------------------------------------
Subject: 81)  How do I check whether a window ID is valid?
My program has the ID of a window on a remote display. I want to check whether
the window exists before doing anything with it.

	Because X is asynchronous, there isn't a guarantee that the window would
still exist between the time that you got the ID and the time you sent an event
to the window or otherwise manipulated it. What you should do is send the event
without checking, but install an error handler to catch any BadWindow errors, 
which would indicate that the window no longer exists. This scheme will work 
except on the [rare] occasion that the original window has been destroyed and 
its ID reallocated to another window.

[courtesy Ken Lee (klee@wsl.dec.com), 4/90]

----------------------------------------------------------------------
Subject: 82)  Can I have two applications draw to the same window?

	Yes. The X server assigns IDs to windows and other resources, and any
application that knows the ID can manipulate the resource.
	The problem you face is how to disseminate the window ID to multiple 
applications. A simple way to handle this (and which solves the problem of the
applications' running on different machines) is in the first application to 
create a specially-named property on the root-window and put the window ID into 
it. The second application then retrieves the property, whose name it also
knows, and then can draw whatever it wants into the window.
	[Note: this scheme works iff there is only one instance of the first
application running, and the scheme is subject to the limitations mentioned
in the Question about using window IDs on remote displays.]
	Note also that you will still need to coordinate any higher-level 
cooperation among your applications. 
	Note also that two processes can share a window but should not try to 
use the same server connection. If one process is a child of the other, it 
should close down the connection to the server and open its own connection.

[mostly courtesy Phil Karlton (karlton@wpd.sgi.com) 6/90]

----------------------------------------------------------------------
Subject: 83)* How do I render rotated text?
	
	Xlib intentionally does not provide such sophisticated graphics 
capabilities, leaving them up to server-extensions or clients-side graphics
libraries.
	Your only choice, if you want to stay within the core X protocol, is to
render the text into a pixmap, read it back via XGetImage(), rotate it "by hand"
with whatever matrices you want, and put it back to the server via XPutImage();
more specifically:
	1) create a bitmap B and write your text to it.
	2) create an XYBitmap image I from B (via XGetImage).
	3) create an XYBitmap Image I2 big enough to handle the transformation.
	4) for each x,y in I2, I2(x,y) = I(a,b) where 
		a = x * cos(theta) - y * sin(theta)
		b = x * sin(theta) + y * cos(theta)
	5) render I2
	Note that you should be careful how you implement this not to lose
bits; an algorithm based on shear transformations may in fact be better.
	The high-level server-extensions and graphics packages available for X 
also permit rendering of rotated text: Display PostScript, PEX, PHIGS, and GKS,
although most are not capable of arbitrary rotation and probably do not use the
same fonts that would be found on a printer.
	In addition, if you have enough access to the server to install a font
on it, you can create a font which consists of letters rotated at some
predefined angle. Your application can then itself figure out placement of each
glyph.

[courtesy der Mouse (mouse@larry.mcrcim.mcgill.edu), Eric Taylor 
(etaylor@wilkins.bmc.tmc.edu), and Ken Lee (klee@wsl.dec.com), 11/90;
Liam Quin (lee@sq.com), 12/90]


--------------------------------------------------

Local Variables:
mode: outline
outline-regexp: "Subject:[ ]+[0-9]+)"
eval: (hide-body)
End:
-- 

The X User's Group		xug@expo.lcs.mit.edu	+1 617 547 0634
"No, I'm a member of the X User's Group, not the Ex-User's Group."

xug@lta.com (X User's Group) (01/31/91)

[Last changed: 30 Jan 91]

This article contains the last of three parts of a set of answers to some 
Frequently Asked Questions (FAQ) often seen in comp.windows.x. 
It is posted to help reduce volume in this newsgroup and to provide 
hard-to-find information of general interest. 

		Please redistribute this article!


----------------------------------------------------------------------
Subject: 48)  What are these problems compiling X11R4 on the older Sun3?
In mit/server/ddx/sun/sunCG3C.c, we have found "missing" defines for 
CG3AC_MONOLEN, CG3BC_MONOLEN, CG3AC_ENBLEN, CG3BC_ENBLEN. What should these be?

	The R4 Errata list distributed after X11R4 mentions that you can add
these lines to the file on older SunOS versions (e.g. 3.5) to compile:
        #define CG3AC_MONOLEN (128*1024)
        #define CG3AC_ENBLEN  CG3AC_MONOLEN
        #define CG3BC_MONOLEN CG3AC_MONOLEN
        #define CG3BC_ENBLEN  CG3AC_MONOLEN

	However, the Sun3 should not actually ever have the CG3 device, and so 
references to it can be removed from mit/server/ddx/sun/sunInit.c and the 
Imakefile.  [11/90]

----------------------------------------------------------------------
Subject: 49)  What are these funny problems compiling X11R3 on the Sun4?

	cc -c -O -I. -I../../include -I../../.././X11 -I../mfb   cfbbitblt.c
	cc: Fatal error in iropt: Illegal instruction (core dumped)

	Known problems with the Sun4 optimizer render the -O flag unusable
on this file. 

	In addition, there is a problem in all of the procedures that return a
parameter that was never referenced.  Instead of returning the string, the 
compiler with optimization seems to be returning the last value computed.  You 
can compile lib/Xt/TMparse.c without optimization; alternatively, you can 
replace the "return str" in various routines to use that parameter [courtesy of
Jim Fulton, MIT X Consortium]:

#ifdef sparc
/*
 * The silly optimizer in SunOS 4.0.3 and below generates bogus code that
 * causes the value of the most recently used variable to be returned instead
 * of the value passed in.
 */
static String silly_optimizer_kludge;
#define BROKEN_OPTIMIZER_HACK(val) silly_optimizer_kludge = (val)
#else
#define BROKEN_OPTIMIZER_HACK(val) val
#endif

and have routines end with
    return BROKEN_OPTIMIZER_HACK(str);

Note also that the SPARCstation1 has a bug in its use of -misalign; a fix 
to cc should be obtained from Sun.

----------------------------------------------------------------------
Subject: 50)  What are these problems using R4 shared libraries on SunOS 4?
All of the executables that I try to run have the following results:
	ld.so: libXmu.so.4: not found
or even:
	ld.so: call to undefined procedure __GetHostname from 0xf776a96c

	If you are building with shared libraries on a Sun, remember that you 
need to run "ldconfig" as root after installing the shared libraries (if you've
installed X on a file-server, run it on the server's clients, too).  While 
building and installing the distribution, you need to be careful to avoid 
linking against any existing X shared libraries you might have (e.g. those 
distributed with OpenWindows).  You should make sure you do not have 
LD_LIBRARY_PATH set in your environment during the build or the installation.  
If you are going to keep xterm and xload as setuid programs, please note that 
the shared libraries must be installed in /usr/lib, /usr/local/lib, or 
/usr/5lib for these programs to work (or else those programs must be linked 
statically). [courtesy MIT X Consortium]
	Note also that the program mkfontdir is run as part of the build; it
attempts, however, to use the shared libraries before they have been installed.
You can avoid the errors by building mkfontdir statically (pass -Bstatic to
most C compilers).

----------------------------------------------------------------------
Subject: 51)  How do I get around the SunOS 4.1 security hole?

	There is a security problem with certain X clients running under SunOS 
4.1 that have been installed setuid root and are using shared libraries; to
avoid the problem, do one of these:
	1) make the program non-setuid. You should consult your system
administrator concerning protection of resources (e.g. ptys and /dev/kmem) used
by these programs, to make sure that you do not create additional security 
problems at your site.
	2) relink the programs statically (using -Bstatic).
	3) install the libraries before linking and link with absolute paths
to the libraries.

[from rws@EXPO.LCS.MIT.EDU (Bob Scheifler), 12/90]

----------------------------------------------------------------------
Subject: 52)  What are these problems with "_XtInherit not found" on the Sun?
When I run a X program that I wrote on a SunOS 4.0.3 or 4.1 machine I get the 
error "ld.so: symbol not found _XtInherit".

	What you are seeing is a side-effect of a kludge in the R4 libXt.a to 
get Sun shared libraries working.  Apparently, you can't share a function that 
is both called and compared, as _XtInherit is. This was handled by putting 
_XtInherit in the same file as a function that is always used, thereby 
guaranteeing that it would be loaded -- that is, in Initialize.c, where 
XtToolkitInitialize() and XtInitialize() reside. These routines would normally
be called.

	You are probably seeing this error because your program is not a normal
Xt-based program and does not call XtToolkitInitialize() anywhere. 
	1) it may be a program that uses Xt functions but never opens a 
connection to the X server.  [OSF/Motif's 1.1 UIL has this problem; it calls 
XtMalloc() and other Xt functions.] The solution is to add the call to your 
program; the function does not have to be executed, just linked in.
	2) alternatively, your program doesn't need any Xt functions and is
correct in not calling XtToolkitInitialize() -- it may be an Xlib or XView 
program. In this case, you can remove -lXt from your link command. 

	It should not be necessary to link the shared libraries statically,
although this will certainly solve the problem.
	
[from jordan@morgan.COM (Jordan Hayes) and Danny Backx (db@sunbim.be); 11/90]

----------------------------------------------------------------------
Subject: 53)  Why can't I compile my R3 Xaw contrib programs under R4?
I have a program that worked well under X11R3. When I try to link it under 
X11R4, I get this message:
	Undefined:
	_XtScrollBarSetThumb
	_XtTextSetInsertionPoint
	_XtTextReplace

	There were several name changes in the Athena widget set (in addition
to the header files moving into <X11/Xaw/>); these are mentioned in the R4
release notes. In this case, these functions are not really Xt functions but
are part of the Xaw text widget and so have been renamed from Xt* to Xaw*.
[10/90]

----------------------------------------------------------------------
Subject: 54)  TOPIC: USING X IN DAY-TO-DAY LIFE
----------------------------------------------------------------------
Subject: 55)+ Why does my X session exit when I kill my window manager?

	What is probably happening is that you are running your window manager
as the last job in your .xsession or .xinitrc file; your X session runs only as
long as the last job is running, and so killing your window manager is 
equivalent to logging out. Instead, run the window manager in the background,
and as the last job instead invoke something safe like:
		exec xterm -name Login -rv -iconic
Your X session will continue until you explicitly logout of this window.

----------------------------------------------------------------------
Subject: 56)  How do I remap the keys on my keyboard to produce a string?

	There is no method of arranging for a particular string to be
produced when you press a particular key. The xmodmap client, which is useful 
for moving your CTRL and ESC keys to useful places, just rearranges keys and 
does not do "macro expansion."
	Some clients, including xterm and several X-based editors, accept
a translation resource such as:
	xterm*VT100.Translations: #override \
		<Key>F1: string("setenv DISPLAY unix:0")
which permits the shorthand F1 to be pressed to reset the display locally
within an xterm.  However, this doesn't work across all clients.
	Window managers, which could provide this facility, do not yet; nor
has a special "remapper" client been made available.

----------------------------------------------------------------------
Subject: 57)* How do I make a screendump of the X display?

	The xwd client in the R3 and R4 distributions can be used to select a
window or the background. It produces an XWD-format file of the image of that
window. The file can be post-processed into something useful or printed with 
the xpr client and your local printing mechanism. You can use this command:
		csh% sleep 10; xwd -root > output.xwd &
and then spend 10 seconds or so setting up your screen; the entire current
display will be saved into the file output.xwd. Note that xwd also has an 
undocumented -id flag for specifying the window id on the command-line.

	Two publicly-available programs which allow interactive definition of 
arbitrary portions of the display and built-in delays are asnap and xgrabsc.
Xgrabsc was both recently [8/90] posted to comp.sources.x.
	xsnap includes some asnap features and supersedes it; it also renders 
XPM output. It is available on expo, as well. [11/90]

	Also: some vendors' implementations of X (e.g. DECWindows and 
OpenWindows 2.0) include session managers or other desktop programs which 
include "print portion of screen" or "take a snapshot" options.

	Also: some platforms have tools which can be used to grab the 
frame-buffer directly. The Sun systems, for example, have a 'screendump' 
program which produces a Sun raster file. PBMPLUS or other packages can be used
to massage the output into a useful format.

	Also: some vendors' implementations of lpr (e.g. Sony) include direct 
support for printing xwd files.

	To post-process the output of some of these tools, you can use xpr,
which is part of the R4 distribution. Also on several archives are xwd2ps
and XtoPS, which produce Encapsulated PostScript with trimmings suitable for 
use in presentations.
	If you need color PostScript in particular, you can use xgrabsc to begin
with or you can use the PBMPLUS package to post-process xwd into color PS.

----------------------------------------------------------------------
Subject: 58)  Is there a way for my WM to produce my .xinitrc, a la toolplaces?

	Although no known window manager directly supports such a feature, there
is a contributed application which does much of what you are looking for,
although it is not as complete as the SunView program toolplaces. Look for the
application "xplaces" on an archive-server near you. There are several versions
of this program floating around; look for a recent vintage.
[10/90]
 
----------------------------------------------------------------------
Subject: 59)  Where can I find a dictionary server for xwebster?

	Webster's still owns the copyright to the on-line copies of Webster's
Dictionary which are found at various (university) sites. After it became aware
that these sites were then acting as servers for other sites running xwebster 
and gnuemacs-webster, it asked that server sites close off external access.
	[The NeXT machine apparently is also licensed to have the dictionary.]
	Unless you want to get a legal on-line copy yourself or can find a site
which can grant you access, you are probably out of luck. 

	However, if you are a legitimate site, you'll want to pick up the
latest xwebster, as-is on expo:contrib/xwebster.tar.Z [11/90]; the file 
xwebster.README includes discussions of the availability, illegality, and 
non-availability of dictionary servers.
	
[courtesy steve@UMIACS.UMD.EDU (Steve Miller) and mayer@hplabs.hp.com (Niels 
Mayer) 11/90]

----------------------------------------------------------------------
Subject: 60)  How do I convert Mac/TIFF/GIF/Sun/PICT/Face/img/FAX images to X?

	The likeliest program is an incarnation of Jef Poskanzer's useful++ 
Portable Bitmap Toolkit, which includes a number of programs for converting 
among various image formats. It includes support for many types of bitmaps, 
gray-scale images, and full-color images. The latest version, PBMPLUS, was 
posted to the net about 11/22/89; it is also on the R4 tape under 
contrib/clients/pbmplus and is frequently updated.
	The package has been independently updated to support XPM images for
pixmaps. There are also several patches to various modules floating around.


	Useful for viewing some image-formats is Jim Frost's xloadimage, a
version of which is in the R4 directory contrib/clients/xloadimage -- there
are later versions available -- as is ImageMagick, a set of X image display 
utilities, which can be retrieved as the file contrib/ImageMagick.tar.Z from
expo.lcs.mit.edu. An alternate image-viewer is xv (X Image Viewer), written by 
bradley@halibut.cis.upenn.edu (John Bradley) and distributed as
comp.sources.x Volume 10:79. [12/90]
	xtiff is a tool for viewing a TIFF file in an X window.  It was written
to handle as many different kinds of TIFF files as possible while remaining
simple, portable and efficient.  xtiff illustrates some common problems
with building pixmaps and using different visual classes.  It is distributed
as part of Sam Leffler's libtiff package and it is also available on
expo.lcs.mit.edu, uunet.uu.net and comp.sources.x. [dbs@decwrl.dec.com, 10/90]

----------------------------------------------------------------------
Subject: 61)  How do I use another window manager with DEC's session manager?

	DEC's session manager will start dxwm up by default. To override this, 
add to your .Xdefaults file something like this line, naming the full pathname:

	sm.windowManagerName:   /usr/bin/X11/your_favorite_wm

----------------------------------------------------------------------
Subject: 62)  How can I change the titlebar of my xterm window?

	The solution involves sending an escape sequence to xterm which will
cause it to update the property which the window manager relies upon for the
string which appears in the window titlebar.
	A solution is as easy as typing this in an xterm running a shell:
		echo "ESC]2;TEXT^G"
where ESC is the escape key, TEXT is the string you wish to have displayed,
and ^G is a Control-G (the BEL character).

	Here is a more complicated csh alias which changes the titlebar to
the current working directory when you change directories:
		alias newcd 'cd \!* ; echo ESC]2\;$cwd^G'

	The digit '2' in these strings indicates to xterm that it should 
change only the title of the window; to change both the title and the name 
used in the icon, use the digit '0' instead, and use '1' to change only the 
icon name.

	These sequences work for both R3 and R4 xterm windows; the R4 xterm,
however, does not accept the looser sequences which worked under R3 and
demands a semicolon, above, for example, where the R3 xterm allowed any
character.

----------------------------------------------------------------------
Subject: 63)  Where can I find the xterm control sequences?

The best source of such information is the file mit/clients/xterm/ctlseq.txt,
a compilation put together by Skip Montanaro (GE CR&D). It dates from R3 but is
fairly accurate.  A hardcopy version was published in the December 1989 
XNextEvent (the XUG newsletter).

Also look for mit/clients/xterm/ctlseqs.ms, which was originally done for X10R4
and which has been updated irregularly and probably incompletely.

In addition, Volume 3 (User's Guide) of the R4 flavor of the O'Reilly 
X Window System series contains an appendix listing xterm control sequences.

Neither of these documents is installed as part of the X11R4 installation.

In a pinch, a VT100 manual will do.

----------------------------------------------------------------------
Subject: 64)  How do I keep my $DISPLAY when I rlogin to another machine?

	There are several ways to avoid having to do a "setenv DISPLAY ..."
whenever you log in to another networked UNIX machine running X.
	One solution is to use the xrlogin program from der Mouse
(mouse@larry.mcrcim.mcgill.edu). You can ftp caveat-emptor versions from
132.206.1.1, in X/xrlogin.c and X/xrlogind.c. The program packages up $TERM and
$DISPLAY into a single string, which is stuffed into $TERM.  rlogin then 
propagates $TERM normally; your .cshrc on the remote machine should contain
		eval `xrlogind`
where xrlogind is a program that checks $TERM and if it is of the special 
format it recognizes, unpacks it and spits out setenv and unsetenv commands to 
recreate the environment variables. [11/90]

	In addition, if all you need to do is start a remote X process on 
another host, and you find
		rsh <HOST> -n /usr/bin/X11/xterm -display $DISPLAY 
too simple (DISPLAY must have your real hostname), then this version of xrsh 
can be used to start up remote X processes. The equivalent usage would be 
		xrsh <HOST> xterm

  #! /bin/sh
  # start an X11 process on another host
  # Date: 8 Dec 88 06:29:34 GMT
  # From: Chris Torek <chris@mimsy.umd.edu>
  # rsh $host -n "setenv DISPLAY $DISPLAY; exec $@ </dev/null >&/dev/null"
  #
  # An improved version:
  # rXcmd (suggested by John Robinson, jr@bbn.com)
  #       (generalized for sh,ksh by Keith Boyer, keith@cis.ohio-state.edu)
  #
  # but they put the rcmd in ()'s which left zombies again.  This
  # script combines the best of both.
  
  case $# in
  [01])  echo "Usage: $0 host x-cmd [args...]";;
  *)
  	case $SHELL in
  	*csh*)  host="$1"; shift
  		xhost "$host" > /dev/null
  		rsh "$host" -n \
  			"setenv TERM xterm; setenv DISPLAY `hostname`:0; \
  			exec $* </dev/null >& /dev/null" &
  		;;
  	*sh)
  		host="$1"; shift
  		xhost "$host" > /dev/null
  		rsh "$host" -n \
  			"TERM=xterm export TERM; \
  			DISPLAY=`hostname`:0 export DISPLAY; \
  			LD_LIBRARY_PATH=/usr/X11/lib export LD_LIBRARY_PATH; \
  			PATH=\$PATH:/usr/X11/bin:/usr/bin/X11:/usr/local/bin; \			export PATH; \
  			exec $* < /dev/null > /dev/null 2>&1" &
  		;;
  	esac
  	;;
  esac

----------------------------------------------------------------------
Subject: 65)* How can I design my own font?

	One way is to use the "bitmap" client or some other bitmap-editor (e.g.
Sun's icon-editor tool, post-processed with pbmplus) to design the individual 
characters and then to do some large amount of post-processing to concatenate 
them into the BDF format.
	The R3 contrib/ area (in fonts/utils/ and in clients/xtroff) contained 
a number of useful utilities, including some to convert between BDF font format
and a simple character format which can be edited with any text editor.
	An easier way is to use the "xfed" client to modify an existing font; a
recent version is on the R4 tape in contrib/clients/xfed. Xfed is available for
anonymous ftp on unido.informatik.uni-dortmund.de (129.217.64.60) as file 
/pub/windows/X/Diverse-X11-Sourcen/xfed.tar.Z.
	The xfedor client from Group Bull permits creation of bitmaps, XPM 
pixmaps, and fonts. Source and documentation are currently not available; but 
binaries for common machines are; see avahi.inria.fr/pub.

----------------------------------------------------------------------
Subject: 66)  Why does adding a font to the server not work?

	After you have built the font using your system's font-compiler, 
installed it in some directory, and run `mkfontdir` or your system's equivalent
in that directory, be sure to use `xset +fp $dir` to add that directory to the 
server's font-path, if it is not already present, and then use `xset fp rehash`
so that the new fonts in that directory are actually found; it is this last 
step that you're probably leaving out.

----------------------------------------------------------------------
Subject: 67)  How do I use DECwindows fonts on my X11R4 server?

	The DECwindows server stores fonts in a ".pcf" format which is not
recognized by the X11R4 server. Jordan Hayes (jordan@morgan.com) has
constructed a "font extractor" that you can use to get the .pcf files from
the DEC server and write the information to a .bdf file, which you can
then recompile to .snf fonts using the font-compiler from the MIT distribution.

----------------------------------------------------------------------
Subject: 68)* Why can't I set the backgroundPixmap resource in my defaults file?
I want to be able to do something like this:
	xclock*backgroundPixmap:      /usr/include/X11/bitmaps/rootweave

	You can't do this. The backgroundPixmap resource is a pixmap of the 
same depth as the screen, not a bitmap (which is a pixmap of depth 1). Because 
of this, writing a generic String to Pixmap converter is impossible, since 
there is no accepted convention for a file format for pixmaps. Therefore, 
neither the X Toolkit or the Athena widget set define a String to Pixmap 
converter, because there is no converter you cannot specify this value as a 
resource.  The Athena widget set does define a String to Bitmap converter for 
use in many of its widgets, however.
[courtesy Chris D. Peterson (kit@expo.lcs.mit.edu), 4/90]

However:
	A specific converter which encapsulates much of the functionality of the
xloadimage package by Jim Frost was posted 12/90 by Sebastian Wangnick 
(basti@unido.informatik.uni-dortmund.de); it permits loading of a number of 
image formats as a pixmap.

	The leading general-purpose format for pixmaps is the XPM format used 
by Groupe Bull in several of its programs, including the GWM window manager, by
AT&T in its olpixmap editor, and by ICS in its interface builder. XPM 
distribution, available on expo as contrib/xpm.tar.Z, includes read/write 
routines which can easily be adapted to converters by new widgets which want to
allow specification of pixmap resources in the above manner.  See information
on the xpm-talk mailing list above.

----------------------------------------------------------------------
Subject: 69)  Why does the R3 xterm, et al, fail against the R4 server?

	The value given to a window's do_not_propagate mask is the likely 
culprit.  R3 allowed bogus values to be set, and early version of both Andrew 
and Interviews did, as well. Similar problems also occur in the R3 Motif
PanedWindow widget.

	If it is impossible to fix client source, use 'xset bc' to put the 
X11R4 server into bug-compatibility mode.

----------------------------------------------------------------------
Subject: 70)  Why doesn't xlock work on my R4 server?

	The version of xlock that went out on the R4 contrib tapes was not
quite R4-conformant; when built and run, it will produce an X_GrabPointer
protocol error. This can be fixed by making the R4 server run in bug-
compatibility mode; just say `xset bc`. 
	xlock has been fixed since; in addition, a major revision just came
out (to comp.sources.x) and can be used instead.  [10/90]

----------------------------------------------------------------------
Subject: 71)+ I have xmh, but it doesn't work. Where can I get mh?

	The xmh mail-reader requires the Rand mh mail/message handling system,
which is not part of the UNIX software distribution for many machines. The
current version of mh is typically on ics.uci.edu in /mh; it was updated in
mid-December 1990 to 6.7.1.	[1/91]

----------------------------------------------------------------------
Subject: 72)  Why am I suddenly unable to connect to my Sun X server?
After a seemingly random amount of time after the X server has been started, no
other clients are able to connect to it.

	The default cron cleanup jobs supplied by Sun (for 4.0.3, at least)
delete "old" (unreferenced) files from /tmp -- including /tmp/.X11-unix, which 
contains the socket descriptor used by X. The solution is to add "! -type s" to
the find exclusion in the cron job.
[10/90]

----------------------------------------------------------------------
Subject: 73)  TOPIC: PROGRAMMING PROBLEMS AND PUZZLES
----------------------------------------------------------------------
Subject: 74)  Why doesn't my program get the keystrokes I select for?

	The window manager controls how the input focus is transferred from one
window to another.  In order to get keystrokes, your program must ask the
window manager for the input focus.  To do this, you must set up what are
called "hints" for the window manager.  If your applications is Xlib-based, you
can use something like the following:

        XWMHints wmhints;
        ...
        wmhints.flags = InputHint;
        wmhints.input = True;
        XSetWMHints(dpy, window, &hints)


If your application is based on the Xt Intrinsics, you can set the XtNinput 
resource to be True (as you probably want to in any case); if you don't have
source, you can start up the application with the resource '*input:True'.

Certain window managers, notably dxwm and olwm, are very picky about having 
this done. 

	If you are using Sun's OpenWindows olwm, you can also add this resource
to your defaults file to use clients that aren't ICCCM-compliant.
	OpenWindows.FocusLenience:       true

[mostly courtesy Dave Lemke of NCD and Stuart Marks of Sun]

----------------------------------------------------------------------
Subject: 75)  Is there a skeleton X program available?
	
	There is no general framework such as the TransSkel program for the 
Macintosh which handles lots of the odds and ends and overhead of development 
under a window system and which can be used as a platform for additional 
development. In X, the problem is typically solved by using an interactive 
application builder tool or by using cut&paste on existing X applications. Good
applications which you might look to manipulate when you want to "test just 
this one little thing" include contrib/clients/xskel, a simple R4 program that 
puts up a window and allows sketching in it and offers a starting point for
quick hacks, the Xaw examples in the examples/ directory in the R3 and R4 
distributions, and the Xlib "Hello World" example in the R3 doc/HelloWorld and 
R4 doc/tutorials/HelloWorld; an updated version of this program which uses R4 
Xlib calls and current ICCCM conventions was posted in 2/90 to comp.windows.x  
by Glenn Widener of Tektronix. 	[3/90]

----------------------------------------------------------------------
Subject: 76)  Why does XtGetValues not work for me?

	The XtGetValues interface for retrieving resources from a widget is
sensitive to the type of variable. Your code may be doing something like this:
	{
	Arg args[3];
	int i;
	int sensitive;		/* oops */
	i=0;
	XtSetArg (args[i], XtNsensitive, &sensitive); i++;
	XtGetValues(widget, args, i );
	...
	}

But XtNsensitive is a Boolean, which on most machines is a single byte; 
declaring the variable "sensitive" as Boolean works properly. This problem 
comes up often when using particular toolkits that redefine the Xt types 
Dimension and Position; code that assumes they are int will have similar 
problems if those types are actually short. In general: you are safe if you
use the actual type of the resource, as it appears in the widget's man page.
[11/90]

----------------------------------------------------------------------
Subject: 77)+ How can my application tell if it is being run under X?

	A number of programs offer X modes but otherwise run in a straight
character-only mode. The easiest way for an application to determine that it is
running on an X display is to attempt to open a connection to the X server:
	display = XOpenDisplay(NULL);
	if (display)
		{ do X stuff }
	else
		{ do curses or something else }

This is superior to checking for a -display command-line argument or checking
for $DISPLAY set in the environment, neither of which is adequate. [1/91]

----------------------------------------------------------------------
Subject: 78)  How do I make a "busy cursor" while my application is computing?
Is it necessary to call XDefineCursor for every window in my application?

	The easiest thing to do is to create a single InputOnly window that is 
as large as the screen; make it a child of your toplevel window and it will be 
clipped to that window, so it won't affect any other application. (It needs to 
be as big as the screen in case the user enlarges the window while it is busy.)
Substitute "toplevel" with your top-most widget here (similar code should work 
for Xlib-only applications; just use your top Window):

     unsigned long valuemask;
     XSetWindowAttributes attributes;

     /* Ignore device events while the busy cursor is displayed. */
     valuemask = CWDontPropagate | CWCursor;
     attributes.do_not_propagate_mask =  (KeyPressMask | KeyReleaseMask |
         ButtonPressMask | ButtonReleaseMask | PointerMotionMask);
     attributes.cursor = XCreateFontCursor(XtDisplay(toplevel), XC_watch);

     /* The window will be as big as the display screen, and clipped by
        its own parent window, so we never have to worry about resizing */
     XCreateWindow(XtDisplay(toplevel), XtWindow(toplevel), 0, 0,
         WidthOfScreen(XtScreen(toplevel)), HeightOfScreen(XtScreen(toplevel)),
         (unsigned int) 0, CopyFromParent, InputOnly,
         CopyFromParent, valuemask, &attributes);

When you want to use this busy cursor, map and raise this window; to go back to
normal, unmap it. This will automatically keep you from getting extra mouse
events; depending on precisely how the window manager works, it may or may not
have a similar effect on keystrokes as well.

In addition, note also that most of the Xaw widgets support an XtNcursor 
resource which can be temporarily reset, should you merely wish to change the
cursor without blocking pointer events.

[thanks to Andrew Wason (aw@cellar.bae.bellcore.com), Dan Heller (argv@sun.com),
and mouse@LARRY.MCRCIM.MCGILL.EDU] [11/90]

----------------------------------------------------------------------
Subject: 79)  Why does XtAppAddInput not work as described?
I am using XtAppAddInput to read from a file, but the function is called even
when there isn't input pending.

	XtAppAddInput is actually working as it is supposed to. When used on
files, it is called whenever the file is READY to be read, not when there is
new data to be read. The file is almost always ready to be read, however, if 
only because you can spin back to the beginning and read data you've read 
before. The result is that your function will almost always be called every
time around XtMainLoop().
	To get the type of interaction you are expecting, add this line to
the beginning of your function to test whether there is new data:
	     if (ioctl(fd, FIONREAD, &n) == -1 || n == 0) return;

[courtesy Dan Heller (argv@ora.com); 8/90]

----------------------------------------------------------------------
Subject: 80)  How do I simulate a button press/release event for a widget?

	You can do this using XSendEvent(); it's likely that you're not setting
the window field in the event, which Xt needs in order to match to the widget
which should receive the event.
	 If you're sending events to your own application, then you can use 
XtDispatchEvent() instead. This is more efficient than XSendEvent() in that you
avoid a round-trip to the server.

[courtesy Mark A. Horstman (mh2620@sarek.sbc.com), 11/90]

----------------------------------------------------------------------
Subject: 81)  Why doesn't anything appear when I run this simple program?

> ...
> the_window = XCreateSimpleWindow(the_display,
>      root_window,size_hints.x,size_hints.y,
>      size_hints.width,size_hints.height,BORDER_WIDTH,
>      BlackPixel(the_display,the_screen),
>      WhitePixel(the_display,the_screen));
> ...
> XSelectInput(the_display,the_window,ExposureMask|ButtonPressMask|
> 	ButtonReleaseMask);
> XMapWindow(the_display,the_window);
> ...
> XDrawLine(the_display,the_window,the_GC,5,5,100,100);
> ...

	You are right to map the window before drawing into it. However, the 
window is not ready to be drawn into until it actually appears on the screen --
until your application receives an Expose event. Drawing done before that will 
generally not appear. You'll see code like this in many programs; this code 
would appear after window was created and mapped:
  while (!done)
    {
      XNextEvent(the_display,&the_event);
      switch (the_event.type) {
	case Expose:	 /* On expose events, redraw */
		XDrawLine(the_display,the_window,the_GC,5,5,100,100);
		break;
	...
	}
    }

	Note that there is a second problem: some X servers don't set up the 
default graphics context to have reasonable foreground/background colors, and 
your program should not assume that the server does, so this program could 
previously include this code to prevent the case of having the foreground and 
background colors the same:
  ...
  the_GC_values.foreground=BlackPixel(the_display,the_screen);	/* e.g. */
  the_GC_values.background=WhitePixel(the_display,the_screen);	/* e.g. */
  the_GC = XCreateGC(the_display,the_window,
                GCForeground|GCBackground,&the_GC_values);
  ...
 
Note: the code uses BlackPixel and WhitePixel to avoid assuming that 1 is 
black and 0 is white or vice-versa.  The relationship between pixels 0 and 1 
and the colors black and white is implementation-dependent.  They may be 
reversed, or they may not even correspond to black and white at all.

----------------------------------------------------------------------
Subject: 82)  What is the difference between a Screen and a screen?

	The 'Screen' is an Xlib structure which includes the information about
one of the monitors or virtual monitors which a single X display supports. A 
server can support several independent screens. They are numbered unix:0.0,
unix:0.1, unix:0.2, etc; the 'screen' or 'screen_number' is the second digit --
the 0, 1, 2 which can be thought of as an index into the array of available 
Screens on this particular Display connection.
	The macros which you can use to obtain information about the particular
Screen on which your application is running typically have two forms -- one
which takes a Screen and one with takes both the Display and the screen_number.
	In Xt-based programs, you typically use XtScreen(widget) to determine 
the Screen on which your application is running, if it uses a single screen.
	(Part of the confusion may arise from the fact that some of the macros
which return characteristics of the Screen have "Display" in the names -- 
XDisplayWidth, XDisplayHeight, etc.)
	
----------------------------------------------------------------------
Subject: 83)  How do I determine the name of an existing widget?
I have a widget ID and need to know what the name of that widget is.

	R4 users are best off using the XtName() function, which will work
on both widgets and non-widget objects.

	If you are still using R3, you can use this simple bit of code to do 
what you want. Note that it depends on the widget's internal data structures 
and is not portable to future versions of Xt, including R4.

	#include <X11/CoreP.h>
	String XtName (widget)
	Widget widget;	/* will not work with non-widget objects */
	{
	return widget->core.name;
	}

[7/90]

----------------------------------------------------------------------
Subject: 84)  Why do I get a BadDrawable error drawing to XtWindow(widget)?
I'm doing this in order to get a window into which I can do Xlib graphics
within my Xt-based program:

> canvas = XtCreateManagedWidget ( ...,widgetClass,...) /* drawing area */
> ...
> window = XtWindow(canvas);	/* get the window associated with the widget */
> ...
> XDrawLine (...,window,...);	/* produces error */

	The window associated with the widget is created as a part of the 
realization of the widget.  Using a window id of NULL ("no window") could 
create the error that you describe.  It is necessary to call XtRealizeWidget() 
before attempting to use the window associated with a widget. 
	Note that the window will be created after the XtRealizeWidget() call, 
but that the server may not have actually mapped it yet, so you should also 
wait for an Expose event on the window before drawing into it.

----------------------------------------------------------------------
Subject: 85)  Can XGetWindowAttributes get a window's background pixel/pixmap?

	No.  Once set, the background pixel or pixmap of a window cannot be 
re-read by clients.  The reason for this is that a client can create a pixmap,
set it to be the background pixmap of a window, and then free the pixmap. The 
window keeps this background, but the pixmap itself is destroyed.  If you're 
sure a window has a background pixel (not a pixmap), you can use XClearArea() 
to clear a region to the background color and then use XGetImage() to read 
back that pixel.  However, this action alters the contents of the window, and 
it suffers from race conditions with exposures. [courtesy Dave Lemke of NCD 
and Stuart Marks of Sun]

	Note that the same applies to the border pixel/pixmap. This is a 
(mis)feature of the protocol which allows the server is free to manipulate the
pixel/pixmap however it wants.  By not requiring the server to keep the 
original pixel or pixmap, some (potentially a lot of) space can be saved. 
[courtesy Jim Fulton, MIT X Consortium]

----------------------------------------------------------------------
Subject: 86)  Why does the pixmap I copy to the screen show up as garbage? 

	The initial contents of pixmaps are undefined.  This means that most
servers will allocate the memory and leave around whatever happens to be there 
-- which is usually garbage.  You probably want to clear the pixmap first using
XFillRectangle() with a function of GXcopy and a foreground pixel of whatever 
color you want as your background (or 0L if you are using the pixmap as a 
mask). [courtesy Dave Lemke of NCD and Stuart Marks of Sun]

----------------------------------------------------------------------
Subject: 87)  How can my application iconify itself?

	The ICCCM provides a mechanism for this; your application sends a
client message which includes a data value indicating that it wishes to be
iconified.  Here is a sample callback that will iconify the application shell, 
wait 3 seconds, and pop it back up. Note that ApplicationShellWidget below
is global; it would make more sense in real use to walk up the tree via 
XtParent() to find the shell containing the active widget.

   void IconifyShell(w, d1, d2)
        Widget w;
        caddr_t d1, d2;
   {
     XClientMessageEvent event;
     Window win;
     Display *dpy;

     event.type = ClientMessage;
     event.send_event = True;
     dpy = event.display = XtDisplay(w);
     win = event.window = XtWindow(ApplicationShellWidget);
     event.message_type = XInternAtom(dpy, "WM_CHANGE_STATE", False);
     event.format = 32;
     event.data.l[0] = IconicState;
     XSendEvent(dpy, DefaultRootWindow(dpy), False,
                SubstructureRedirectMask | SubstructureNotifyMask, &event);
     XFlush(dpy);
     sleep(3);
     XMapWindow(dpy,win);
   }

[courtesy David Brooks (dbrooks@osf.osf.org), 4/90]

R4 users may find it easier to use this routine:
    /*
     * This function instructs the window manager to change this window from
     * NormalState to IconicState.
     */
    Status XIconifyWindow (dpy, w, screen)
        Display *dpy;
        Window w;
        int screen;

----------------------------------------------------------------------
Subject: 88)  How do I check whether a window ID is valid?
My program has the ID of a window on a remote display. I want to check whether
the window exists before doing anything with it.

	Because X is asynchronous, there isn't a guarantee that the window would
still exist between the time that you got the ID and the time you sent an event
to the window or otherwise manipulated it. What you should do is send the event
without checking, but install an error handler to catch any BadWindow errors, 
which would indicate that the window no longer exists. This scheme will work 
except on the [rare] occasion that the original window has been destroyed and 
its ID reallocated to another window.

[courtesy Ken Lee (klee@wsl.dec.com), 4/90]

----------------------------------------------------------------------
Subject: 89)  Can I have two applications draw to the same window?

	Yes. The X server assigns IDs to windows and other resources, and any
application that knows the ID can manipulate the resource.
	The problem you face is how to disseminate the window ID to multiple 
applications. A simple way to handle this (and which solves the problem of the
applications' running on different machines) is in the first application to 
create a specially-named property on the root-window and put the window ID into 
it. The second application then retrieves the property, whose name it also
knows, and then can draw whatever it wants into the window.
	[Note: this scheme works iff there is only one instance of the first
application running, and the scheme is subject to the limitations mentioned
in the Question about using window IDs on remote displays.]
	Note also that you will still need to coordinate any higher-level 
cooperation among your applications. 
	Note also that two processes can share a window but should not try to 
use the same server connection. If one process is a child of the other, it 
should close down the connection to the server and open its own connection.

[mostly courtesy Phil Karlton (karlton@wpd.sgi.com) 6/90]

----------------------------------------------------------------------
Subject: 90)+ How do I keep a window from being resized by the user?

	Resizing the window is done through the window manager; window managers
can pay attention to the size hints your application places on the window, but 
there is no guarantee that the window manager will listen. You can try setting 
the minimum and maximum size hints to your target size and hope for the best. 
[1/91]

----------------------------------------------------------------------
Subject: 91)  How do I render rotated text?
	
	Xlib intentionally does not provide such sophisticated graphics 
capabilities, leaving them up to server-extensions or clients-side graphics
libraries.
	Your only choice, if you want to stay within the core X protocol, is to
render the text into a pixmap, read it back via XGetImage(), rotate it "by hand"
with whatever matrices you want, and put it back to the server via XPutImage();
more specifically:
	1) create a bitmap B and write your text to it.
	2) create an XYBitmap image I from B (via XGetImage).
	3) create an XYBitmap Image I2 big enough to handle the transformation.
	4) for each x,y in I2, I2(x,y) = I(a,b) where 
		a = x * cos(theta) - y * sin(theta)
		b = x * sin(theta) + y * cos(theta)
	5) render I2
	Note that you should be careful how you implement this not to lose
bits; an algorithm based on shear transformations may in fact be better.
	The high-level server-extensions and graphics packages available for X 
also permit rendering of rotated text: Display PostScript, PEX, PHIGS, and GKS,
although most are not capable of arbitrary rotation and probably do not use the
same fonts that would be found on a printer.
	In addition, if you have enough access to the server to install a font
on it, you can create a font which consists of letters rotated at some
predefined angle. Your application can then itself figure out placement of each
glyph.

[courtesy der Mouse (mouse@larry.mcrcim.mcgill.edu), Eric Taylor 
(etaylor@wilkins.bmc.tmc.edu), and Ken Lee (klee@wsl.dec.com), 11/90;
Liam Quin (lee@sq.com), 12/90]

----------------------------------------------------------------------
Subject: 92)+ Why can't my program get a standard colormap?
I have an image-processing program which uses XGetRGBColormap() to get the 
standard colormap, but it doesn't work. 

	XGetRGBColormap() when used with the property XA_RGB_DEFAULT_MAP does 
not create a standard colormap -- it just returns one if one already exists.
Use xstdcmap or do what it does in order to create the standard colormap first.

[1/91; from Stuart Little (mouse@larry.mcrcim.mcgill.edu)]


--------------------------------------------------

Local Variables:
mode: outline
outline-regexp: "Subject:[ ]+[0-9]+)"
eval: (hide-body)
End:
-- 

The X User's Group		xug@expo.lcs.mit.edu	+1 617 547 0634
"No, I'm a member of the X User's Group, not the Ex-User's Group."