[comp.windows.x] XGetWindowAttributes

dmm@apollo.HP.COM (Donna Mcmanus) (06/16/90)

Keywords: 


Has anyone out there ever successfully called XGetWindowAttributes
specifying a pixmap id instead of a window id?  O'Reilly & Associates
claims that this is permissable, but I've only received "X Protocol
error:  not a valid window ID" each time I've attempted it.  I've tried
this with X11 R4 as well as with previous versions of the X server.

rws@EXPO.LCS.MIT.EDU (Bob Scheifler) (06/16/90)

    Has anyone out there ever successfully called XGetWindowAttributes
    specifying a pixmap id instead of a window id?  O'Reilly & Associates
    claims that this is permissable,

The Bible tells you not so. :-)  See the official R4 Xlib or Protocol manual.
I'm afraid the O'Reilly book is in error here.

If you want root/width/height information, use XGetGeometry.

klee@wsl.dec.com (Ken Lee) (06/16/90)

In article <4b057b34.20b6d@apollo.HP.COM>, dmm@apollo.HP.COM (Donna
Mcmanus) writes:
|> Has anyone out there ever successfully called XGetWindowAttributes
|> specifying a pixmap id instead of a window id?  O'Reilly & Associates
|> claims that this is permissable

I think O'Reilly is wrong.  Both the MIT Xlib manual and MIT protocol
manual say the request must specify a window (not drawable) ID.

Ken Lee
DEC Western Software Laboratory, Palo Alto, Calif.
Internet: klee@wsl.dec.com
uucp: uunet!decwrl!klee

disbrow@skipper.dfrf.nasa.gov (Jim Disbrow) (12/20/90)

I'm having trouble getting the windows background pixel value.
We've tried XGetWindowAttributes, but no luck.
Has anyone else needed to find out the background or foreground color?
We can set it with XSetWindowAttributes, but XGetWindowAttributes 
doesn't return this attribute. 

Thanx in advance,
Jim Disbrow

work: 805/258-3417
home: 805/948-1363

internet:  disbrow@skipper.dfrf.nasa.gov

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  Brain. Brain. What is brain?
      -- Kara the Eymorg, "Spock's Brain," stardate 5432.3.

mouse@LARRY.MCRCIM.MCGILL.EDU (12/21/90)

> I'm having trouble getting the windows background pixel value.  We've
> tried XGetWindowAttributes, but no luck.

Right.  There is no way to get a window's background, or even to find
out whether it's None, a solid value, or a pixmap.

No sure nondestructive way, that is.  Under some circumstances you can
infer what the background must be, but all such attempts suffer from
similar problems - they depend on the window being visible (or having
backing-store) and they destroy some part of its contents.

> Has anyone else needed to find out the background or foreground
> color?

Windows don't have foreground colors.  (Graphics contexts do, and you
*can* inquire about a GC's foreground value, with XGetGCValues.)

					der Mouse

			old: mcgill-vision!mouse
			new: mouse@larry.mcrcim.mcgill.edu

klee@wsl.dec.com (Ken Lee) (12/22/90)

In article <726@skipper.dfrf.nasa.gov>, disbrow@skipper.dfrf.nasa.gov (Jim Disbrow) writes:
|> I'm having trouble getting the windows background pixel value.
|> We've tried XGetWindowAttributes, but no luck.
|> Has anyone else needed to find out the background or foreground color?


You cannot retrieve a window's background pixel, background pixmap,
border pixel, or border pixmap.  Foreground color is not a window
attribute.  The rational behind this is that the current design allows
a server to store the information much more efficiently.  You can
attempt to retrieve the background pixel with XGetImage (possibly
preceded by XClearArea), but this is not guaranteed to be the same as
the background pixel.

-- 
Ken Lee
DEC Western Software Laboratory, Palo Alto, Calif.
Internet: klee@wsl.dec.com
uucp: uunet!decwrl!klee