1%----------------------------------------------------------------------------
2% Magic Maintainer's Manual number 4
3%----------------------------------------------------------------------------
4
5\NeedsTeXFormat{LaTeX2e}[1994/12/01]
6\documentclass[letterpaper,twoside,12pt]{article}
7\usepackage{epsfig,times}
8
9\setlength{\textwidth}{8.5in}
10\addtolength{\textwidth}{-2.0in}
11\setlength{\textheight}{11.0in}
12\addtolength{\textheight}{-2.0in}
13\setlength{\oddsidemargin}{0in}
14\setlength{\evensidemargin}{0pt}
15\setlength{\topmargin}{-0.5in}
16\setlength{\headheight}{0.2in}
17\setlength{\headsep}{0.3in}
18\setlength{\topskip}{0pt}
19
20\def\hinch{\hspace*{0.5in}}
21\def\starti{\begin{center}\begin{tabbing}\hinch\=\hinch\=\hinch\=hinch\hinch\=\kill}
22\def\endi{\end{tabbing}\end{center}}
23\def\ii{\>\>\>}
24\def\mytitle{Magic Maintainer's Manual \#4: Using Magic Under X Windows}
25
26%----------------------------------------------------------------------------
27
28\begin{document}
29
30\makeatletter
31\newcommand{\ps@magic}{%
32	\renewcommand{\@oddhead}{\mytitle\hfil\today}%
33	\renewcommand{\@evenhead}{\today\hfil\mytitle}%
34	\renewcommand{\@evenfoot}{\hfil\textrm{--{\thepage}--}\hfil}%
35	\renewcommand{\@oddfoot}{\@evenfoot}}
36\newcommand{\ps@mplain}{%
37	\renewcommand{\@oddhead}{}%
38	\renewcommand{\@evenhead}{}%
39	\renewcommand{\@evenfoot}{\hfil\textrm{--{\thepage}--}\hfil}%
40	\renewcommand{\@oddfoot}{\@evenfoot}}
41\makeatother
42\pagestyle{magic}
43\thispagestyle{mplain}
44
45
46\begin{center}
47  {\bfseries \Large \mytitle} \\
48  \vspace*{0.5in}
49  {\itshape Don Stark} \\
50  \vspace*{0.5in}
51   Computer Systems Laboratory \\
52   Stanford University \\
53   Stanford, CA  94305 \\
54  \vspace*{0.25in}
55  This tutorial corresponds to Magic version 7. \\
56\end{center}
57\vspace*{0.5in}
58
59{\noindent\bfseries\large Tutorials to read first:}
60\starti
61   \> Magic Tutorial  \#1: Getting Started
62\endi
63
64{\noindent\bfseries\large Commands introduced in this tutorial:}
65\starti
66   \> {\itshape (None)}
67\endi
68
69{\noindent\bfseries\large Macros introduced in this tutorial:}
70
71\starti
72   \> {\itshape (None)}
73\endi
74\section{Introduction}
75
76This document provides information on Magic's X drivers that may be of help
77to system maintainers.
78
79\section{Compiling the Correct X Driver for your system.}
80
81Unfortunately, it is not possible to link with both the X10 and X11
82libraries, so you will have to compile Magic differently depending
83on the version of X that you are running.
84
85\subsection{Compiling for X11}
86
87\begin{enumerate}
88\item Add the flag -DX11 to misc/DFLAGS
89\item Add -lX11 to magic/LIBS
90\item Change the SRCS line in graphics/Makefile to  \${BASE{\_}SRCS} \${X11{\_}SRCS}
91\item Change the OBJS line to  \${BASE{\_}OBJS} \${X11{\_}OBJS}
92\item Change the POBJS line to  \${BASE{\_}POBJS} \${X11{\_}POBJS}
93\item Change the HELPER{\_}SRCS line  \${X11HELPER{\_}SRCS}
94\item Change the HELPER{\_}SRCS line  \${X11HELPER{\_}PROG}
95\item Compile the module graphics.o
96\item Relink magic
97\end{enumerate}
98
99\subsection{Compiling for X10}
100
101\begin{enumerate}
102\item Add the flag -DX10 to misc/DFLAGS
103\item Add -lX10 to magic/LIBS
104\item Change the SRCS line in graphics/Makefile to  \${BASE{\_}SRCS} \${X10{\_}SRCS}
105\item Change the OBJS line to  \${BASE{\_}SRCS} \${X10{\_}OBJS}
106\item Change the POBJS line to  \${BASE{\_}SRCS} \${X10{\_}POBJS}
107\item Change the HELPER{\_}SRCS line  \${X10HELPER{\_}SRCS}
108\item Change the HELPER{\_}SRCS line  \${X10HELPER{\_}PROG}
109\item Compile the module graphics.o
110\item Relink magic
111\end{enumerate}
112
113\section{Troubleshooting the X Drivers}
114
115The following is a list of problems sometimes encountered in running Magic
116under X and some suggestions about how to get around the problem.
117
118\subsection{X11 Driver}
119
120\begin{itemize}
121\item Fonts \\
122We have tried to pick a set of fonts that most machines running
123X11 Revision 3 will have, but there is nothing to guarantee that
124a given machine will have a font. If you're getting "unable to load font"
125messages, you will need to change the fonts that Magic uses.  The simplest
126way to do this is to specify them in your .Xdefaults file as described in
127section 2.1. To change the default values that Magic uses, change the
128"fontnames" array in the file grX11su3.c of the graphics module.
129The program {\itshape xlsfonts} will tell you what fonts are available on your
130machine.
131
132\item Strange Color Effects \\
133Magic often co-exists rather uneasily with
134other X applications because it is picky about which colors it is allocated.
135If possible, it tries to allocate the colors it requires out of the
136display's default colormap because this perturbs other applications the least.
137If this fails, however, Magic makes its own colormap.  When this colormap
138gets installed is a function of the window manager; most window managers
139install it when the cursor is in the magic window.  Unfortunately, there is
140no way to guarantee that the window manager installs the magic colormap
141correctly;  if you get erratic colormap behavior, try using a lower number
142of planes or reducing the number of colors that other applications use.
143
144\item
145When magic's colormap is being used, other windows may change color,
146possibly to some unusable combination such as black on black or white
147on white.  This problem can sometimes be ameliorated by changing the
148constants X{\_}COLORMAP{\_}BASE and X{\_}COLORMAP{\_}RESERVED in grX11su2.c;
149a more complete
150description of what these constants do is included in that file.
151Values for these constants that are incompatible with your machine
152will sometimes generate Xerrors in XQueryColors.
153
154\item Failure to prompt user for window position \\
155Whether or not the
156designer is prompted for a window's location is dependent on the window
157manager.  Certain window managers, notably {\itshape twm}, do not always
158do this.
159\end{itemize}
160
161\subsection{X10 Driver}
162
163In general, the Version 10 driver is less reliable than the X11 one.
164If you have the choice, you are better off running under X11.
165
166\begin{itemize}
167\item grX2.GrXSetCMap: Failed to get color cells \\
168Magic gives this
169error when it can't get sufficient colors to run.  This can be caused
170by running Magic on a machine with an insufficient number of planes
171(8 planes are generally required to run a 7 bit dstyles file), or by
172having too many colors already used by other applications.  Try
173using only black and white xterms, xclocks, etc., and see if the problem
174goes away.
175
176\item Couldn\'t get 7 planes; allocating by color \\
177Certain X10 servers,
178most notably the VaxstationII-GPX, allocate colors in such a way that
179Magic can never get the 7 color planes that it wants.  When this
180happens, Magic instead allocates 128 colors. This is better than nothing,
181but not by much; strange colors often result when layers overlap.
182\end{itemize}
183
184\section{Acknowledgments}
185
186Many people share the credit (and the blame) for the Magic X drivers.
187The original X10 port was done by Mark Linton and Doug Pan at Stanford
188University.  Walter Scott and Eric Lunow of Lawrence Livermore
189National Laboratories modified the driver and the windows module
190so that magic windows act like normal X windows.  Meanwhile, Dave Durfee and
191Markus G. Wloka of Brown University improved the reliability of the Stanford
192X10  driver and added support for a variable number of planes.  Marco Papa
193of USC converted the Brown X10 driver to X11.  Concurrently, someone at
194the University of Washington converted the Stanford X10 driver to X11.
195The X11 driver in this distribution is predominantly a merge of the UW
196driver with the multiwindow features of the LLNL driver.  Some of the ideas
197for supporting differing plane counts were borrowed from the USC/Brown work.
198Thanks to the Digital Equipment Corporation Western Research Laboratory
199(DECWRL) for use of their computer facilities, and to Mike Chow of
200Apple Computer for the Macintosh II-specific changes.
201
202\end{document}
203