From f637a5b03164263a3af2e644cf655e52b015f1bb Mon Sep 17 00:00:00 2001 From: Ross Combs Date: Sat, 25 Nov 2006 14:45:17 -0800 Subject: [PATCH] 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. --- man/XGetWindowAttributes.man | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/man/XGetWindowAttributes.man b/man/XGetWindowAttributes.man index d0521ada..b7665b71 100644 --- a/man/XGetWindowAttributes.man +++ b/man/XGetWindowAttributes.man @@ -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