[comp.windows.x] O'Reilly Xlib Books Errata

adrian@ora.UUCP (Adrian Nye ) (10/28/88)

Over the past two months, several errors in "the O'Reilly X books"
have come to my attention, some of them reported in this news group.
A current list of known errors follows, for the benefit of the
readers of the books.  If you know of any other errors, please 
report them to me by e-mail.  I will post occasional summaries like 
this, and will correct the errors in future printings of the books.

VOLUME ONE, Xlib Programming Manual:
------------------------------------

Page 15	
The section titled Buffering states that the server queues up
events before sending them to the client, and that the client
always triggers the network transaction.  This is incorrect.  Actually,
the server normally sends events to the client immediately, which
triggers a network transaction.  The server only holds events if
an active grab is in effect with certain parameters, and
events must be held briefly if a transaction is already 
in progress.

Page 51, 77
The constant XA_BITMAPDEPTH in Examples 3-1 and 3-19 should
be BITMAPDEPTH,  although this
does not affect the operation of the program.
The XA_ prefix is reserved for predefined property atoms.

Page 144
Figure 6-2 compares the effect of XDrawRectangle and
XFillRectangle calls.  The comparison is accurate, but the arguments
shown are slightly wrong.  The last argument to both routines should be
11, not 12.

Page 185
The headings of several columns in Table 7-3 are incorrect.
The colors should be in the order Red, Green, and Blue.

Page 186, 188
The hexadecimal color string for pink is shown as #6c8f8f in the middle
of page 186 and the end of page 188; it should be #bc8f8f.
In Table 7-4, page 188, pink is listed as 0x6c00 and (0x6c<<8); it 
should read 0xbc00 and (0xbc<<8).

Page 254, 255
The dialog box code in Example 9-4 has a small bug in two places.  On 
the last line of page 254, the length of the string is compared to 
the longest string that can be displayed, to determine whether there 
is room.  However, it should add the length of the string to be 
appended to the existing string before making the test.  The revised 
code looks like this:

	if ((strlen(string) + strlen(buffer)) >= MAX_POPUP_STRING_LENGTH)

The same change should also be made near the top of page 255.

Also note that the letters XA_ appear in the constant names in
Example 9-4 due to an editing error.  This does not affect the 
operation of the program.

Page 339
In Example 12-2, I pass myDisplayName to 
XCloseDisplay.  The argument should be display.

Page 541
The VisibilityNotify event page lists the constants for the
state member in the comment as Obscured or 
Unobscured.  In the description below the 
comment they are listed as VisibilityUnobscured, 
VisibilityPartiallyObscured, or VisibilityObscured.
The latter list is correct.

Page 585
Much of the information in Appendix H, Sources of Additional 
Information is now outdated.  Integrated Computer Solution's
number in Cambridge has changed to 547-0510 (they organize the
X user's group, and do X consulting and training).  Much of the
remaining information is kept up to date by posting to this
news group from the X Consortium.

VOLUME TWO, Xlib Reference Manual:
---------------------------------

Page 39
In the Description section of the XAllocColor page, it 
says that XAllocColor returns nonzero if it succeeds.  This 
is true, but it actually returns 1 on success.
The same is true on a number of other reference pages, namely:
XAllocNamedColor (page 45),  XGetGeometry (page 209),
XGetWindowAttributes (page 239), XLookupColor (page 280)
XParseColor (page 304),  and XQueryTree (page 336).

Page 119
On the XDefineCursor page, the description of the cursor 
argument says that None means no cursor is displayed.  
Actually, None means the parent's cursor is used, except 
for the root window when it means that the default cursor is used.
It is not possible to turn off the cursor.

Page 178, 180
The figure on both the XFillRectangle and XFillRectangles calls
compares the effect of XDrawRectangle and
XFillRectangle calls.  The comparison is accurate, but the arguments
shown are slightly wrong.  The last argument to both routines should be
11, not 12.

Page 200
The XGetAtomName page neglects to say that if the specified 
atom name is not defined, XGetAtomName returns NULL.

Page 212
The XGetImage page neglects to say that if XGetImage
fails for any reason, it returns NULL.


Page 219
The XGetMotionEvents page neglects to say that if 
XGetMotionEvents fails for any reason, it returns NULL.
It is server-dependent (I think) whether the motion history buffer
not existing is interpreted as failure.  It is probably safer
to check whether display->motion_buffer > 0.

Page 242
The end of the description of the XGetWindowProperty page
implies that error codes such as BadWindow are "returned."
It is more accurate to say that these errors are generated.
These error codes are values for the error_code member of the 
XErrorEvent structure which is generated when an error takes place.
Also note that the returned value for XGetWindowProperty is 
anomalous in Xlib.  It is the only routine to return the constant
Success on success, which has a value of 0.  All other routines
that return 1 or 0 return 1 on success.

Page 255
XGrabPointer may generate more than one pair of
EnterNotify and LeaveNotify events. 
The statement that it generates just one pair is near the bottom of
page 255.

Page 263
The XInternAtom page should say that XInternAtom returns
the ID of the atom, whether it creates a new one or not.

Page 271, 273
The XListFontsWithInfo and XListHosts pages neglect
to say that if either routine fails for any reason, it 
returns NULL.

Page 275
The XListProperties page neglects to say that 
when XListProperties fails, returns NULL and sets the 
num_prop argument to 0.

Page 276
On the XLoadFont page,
the BadName error is generated when the font name specified does
not identify an available font.

Page 277
The XLoadQueryFont page does not specify the errors that
may be generated.  They are the same as for XLoadFont (BadAlloc and BadName).

Page 327
The XQueryFont page neglected to say that XQueryFont returns 
NULL if the specified font is not loaded or if the routine 
fails for some other reason.
It also fails to says that BadAlloc and BadFont 
errors may be generated.

Page 333, 335
The XQueryTextExtents and XQueryTextExtents16 pages 
neglects to say that both routines return 1 on success
and 0 on failure.  Also, both routines should be declared as 
int in ANSI standard C code.
The latter error is also present in MIT's Xlib documentation
and the Xlib code.

Page 428
The XSetModifierMapping page neglects to declare the
routine as int, which is required for ANSI standard C code.

Page 479
The XTranslateCoordinates page says that the routine returns
0 or 1.  This is correct, but since it is declared as Bool,
it is more appropriate to use the symbols True and 
False.

Page 538
The headings of several columns in Table D-1 are incorrect.
The colors should be in the order Red, Green, and Blue.

Page 588
The VisibilityNotify event page lists the constants for the
state member in the comment as Obscured or 
Unobscured.  In the description below the 
comment they are listed as VisibilityUnobscured, 
VisibilityPartiallyObscured, or VisibilityObscured.
The latter list is correct.

Page 700
The subwindow_mode section of the GC at-a-glance defines 
ClipByChildren
thus: "Graphics drawn will draw through any other window that has a
background".  It should read that graphics will !!*NOT*!! draw through 
any other window that has a background.
-- 
Adrian Nye (617) 527-4210
O'Reilly & Associates, Inc., Publishers of Nutshell Handbooks
981 Chestnut Street, Newton, MA 02164
UUCP:	uunet!ora!adrian   ARPA: adrian@ora.uu.net