Debian bug #354315: Clarify return value in XGetWindowAttributes man page

This man page does not discuss the actual return values of the
function, but says they are of type "Status".  One might assume
that this means you could compare it with the "Success" macro.
One would be wrong.

The X functions seem to have two three types representing status.
If it is an "int" there are a number of error codes or "Success"
which can be compared against.  If it is a bool, the result can be
compared with "True" or "False".  If the return type is "Status" it
appears that the return type is either 0 or 1.  Unfortunately the
value for Success is zero, so it is important to distinguish
between the first two types of return values and the third;
otherwise the conditional will be inverted.

XGetWindowAttributes() is one of the functions which returns zero
for failure.  The man page should make this clear.
This commit is contained in:
Ross Combs 2006-11-25 14:45:17 -08:00 committed by Josh Triplett
parent c6a0b0f18e
commit f637a5b031

View file

@ -193,7 +193,8 @@ The
.ZN XGetWindowAttributes
function returns the current attributes for the specified window to an
.ZN XWindowAttributes
structure.
structure. It returns a nonzero status on success; otherwise, it returns a
zero status.
.LP
.ZN XGetWindowAttributes
can generate
@ -210,6 +211,8 @@ border width, and depth.
These are described in the argument list.
It is legal to pass to this function a window whose class is
.ZN InputOnly .
It returns a nonzero status on success; otherwise, it returns a
zero status.
.SH STRUCTURES
The
.ZN XWindowAttributes