Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!ucsd!ucbvax!bloom-beacon!ti-csl.csc.ti.COM!ekberg From: ekberg@ti-csl.csc.ti.COM Newsgroups: comp.windows.x Subject: Re: Pixmap size Message-ID: <9008221456.AA16766@osage.csc.ti.com> Date: 22 Aug 90 14:56:17 GMT Sender: ekberg@osage.csc.ti.com Organization: The Internet Lines: 39 adri@dutncp6.tudelft.nl (A.B. van Woerkom) writes: > klee@wsl.dec.com (Ken Lee) writes: > > > >In article , adri@dutncp8.tudelft.nl (Adri van Woerkom > >(A.B.)) writes: > >|> When XGetWindowAttributes is called with a Pixmap id as second parameter > >|> (instead of the window id) the width, height, depth and screen members > >|> of the returned XWindowAtributes structure are filled in (all others > >|> will return 0). > > I had this from the O'Reilly Xlib Reference Manual, Third Printing, May > 1989. > > >This may work with some implementations, but is non-standard. > >XGetWindowAttributes is only guaranteed to work on windows. To get > >info on pixmaps, use XGetGeometry. > > If this is the case a there should be some warning in the next edition of > the named reference. The GetWindowAttributes request does not return the width, height or depth even if it is passed a window as its argument. The GetGeometry request takes a drawable (a window or pixmap) as its argument and returns the width, height and depth, as well as some other values. In the X11R4 protocol specification, see pages 15-16 for the description of GetWindowAttributes and page 20 for the description of GetGeometry. The confusion seems to be that the Xlib XGetWindowAttributes function returns a pointer to an XWindowAttributes structure, which does have slots for width, height and depth. What this means is that to obtain this information the XGetWindowAttributes function invokes both the GetWindowAttributes request, which works only for a window, and the GetGeometry request which works for either a window or a pixmap. In the source (mit/lib/X/XGetWAttrs.c), the GetWindowAttributes request is called unconditionally which will cause the server to generate a Window error if the user attempts to pass a pixmap as its argument. -- tom (aisle C-4Q), ekberg@csc.ti.com